* All implementation of the #ClutterAnimatable interface must
* implement this function.
*
+ * Return value: %TRUE if the value has been validated and can
+ * be applied to the #ClutterAnimatable, and %FALSE otherwise
+ *
* Since: 1.0
*/
-void
+gboolean
clutter_animatable_animate_property (ClutterAnimatable *animatable,
ClutterAnimation *animation,
const gchar *property_name,
gdouble progress,
GValue *value)
{
- g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
- g_return_if_fail (CLUTTER_IS_ANIMATION (animation));
- g_return_if_fail (property_name != NULL);
- g_return_if_fail (initial_value != NULL && final_value != NULL);
- g_return_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID);
- g_return_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID);
- g_return_if_fail (value != NULL);
- g_return_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) &&
- G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value));
+ gboolean res;
+
+ g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
+ g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), FALSE);
+ g_return_val_if_fail (property_name != NULL, FALSE);
+ g_return_val_if_fail (initial_value != NULL && final_value != NULL, FALSE);
+ g_return_val_if_fail (G_VALUE_TYPE (initial_value) != G_TYPE_INVALID, FALSE);
+ g_return_val_if_fail (G_VALUE_TYPE (final_value) != G_TYPE_INVALID, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+ g_return_val_if_fail (G_VALUE_TYPE (value) == G_VALUE_TYPE (initial_value) &&
+ G_VALUE_TYPE (value) == G_VALUE_TYPE (final_value),
+ FALSE);
+
+ res =
+ CLUTTER_ANIMATABLE_GET_IFACE (animatable)->animate_property (animatable,
+ animation,
+ property_name,
+ initial_value,
+ final_value,
+ progress,
+ value);
- CLUTTER_ANIMATABLE_GET_IFACE (animatable)->animate_property (animatable,
- animation,
- property_name,
- initial_value,
- final_value,
- progress,
- value);
+ return res;
}
GTypeInterface parent_iface;
/*< public >*/
- void (* animate_property) (ClutterAnimatable *animatable,
- ClutterAnimation *animation,
- const gchar *property_name,
- const GValue *initial_value,
- const GValue *final_value,
- gdouble progress,
- GValue *value);
+ gboolean (* animate_property) (ClutterAnimatable *animatable,
+ ClutterAnimation *animation,
+ const gchar *property_name,
+ const GValue *initial_value,
+ const GValue *final_value,
+ gdouble progress,
+ GValue *value);
};
GType clutter_animatable_get_type (void) G_GNUC_CONST;
-void clutter_animatable_animate_property (ClutterAnimatable *animatable,
- ClutterAnimation *animation,
- const gchar *property_name,
- const GValue *initial_value,
- const GValue *final_value,
- gdouble progress,
- GValue *value);
+gboolean clutter_animatable_animate_property (ClutterAnimatable *animatable,
+ ClutterAnimation *animation,
+ const gchar *property_name,
+ const GValue *initial_value,
+ const GValue *final_value,
+ gdouble progress,
+ GValue *value);
G_END_DECLS
const gchar *p_name = p->data;
ClutterInterval *interval;
GValue value = { 0, };
+ gboolean apply;
interval = g_hash_table_lookup (priv->properties, p_name);
g_assert (CLUTTER_IS_INTERVAL (interval));
initial = clutter_interval_peek_initial_value (interval);
final = clutter_interval_peek_final_value (interval);
- clutter_animatable_animate_property (animatable, animation,
- p_name,
- initial, final,
- alpha_value,
- &value);
-
- g_object_set_property (priv->object, p_name, &value);
+ apply = clutter_animatable_animate_property (animatable, animation,
+ p_name,
+ initial, final,
+ alpha_value,
+ &value);
}
else
{
- if (clutter_interval_compute_value (interval, alpha_value, &value))
- g_object_set_property (priv->object, p_name, &value);
+ apply = clutter_interval_compute_value (interval,
+ alpha_value,
+ &value);
}
+ if (apply)
+ g_object_set_property (priv->object, p_name, &value);
+
g_value_unset (&value);
}