state: fix clutter_state_change (state, "state-name", FALSE)
Properties were not being updated correctly.
This commit is contained in:
parent
380e7b8b5d
commit
49a4c62319
@ -449,9 +449,10 @@ clutter_state_change (ClutterState *state,
|
|||||||
gboolean animate)
|
gboolean animate)
|
||||||
{
|
{
|
||||||
ClutterStatePrivate *priv;
|
ClutterStatePrivate *priv;
|
||||||
ClutterAnimator *animator;
|
ClutterAnimator *animator;
|
||||||
State *new_state;
|
State *new_state;
|
||||||
GList *k;
|
guint duration;
|
||||||
|
GList *k;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
|
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
|
||||||
g_return_val_if_fail (target_state_name != NULL, NULL);
|
g_return_val_if_fail (target_state_name != NULL, NULL);
|
||||||
@ -483,17 +484,10 @@ clutter_state_change (ClutterState *state,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (state), "target-state");
|
g_object_notify (G_OBJECT (state), "target-state");
|
||||||
|
|
||||||
if (animate)
|
duration = clutter_state_get_duration (state,
|
||||||
{
|
priv->source_state_name,
|
||||||
guint duration;
|
priv->target_state_name);
|
||||||
|
clutter_timeline_set_duration (priv->timeline, duration);
|
||||||
duration = clutter_state_get_duration (state,
|
|
||||||
priv->source_state_name,
|
|
||||||
priv->target_state_name);
|
|
||||||
clutter_timeline_set_duration (priv->timeline, duration);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
clutter_timeline_set_duration (priv->timeline, 1);
|
|
||||||
|
|
||||||
new_state = g_hash_table_lookup (priv->states, target_state_name);
|
new_state = g_hash_table_lookup (priv->states, target_state_name);
|
||||||
if (new_state == NULL)
|
if (new_state == NULL)
|
||||||
@ -506,39 +500,52 @@ clutter_state_change (ClutterState *state,
|
|||||||
animator = clutter_state_get_animator (state,
|
animator = clutter_state_get_animator (state,
|
||||||
priv->source_state_name,
|
priv->source_state_name,
|
||||||
priv->target_state_name);
|
priv->target_state_name);
|
||||||
|
priv->target_state = new_state;
|
||||||
|
|
||||||
if (animator != NULL)
|
if (animator != NULL)
|
||||||
{
|
{ /* we've got an animator overriding the tweened animation */
|
||||||
priv->current_animator = animator;
|
priv->current_animator = animator;
|
||||||
clutter_animator_set_timeline (animator, priv->timeline);
|
clutter_animator_set_timeline (animator, priv->timeline);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (k = new_state->keys; k != NULL; k = k->next)
|
||||||
|
{
|
||||||
|
ClutterStateKey *key = k->data;
|
||||||
|
GValue initial = { 0, };
|
||||||
|
|
||||||
|
g_value_init (&initial, clutter_interval_get_value_type (
|
||||||
|
key->interval));
|
||||||
|
g_object_get_property (key->object, key->property_name, &initial);
|
||||||
|
|
||||||
|
if (clutter_alpha_get_mode (key->alpha) != key->mode)
|
||||||
|
clutter_alpha_set_mode (key->alpha, key->mode);
|
||||||
|
|
||||||
|
clutter_interval_set_initial_value (key->interval, &initial);
|
||||||
|
clutter_interval_set_final_value (key->interval, &key->value);
|
||||||
|
|
||||||
|
g_value_unset (&initial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!animate)
|
||||||
|
{
|
||||||
|
clutter_timeline_stop (priv->timeline);
|
||||||
|
clutter_timeline_advance (priv->timeline, duration);
|
||||||
|
|
||||||
|
/* emit signals, to change properties, and indicate that the
|
||||||
|
* state change is complete */
|
||||||
|
g_signal_emit_by_name (priv->timeline, "new-frame",
|
||||||
|
GINT_TO_POINTER(duration), NULL);
|
||||||
|
g_signal_emit_by_name (priv->timeline, "completed", NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
clutter_timeline_stop (priv->timeline);
|
clutter_timeline_stop (priv->timeline);
|
||||||
clutter_timeline_rewind (priv->timeline);
|
clutter_timeline_rewind (priv->timeline);
|
||||||
clutter_timeline_start (priv->timeline);
|
clutter_timeline_start (priv->timeline);
|
||||||
|
|
||||||
return priv->timeline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (k = new_state->keys; k != NULL; k = k->next)
|
|
||||||
{
|
|
||||||
ClutterStateKey *key = k->data;
|
|
||||||
GValue initial = { 0, };
|
|
||||||
|
|
||||||
g_value_init (&initial, clutter_interval_get_value_type (key->interval));
|
|
||||||
g_object_get_property (key->object, key->property_name, &initial);
|
|
||||||
|
|
||||||
if (clutter_alpha_get_mode (key->alpha) != key->mode)
|
|
||||||
clutter_alpha_set_mode (key->alpha, key->mode);
|
|
||||||
|
|
||||||
clutter_interval_set_initial_value (key->interval, &initial);
|
|
||||||
clutter_interval_set_final_value (key->interval, &key->value);
|
|
||||||
|
|
||||||
g_value_unset (&initial);
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->target_state = new_state;
|
|
||||||
clutter_timeline_rewind (priv->timeline);
|
|
||||||
clutter_timeline_start (priv->timeline);
|
|
||||||
|
|
||||||
return priv->timeline;
|
return priv->timeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user