[gimp/wip/animation: 280/373] plug-ins: fix refreshing cel animations.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/animation: 280/373] plug-ins: fix refreshing cel animations.
- Date: Sat, 7 Oct 2017 02:18:15 +0000 (UTC)
commit 9aa2cdd626e695815114d25314ed592bcc1fb957
Author: Jehan <jehan girinstud io>
Date: Wed Nov 16 02:58:31 2016 +0100
plug-ins: fix refreshing cel animations.
.../animation-play/core/animation-celanimation.c | 60 +++++++++++---------
plug-ins/animation-play/core/animation.c | 6 +-
2 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-celanimation.c
b/plug-ins/animation-play/core/animation-celanimation.c
index 385146b..ee9156a 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -553,38 +553,44 @@ animation_cel_animation_load (Animation *animation)
priv = ANIMATION_CEL_ANIMATION (animation)->priv;
- /* Cleaning. */
- animation_cel_animation_cleanup (ANIMATION_CEL_ANIMATION (animation));
-
- /* Purely arbitrary value. User will anyway change it to suit one's needs. */
- priv->duration = 240;
-
- /* There are at least 2 tracks.
- * Second one is freely-named. */
- track = g_new0 (Track, 1);
- track->title = g_strdup (_("Name me"));
- priv->tracks = g_list_prepend (priv->tracks, track);
- /* The first track is called "Background". */
- track = g_new0 (Track, 1);
- track->title = g_strdup (_("Background"));
- priv->tracks = g_list_prepend (priv->tracks, track);
-
- /* If there is a layer named "Background", set it to all frames
- * on background track. */
- image_id = animation_get_image_id (animation);
- layer = gimp_image_get_layer_by_name (image_id, _("Background"));
- if (layer > 0)
+ /* First load with default values. */
+ if (! priv->tracks)
{
- gint tattoo;
-
- tattoo = gimp_item_get_tattoo (layer);
- for (i = 0; i < priv->duration; i++)
+ /* Purely arbitrary value. User will anyway change it to suit one's needs. */
+ priv->duration = 240;
+
+ /* There are at least 2 tracks.
+ * Second one is freely-named. */
+ track = g_new0 (Track, 1);
+ track->title = g_strdup (_("Name me"));
+ priv->tracks = g_list_prepend (priv->tracks, track);
+ /* The first track is called "Background". */
+ track = g_new0 (Track, 1);
+ track->title = g_strdup (_("Background"));
+ priv->tracks = g_list_prepend (priv->tracks, track);
+
+ /* If there is a layer named "Background", set it to all frames
+ * on background track. */
+ image_id = animation_get_image_id (animation);
+ layer = gimp_image_get_layer_by_name (image_id, _("Background"));
+ if (layer > 0)
{
- track->frames = g_list_prepend (track->frames,
- GINT_TO_POINTER (tattoo));
+ gint tattoo;
+
+ tattoo = gimp_item_get_tattoo (layer);
+ for (i = 0; i < priv->duration; i++)
+ {
+ track->frames = g_list_prepend (track->frames,
+ GINT_TO_POINTER (tattoo));
+ }
}
}
+ /* Invalidate all cache. */
+ g_list_free_full (priv->cache,
+ (GDestroyNotify) animation_cel_animation_clean_cache);
+ priv->cache = NULL;
+
/* Finally cache. */
for (i = 0; i < priv->duration; i++)
{
diff --git a/plug-ins/animation-play/core/animation.c b/plug-ins/animation-play/core/animation.c
index 760f39f..c714be3 100644
--- a/plug-ins/animation-play/core/animation.c
+++ b/plug-ins/animation-play/core/animation.c
@@ -303,9 +303,9 @@ animation_load (Animation *animation)
priv->xml = NULL;
priv->loaded = TRUE;
-
- /* XXX */
- /*g_signal_emit (animation, animation_signals[LOADED], 0);*/
+ g_signal_emit (animation, animation_signals[LOADED], 0);
+ g_signal_emit (animation, animation_signals[CACHE_INVALIDATED], 0,
+ 0, animation_get_duration (animation));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]