tools: Apply Warp below NDE filters

Resolves #10736.

By default, any filter added with a drawable with
gimp_drawable_filter_new () will be added on top
of the filter stack. Now that we have NDE effects,
there can be multiple live filters when drawing.

The Warp tool applies a GEGL operation as well,
and now it draws on top of any existing effect.
This patch adds code to move the Warp's filter
below any other NDE effects so it operates on
the raw pixels only.

Note that a longer term solution might be to have
a separate stack for tool-based GEGL operations,
but that would be a post 3.0 discussion.
This commit is contained in:
Alx Sa 2024-02-09 17:48:53 +00:00
parent 25145b9684
commit cbb1e81686

View file

@ -36,6 +36,8 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpdrawable-filters.h"
#include "core/gimpdrawablefilter.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
@ -1247,13 +1249,30 @@ gimp_warp_tool_update_area (GimpWarpTool *wt,
const GeglRectangle *area,
gboolean synchronous)
{
GeglRectangle rect;
GeglRectangle rect;
GimpContainer *filters;
if (! wt->filter)
return;
rect = gimp_warp_tool_get_invalidated_by_change (wt, area);
/* Move this operation below any non-destructive filters that
* may be active, so that it's directly affect the raw pixels. */
filters =
gimp_drawable_get_filters (gimp_drawable_filter_get_drawable (wt->filter));
if (gimp_container_have (filters, GIMP_OBJECT (wt->filter)))
{
gint end_index = gimp_container_get_n_children (filters) - 1;
gint index = gimp_container_get_child_index (filters,
GIMP_OBJECT (wt->filter));
if (end_index > 0 && index != end_index)
gimp_container_reorder (filters, GIMP_OBJECT (wt->filter),
end_index);
}
if (synchronous)
{
GimpTool *tool = GIMP_TOOL (wt);