tools: Don't make nop effects non-destructive

If you run the GEGL Operation tool without choosing
a filter, it leaves a "gegl:nop" layer effect behind.
This is not useful, so we check and set such filters as
destructive to get rid of when applying an effect.
This commit is contained in:
Alx Sa 2024-01-30 19:49:23 +00:00
parent 3d721935eb
commit 5f561bfbca
1 changed files with 13 additions and 0 deletions

View File

@ -471,6 +471,7 @@ gimp_filter_tool_control (GimpTool *tool,
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (tool);
GimpDrawable *drawable = NULL;
gboolean non_destructive = TRUE;
gchar *operation_name = NULL;
switch (action)
{
@ -491,6 +492,18 @@ gimp_filter_tool_control (GimpTool *tool,
if (! GIMP_IS_LAYER (drawable))
non_destructive = FALSE;
if (filter_tool->operation)
{
gegl_node_get (filter_tool->operation,
"operation", &operation_name,
NULL);
if (! g_strcmp0 (operation_name, "gegl:nop"))
non_destructive = FALSE;
g_free (operation_name);
}
gimp_filter_tool_commit (filter_tool, non_destructive);
break;
}