app: connect layer backdrop to source node's input

Make sure the input of the layer's filter node is connected to its
source node (when it has an input pad), so that, once we implement
pass-though mode, the group's source node can see the backdrop.
This commit is contained in:
Ell 2017-04-21 15:38:57 -04:00
parent 785a0834a2
commit ac3190215b
2 changed files with 15 additions and 0 deletions

View File

@ -1226,6 +1226,7 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
GeglNode *
gimp_drawable_get_source_node (GimpDrawable *drawable)
{
GeglNode *input;
GeglNode *source;
GeglNode *filter;
GeglNode *output;
@ -1237,12 +1238,20 @@ gimp_drawable_get_source_node (GimpDrawable *drawable)
drawable->private->source_node = gegl_node_new ();
input = gegl_node_get_input_proxy (drawable->private->source_node, "input");
source = GIMP_DRAWABLE_GET_CLASS (drawable)->get_source_node (drawable);
gegl_node_add_child (drawable->private->source_node, source);
g_object_unref (source);
if (gegl_node_has_pad (source, "input"))
{
gegl_node_connect_to (input, "output",
source, "input");
}
filter = gimp_filter_stack_get_graph (GIMP_FILTER_STACK (drawable->private->filter_stack));
gegl_node_add_child (drawable->private->source_node, filter);

View File

@ -772,12 +772,15 @@ gimp_layer_get_node (GimpFilter *filter)
GimpDrawable *drawable = GIMP_DRAWABLE (filter);
GimpLayer *layer = GIMP_LAYER (filter);
GeglNode *node;
GeglNode *input;
GeglNode *source;
GeglNode *mode_node;
gboolean source_node_hijacked = FALSE;
node = GIMP_FILTER_CLASS (parent_class)->get_node (filter);
input = gegl_node_get_input_proxy (node, "input");
source = gimp_drawable_get_source_node (drawable);
/* if the source node already has a parent, we are a floating
@ -790,6 +793,9 @@ gimp_layer_get_node (GimpFilter *filter)
if (! source_node_hijacked)
gegl_node_add_child (node, source);
gegl_node_connect_to (input, "output",
source, "input");
g_warn_if_fail (layer->layer_offset_node == NULL);
g_warn_if_fail (layer->mask_offset_node == NULL);