clutter/animatable: Add way to get an actor from an animatable
This will be used by ClutterTransition to associate the timeline with an actor, which itself will be used to determine what frame clock should drive the timeline. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
d29c8e290c
commit
d77bcb9028
@ -13589,12 +13589,19 @@ clutter_actor_set_final_state (ClutterAnimatable *animatable,
|
|||||||
g_free (p_name);
|
g_free (p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterActor *
|
||||||
|
clutter_actor_get_actor (ClutterAnimatable *animatable)
|
||||||
|
{
|
||||||
|
return CLUTTER_ACTOR (animatable);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
|
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
|
||||||
{
|
{
|
||||||
iface->find_property = clutter_actor_find_property;
|
iface->find_property = clutter_actor_find_property;
|
||||||
iface->get_initial_state = clutter_actor_get_initial_state;
|
iface->get_initial_state = clutter_actor_get_initial_state;
|
||||||
iface->set_final_state = clutter_actor_set_final_state;
|
iface->set_final_state = clutter_actor_set_final_state;
|
||||||
|
iface->get_actor = clutter_actor_get_actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,3 +194,25 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
|||||||
else
|
else
|
||||||
return clutter_interval_compute_value (interval, progress, value);
|
return clutter_interval_compute_value (interval, progress, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_animatable_get_actor:
|
||||||
|
* @animatable: a #ClutterAnimatable
|
||||||
|
*
|
||||||
|
* Get animated actor.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a #ClutterActor
|
||||||
|
*/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_animatable_get_actor (ClutterAnimatable *animatable)
|
||||||
|
{
|
||||||
|
ClutterAnimatableInterface *iface;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
|
||||||
|
|
||||||
|
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
|
||||||
|
|
||||||
|
g_return_val_if_fail (iface->get_actor, NULL);
|
||||||
|
|
||||||
|
return iface->get_actor (animatable);
|
||||||
|
}
|
||||||
|
@ -50,6 +50,7 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
|||||||
* animatable property
|
* animatable property
|
||||||
* @interpolate_value: virtual function for interpolating the progress
|
* @interpolate_value: virtual function for interpolating the progress
|
||||||
* of a property
|
* of a property
|
||||||
|
* @get_actor: virtual function for getting associated actor
|
||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
@ -72,6 +73,7 @@ struct _ClutterAnimatableInterface
|
|||||||
ClutterInterval *interval,
|
ClutterInterval *interval,
|
||||||
gdouble progress,
|
gdouble progress,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@ -92,6 +94,9 @@ gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
|||||||
gdouble progress,
|
gdouble progress,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user