[gimp/goat-invasion: 234/526] app: implement "disable layer mask" in the GEGL graph



commit 2e020804e752d182a3a0d1666c730c5418829e29
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 23 14:21:40 2012 +0100

    app: implement "disable layer mask" in the GEGL graph

 app/core/gimplayer.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index ac3e387..4bc256d 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -887,7 +887,7 @@ gimp_layer_get_node (GimpItem *item)
           gegl_node_connect_to (mask,                "output",
                                 layer->opacity_node, "input");
         }
-      else
+      else if (gimp_layer_get_apply_mask (layer))
         {
           gegl_node_connect_to (mask,                "output",
                                 layer->opacity_node, "aux");
@@ -1650,6 +1650,23 @@ gimp_layer_set_apply_mask (GimpLayer *layer,
 
       layer->apply_mask = apply ? TRUE : FALSE;
 
+      if (layer->opacity_node && ! gimp_layer_get_show_mask (layer))
+        {
+          GeglNode *mask;
+
+          mask = gimp_drawable_get_source_node (GIMP_DRAWABLE (layer->mask));
+
+          if (layer->apply_mask)
+            {
+              gegl_node_connect_to (mask,                "output",
+                                    layer->opacity_node, "aux");
+            }
+          else
+            {
+              gegl_node_disconnect (layer->opacity_node, "aux");
+            }
+        }
+
       gimp_drawable_update (GIMP_DRAWABLE (layer),
                             0, 0,
                             gimp_item_get_width  (GIMP_ITEM (layer)),
@@ -1732,8 +1749,12 @@ gimp_layer_set_show_mask (GimpLayer *layer,
 
               gegl_node_connect_to (source,              "output",
                                     layer->opacity_node, "input");
-              gegl_node_connect_to (mask,                "output",
-                                    layer->opacity_node, "aux");
+
+              if (gimp_layer_get_apply_mask (layer))
+                {
+                  gegl_node_connect_to (mask,                "output",
+                                        layer->opacity_node, "aux");
+                }
             }
         }
 



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