[clutter] actor: Make add_transition() work regardless of easing state



commit 865a682450d2222ae605e28b161313d29591f0dd
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Wed Apr 11 14:10:40 2012 +0100

    actor: Make add_transition() work regardless of easing state
    
    We can add transitions to an actor even if the easing state hasn't been
    set beforehand.

 clutter/clutter-actor.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 13ac124..158668f 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -17151,6 +17151,7 @@ _clutter_actor_create_transition (ClutterActor *actor,
   clos = g_hash_table_lookup (info->transitions, pspec->name);
   if (clos == NULL)
     {
+      ClutterTimeline *timeline;
       ClutterInterval *interval;
       GValue initial = G_VALUE_INIT;
       GValue final = G_VALUE_INIT;
@@ -17209,6 +17210,11 @@ _clutter_actor_create_transition (ClutterActor *actor,
       clutter_transition_set_interval (res, interval);
       clutter_transition_set_remove_on_complete (res, TRUE);
 
+      timeline = CLUTTER_TIMELINE (res);
+      clutter_timeline_set_delay (timeline, info->cur_state->easing_delay);
+      clutter_timeline_set_duration (timeline, info->cur_state->easing_duration);
+      clutter_timeline_set_progress_mode (timeline, info->cur_state->easing_mode);
+
       /* this will start the transition as well */
       clutter_actor_add_transition (actor, pspec->name, res);
 
@@ -17266,15 +17272,6 @@ clutter_actor_add_transition (ClutterActor      *self,
 
   info = _clutter_actor_get_animation_info (self);
 
-  if (info->cur_state == NULL)
-    {
-      g_warning ("No easing state is defined for the actor '%s'; you "
-                 "must call clutter_actor_save_easing_state() before "
-                 "calling clutter_actor_add_transition().",
-                 _clutter_actor_get_debug_name (self));
-      return;
-    }
-
   if (info->transitions == NULL)
     info->transitions = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                NULL,
@@ -17293,9 +17290,12 @@ clutter_actor_add_transition (ClutterActor      *self,
 
   timeline = CLUTTER_TIMELINE (transition);
 
-  clutter_timeline_set_delay (timeline, info->cur_state->easing_delay);
-  clutter_timeline_set_duration (timeline, info->cur_state->easing_duration);
-  clutter_timeline_set_progress_mode (timeline, info->cur_state->easing_mode);
+  if (info->cur_state != NULL)
+    {
+      clutter_timeline_set_delay (timeline, info->cur_state->easing_delay);
+      clutter_timeline_set_duration (timeline, info->cur_state->easing_duration);
+      clutter_timeline_set_progress_mode (timeline, info->cur_state->easing_mode);
+    }
 
   clos = g_slice_new (TransitionClosure);
   clos->actor = self;



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