[clutter/master-next: 19/51] actor: Make add_transition() work regardless of easing state



commit 5748698f3b76bedfd600a943417504d87da3222c
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 48811b4..35e8167 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -17143,6 +17143,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;
@@ -17201,6 +17202,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);
 
@@ -17258,15 +17264,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,
@@ -17285,9 +17282,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]