[gimp/wip/animation: 191/197] plug-ins: cels were not properly updating when adding/deleting.



commit 50ab0e1bdef840cbd7132512ed96e788bf5530e3
Author: Jehan <jehan girinstud io>
Date:   Thu Aug 17 21:49:35 2017 +0200

    plug-ins: cels were not properly updating when adding/deleting.

 .../animation-play/core/animation-celanimation.c   |    1 -
 plug-ins/animation-play/widgets/animation-xsheet.c |   25 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-celanimation.c 
b/plug-ins/animation-play/core/animation-celanimation.c
index 1439fee..9c2ae7c 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -599,7 +599,6 @@ animation_cel_animation_cel_add (AnimationCelAnimation *animation,
         {
           GList *prev_cell;
 
-          i++;
           prev_cell = g_list_nth (track->frames, position - 1);
 
           if (prev_cell)
diff --git a/plug-ins/animation-play/widgets/animation-xsheet.c 
b/plug-ins/animation-play/widgets/animation-xsheet.c
index ed54b5b..1420556 100755
--- a/plug-ins/animation-play/widgets/animation-xsheet.c
+++ b/plug-ins/animation-play/widgets/animation-xsheet.c
@@ -149,6 +149,10 @@ static void     on_animation_loaded            (Animation         *animation,
 static void     on_animation_duration_changed  (Animation         *animation,
                                                 gint               duration,
                                                 AnimationXSheet   *xsheet);
+static void     on_animation_frames_changed    (Animation         *animation,
+                                                gint               position,
+                                                gint               length,
+                                                AnimationXSheet   *xsheet);
 /* Callbacks on camera. */
 static void     on_camera_keyframe_set         (AnimationCamera   *camera,
                                                 gint               position,
@@ -369,6 +373,10 @@ animation_xsheet_constructed (GObject *object)
                           "duration-changed",
                           G_CALLBACK (on_animation_duration_changed),
                           xsheet);
+  g_signal_connect_after (xsheet->priv->animation,
+                          "frames-changed",
+                          G_CALLBACK (on_animation_frames_changed),
+                          xsheet);
 }
 
 static void
@@ -1263,6 +1271,23 @@ on_animation_duration_changed (Animation       *animation,
 }
 
 static void
+on_animation_frames_changed (Animation       *animation,
+                             gint             position,
+                             gint             length,
+                             AnimationXSheet *xsheet)
+{
+  GList *track;
+
+  for (track = xsheet->priv->cels; track; track = track->next)
+    {
+      GtkWidget *cel;
+
+      cel = g_list_nth_data (track->data, position);
+      animation_xsheet_rename_cel (xsheet, cel, TRUE, position + length);
+    }
+}
+
+static void
 on_camera_keyframe_set (AnimationCamera *camera,
                         gint             position,
                         AnimationXSheet *xsheet)


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