[gimp/wip/animation: 128/197] plug-ins: add red color tags to the displayed layers of current frame.



commit a65bb3884bb252294f6898fee1b551c67dff520e
Author: Jehan <jehan girinstud io>
Date:   Fri Feb 10 15:33:20 2017 +0100

    plug-ins: add red color tags to the displayed layers of current frame.

 plug-ins/animation-play/animation-utils.c          |   17 ++++++++++++-----
 plug-ins/animation-play/animation-utils.h          |    6 ++++--
 .../animation-play/core/animation-celanimation.c   |    4 ++--
 3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/plug-ins/animation-play/animation-utils.c b/plug-ins/animation-play/animation-utils.c
index b04d411..1f57729 100755
--- a/plug-ins/animation-play/animation-utils.c
+++ b/plug-ins/animation-play/animation-utils.c
@@ -278,9 +278,12 @@ show_scrolled_child (GtkScrolledWindow *window,
 
 void
 hide_item (gint     item,
-           gboolean recursive)
+           gboolean recursive,
+           gboolean reset_tag)
 {
   gimp_item_set_visible (item, FALSE);
+  if (reset_tag)
+    gimp_item_set_color_tag (item, GIMP_COLOR_TAG_NONE);
 
   if (recursive && gimp_item_is_group (item))
     {
@@ -292,19 +295,23 @@ hide_item (gint     item,
 
       for (i = 0; i < n_children; i++)
         {
-          hide_item (children[i], TRUE);
+          hide_item (children[i], TRUE, reset_tag);
         }
     }
 }
 
 void
-show_item (gint item)
+show_item (gint   item,
+           gint32 color_tag)
 {
   gint32 parent;
 
   gimp_item_set_visible (item, TRUE);
-  parent = gimp_item_get_parent (item);
+  if (color_tag >= 0)
+    gimp_item_set_color_tag (item, color_tag);
 
+  /* Show the parent as well, but do not update its color tag. */
+  parent = gimp_item_get_parent (item);
   if (parent > 0)
-    show_item (parent);
+    show_item (parent, -1);
 }
diff --git a/plug-ins/animation-play/animation-utils.h b/plug-ins/animation-play/animation-utils.h
index d77cd9b..590fbdf 100755
--- a/plug-ins/animation-play/animation-utils.h
+++ b/plug-ins/animation-play/animation-utils.h
@@ -49,8 +49,10 @@ void         show_scrolled_child (GtkScrolledWindow *window,
                                   GtkWidget         *child);
 
 void         hide_item           (gint               item,
-                                  gboolean           recursive);
-void         show_item           (gint               item);
+                                  gboolean           recursive,
+                                  gboolean           reset_color_tag);
+void         show_item           (gint               item,
+                                  gint32             color_tag);
 
 #endif  /*  __ANIMATION_UTILS_H__  */
 
diff --git a/plug-ins/animation-play/core/animation-celanimation.c 
b/plug-ins/animation-play/core/animation-celanimation.c
index 7603aca..5ec24e6 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -979,7 +979,7 @@ animation_cel_animation_update_paint_view (Animation *animation,
   layers = gimp_image_get_layers (image_id, &num_layers);
   for (i = 0; i < num_layers; i++)
     {
-      hide_item (layers[i], TRUE);
+      hide_item (layers[i], TRUE, TRUE);
     }
 
   /* Show layers */
@@ -998,7 +998,7 @@ animation_cel_animation_update_paint_view (Animation *animation,
 
           layer = gimp_image_get_layer_by_tattoo (image_id, tattoo);
 
-          show_item (layer);
+          show_item (layer, GIMP_COLOR_TAG_RED);
         }
     }
 }


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