From fa3728126fe39e7a885184a2b69a93ac2ea34aa8 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 28 Jul 2009 11:25:11 +0100 Subject: [PATCH] [animation] Force the final state inside ::completed In case we are skipping too many frames, we should force the animation instance to apply the final state of the animated interval inside the ::completed signal handler. --- clutter/clutter-animation.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-animation.c b/clutter/clutter-animation.c index 979842496..c26c77c07 100644 --- a/clutter/clutter-animation.c +++ b/clutter/clutter-animation.c @@ -132,12 +132,28 @@ clutter_animation_real_completed (ClutterAnimation *self) { ClutterAnimationPrivate *priv = self->priv; ClutterAnimation *animation; + gpointer key, value; + GHashTableIter iter; + + /* explicitly set the final state of the animation */ + g_hash_table_iter_init (&iter, priv->properties); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + const gchar *p_name = key; + ClutterInterval *interval = value; + GValue *p_value; + + value = clutter_interval_peek_final_value (interval); + g_object_set_property (priv->object, p_name, value); + } /* at this point, if this animation was created by clutter_actor_animate() * and friends, the animation will be attached to the object's data; since * we want to allow developers to use g_signal_connect_after("completed") * to concatenate a new animation, we need to remove the animation back - * pointer here, and unref() the animation + * pointer here, and unref() the animation. FIXME - we might want to + * provide a clutter_animation_attach()/clutter_animation_detach() pair + * to let the user reattach an animation */ animation = g_object_get_qdata (priv->object, quark_object_animation); if (animation == self)