[gimp/wip/passthrough: 25/32] app: connect layer backdrop to source node's input



commit 1232e97514e70c833264843e795fd3e2316c2a35
Author: Ell <ell_se yahoo com>
Date:   Fri Apr 21 15:38:57 2017 -0400

    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.

 app/core/gimpdrawable.c |    9 +++++++++
 app/core/gimplayer.c    |    6 ++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 1333081..b40eadc 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1244,6 +1244,7 @@ gimp_drawable_set_buffer_full (GimpDrawable *drawable,
 GeglNode *
 gimp_drawable_get_source_node (GimpDrawable *drawable)
 {
+  GeglNode *input;
   GeglNode *source;
   GeglNode *filter;
   GeglNode *output;
@@ -1255,12 +1256,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);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 4860217..8f00663 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -700,12 +700,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
@@ -718,6 +721,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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]