tools, widgets: Don't show Fx icon for tool-based filters

We use GEGL filters for some of our currently destructive
editing only tools, like Warp and Bucket Fill.
While eventually these will have non-destructive options,
for now it's confusing to show an Fx icon briefly when
the tools are active.
This patch sets these filters as temporary, and updates
the GimpItemTreeView code to not show the Fx icon
if there is only one filter and it is temporary.
Temporary filters can not be deleted from the NDE
pop-up, only from their tools, preventing another set
of reported crashes.
This commit is contained in:
Alx Sa 2025-04-19 17:38:16 +00:00
parent d46b6e4e0e
commit cc50ef99a6
6 changed files with 27 additions and 7 deletions

View file

@ -371,6 +371,7 @@ gimp_bucket_fill_tool_start (GimpBucketFillTool *tool,
tool->priv->filter = gimp_drawable_filter_new (drawables->data, _("Bucket fill"), tool->priv->filter = gimp_drawable_filter_new (drawables->data, _("Bucket fill"),
tool->priv->graph, tool->priv->graph,
GIMP_ICON_TOOL_BUCKET_FILL); GIMP_ICON_TOOL_BUCKET_FILL);
g_object_set (tool->priv->filter, "temporary", TRUE, NULL);
gimp_drawable_filter_set_region (tool->priv->filter, gimp_drawable_filter_set_region (tool->priv->filter,
GIMP_FILTER_REGION_DRAWABLE); GIMP_FILTER_REGION_DRAWABLE);

View file

@ -1105,6 +1105,7 @@ gimp_gradient_tool_create_filter (GimpGradientTool *gradient_tool,
C_("undo-type", "Gradient"), C_("undo-type", "Gradient"),
gradient_tool->graph, gradient_tool->graph,
GIMP_ICON_TOOL_GRADIENT); GIMP_ICON_TOOL_GRADIENT);
g_object_set (gradient_tool->filter, "temporary", TRUE, NULL);
gimp_drawable_filter_set_region (gradient_tool->filter, gimp_drawable_filter_set_region (gradient_tool->filter,
GIMP_FILTER_REGION_DRAWABLE); GIMP_FILTER_REGION_DRAWABLE);

View file

@ -755,6 +755,7 @@ gimp_seamless_clone_tool_create_filter (GimpSeamlessCloneTool *sc,
_("Seamless Clone"), _("Seamless Clone"),
sc->render_node, sc->render_node,
GIMP_ICON_TOOL_SEAMLESS_CLONE); GIMP_ICON_TOOL_SEAMLESS_CLONE);
g_object_set (sc->filter, "temporary", TRUE, NULL);
gimp_drawable_filter_set_region (sc->filter, GIMP_FILTER_REGION_DRAWABLE); gimp_drawable_filter_set_region (sc->filter, GIMP_FILTER_REGION_DRAWABLE);

View file

@ -2040,11 +2040,12 @@ filter_new (GimpTransformGridTool *tg_tool,
gimp_gegl_node_set_underlying_operation (node, filter->transform_node); gimp_gegl_node_set_underlying_operation (node, filter->transform_node);
filter->filter = gimp_drawable_filter_new ( filter->filter =
drawable, gimp_drawable_filter_new (drawable,
GIMP_TRANSFORM_TOOL_GET_CLASS (tg_tool)->undo_desc, GIMP_TRANSFORM_TOOL_GET_CLASS (tg_tool)->undo_desc,
node, node,
gimp_tool_get_icon_name (GIMP_TOOL (tg_tool))); gimp_tool_get_icon_name (GIMP_TOOL (tg_tool)));
g_object_set (filter->filter, "temporary", TRUE, NULL);
gimp_drawable_filter_set_clip (filter->filter, FALSE); gimp_drawable_filter_set_clip (filter->filter, FALSE);
gimp_drawable_filter_set_override_constraints (filter->filter, TRUE); gimp_drawable_filter_set_override_constraints (filter->filter, TRUE);

View file

@ -1091,6 +1091,7 @@ gimp_warp_tool_create_filter (GimpWarpTool *wt,
_("Warp transform"), _("Warp transform"),
wt->graph, wt->graph,
GIMP_ICON_TOOL_WARP); GIMP_ICON_TOOL_WARP);
g_object_set (wt->filter, "temporary", TRUE, NULL);
gimp_drawable_filter_set_region (wt->filter, GIMP_FILTER_REGION_DRAWABLE); gimp_drawable_filter_set_region (wt->filter, GIMP_FILTER_REGION_DRAWABLE);

View file

@ -3003,6 +3003,7 @@ gimp_item_tree_view_filters_changed (GimpItem *item,
GList *filter_list = NULL; GList *filter_list = NULL;
gint n_filters = 0; gint n_filters = 0;
gboolean fs_disabled = FALSE; gboolean fs_disabled = FALSE;
gboolean temporary_only = TRUE;
iter = gimp_container_view_lookup (container_view, iter = gimp_container_view_lookup (container_view,
(GimpViewable *) item); (GimpViewable *) item);
@ -3016,11 +3017,25 @@ gimp_item_tree_view_filters_changed (GimpItem *item,
filter_list = g_list_previous (filter_list)) filter_list = g_list_previous (filter_list))
{ {
if (GIMP_IS_DRAWABLE_FILTER (filter_list->data)) if (GIMP_IS_DRAWABLE_FILTER (filter_list->data))
{
n_filters++; n_filters++;
if (temporary_only)
g_object_get (filter_list->data,
"temporary", &temporary_only,
NULL);
}
else else
{
fs_disabled = TRUE; fs_disabled = TRUE;
} }
} }
}
/* Don't show icon if we only have a temporary filter
* like a tool-based filter */
if (temporary_only)
n_filters = 0;
if (n_filters == 0 || fs_disabled) if (n_filters == 0 || fs_disabled)
view->priv->effects_filter = NULL; view->priv->effects_filter = NULL;