mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter: Remove the rest of deprecated/clutter-animator.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
This commit is contained in:
parent
7f3fda6df6
commit
39e9e53871
@ -7,7 +7,6 @@
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
#include "deprecated/clutter-animator.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
#include "deprecated/clutter-behaviour-ellipse.h"
|
||||
|
@ -90,7 +90,6 @@ typedef struct _ClutterVertex ClutterVertex;
|
||||
|
||||
typedef struct _ClutterAlpha ClutterAlpha;
|
||||
typedef struct _ClutterAnimation ClutterAnimation;
|
||||
typedef struct _ClutterAnimator ClutterAnimator;
|
||||
typedef struct _ClutterState ClutterState;
|
||||
|
||||
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Øyvind Kolås <pippin@linux.intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_ANIMATOR_H__
|
||||
#define __CLUTTER_ANIMATOR_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-timeline.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ANIMATOR (clutter_animator_get_type ())
|
||||
#define CLUTTER_TYPE_ANIMATOR_KEY (clutter_animator_key_get_type ())
|
||||
|
||||
#define CLUTTER_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimator))
|
||||
#define CLUTTER_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
|
||||
#define CLUTTER_IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATOR))
|
||||
#define CLUTTER_IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATOR))
|
||||
#define CLUTTER_ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
|
||||
|
||||
/* ClutterAnimator is typedef in clutter-types.h */
|
||||
|
||||
typedef struct _ClutterAnimatorClass ClutterAnimatorClass;
|
||||
typedef struct _ClutterAnimatorPrivate ClutterAnimatorPrivate;
|
||||
|
||||
/**
|
||||
* ClutterAnimatorKey:
|
||||
*
|
||||
* A key frame inside a #ClutterAnimator
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
typedef struct _ClutterAnimatorKey ClutterAnimatorKey;
|
||||
|
||||
/**
|
||||
* ClutterAnimator:
|
||||
*
|
||||
* The #ClutterAnimator structure contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
struct _ClutterAnimator
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterAnimatorPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterAnimatorClass:
|
||||
*
|
||||
* The #ClutterAnimatorClass structure contains only private data
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
struct _ClutterAnimatorClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_animator_new (void);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_animator_set_key (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
guint mode,
|
||||
gdouble progress,
|
||||
const GValue *value);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set (ClutterAnimator *animator,
|
||||
gpointer first_object,
|
||||
const gchar *first_property_name,
|
||||
guint first_mode,
|
||||
gdouble first_progress,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_DEPRECATED
|
||||
GList * clutter_animator_get_keys (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_remove_key (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_animator_start (ClutterAnimator *animator);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_compute_value (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_animator_get_timeline (ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set_timeline (ClutterAnimator *animator,
|
||||
ClutterTimeline *timeline);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_animator_get_duration (ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set_duration (ClutterAnimator *animator,
|
||||
guint duration);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_property_get_ease_in (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_property_set_ease_in (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gboolean ease_in);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_property_set_interpolation (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
ClutterInterpolation interpolation);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_key_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_DEPRECATED
|
||||
GObject * clutter_animator_key_get_object (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_animator_key_get_property_name (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_key_get_property_type (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_animator_key_get_mode (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_animator_key_get_progress (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_key_get_value (const ClutterAnimatorKey *key,
|
||||
GValue *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATOR_H__ */
|
@ -131,7 +131,6 @@
|
||||
* "source" : "source-state",
|
||||
* "target" : "target-state",
|
||||
* "duration" : milliseconds,
|
||||
* "animator" : "animator-definition"
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
@ -142,7 +141,7 @@
|
||||
* as clutter_state_set_key() function arguments.
|
||||
*
|
||||
* The source and target values control the source and target state of the
|
||||
* transition. The key and animator properties are mutually exclusive.
|
||||
* transition.
|
||||
*
|
||||
* The pre-delay and post-delay values are optional.
|
||||
*
|
||||
@ -189,7 +188,6 @@
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-animator.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-interval.h"
|
||||
#include "clutter-marshal.h"
|
||||
@ -197,11 +195,6 @@
|
||||
#include "clutter-scriptable.h"
|
||||
#include "clutter-script-private.h"
|
||||
|
||||
typedef struct StateAnimator {
|
||||
const gchar *source_state_name; /* interned string identifying entry */
|
||||
ClutterAnimator *animator; /* pointer to animator itself */
|
||||
} StateAnimator;
|
||||
|
||||
typedef struct State
|
||||
{
|
||||
const gchar *name; /* interned string for this state name */
|
||||
@ -209,8 +202,6 @@ typedef struct State
|
||||
names */
|
||||
GList *keys; /* list of all keys pertaining to transitions
|
||||
from other states to this one */
|
||||
GArray *animators; /* list of animators for transitioning from
|
||||
* specific source states */
|
||||
ClutterState *clutter_state; /* the ClutterState object this state belongs to
|
||||
*/
|
||||
} State;
|
||||
@ -227,8 +218,6 @@ struct _ClutterStatePrivate
|
||||
State *source_state; /* current source_state */
|
||||
const gchar *target_state_name; /* current target state */
|
||||
State *target_state; /* target state name */
|
||||
ClutterAnimator *current_animator; /* !NULL if the current transition is
|
||||
overriden by an animator */
|
||||
};
|
||||
|
||||
#define SLAVE_TIMELINE_LENGTH 10000
|
||||
@ -496,7 +485,6 @@ state_free (gpointer data)
|
||||
state->keys = g_list_remove (state->keys, state->keys->data))
|
||||
clutter_state_key_free (state->keys->data);
|
||||
|
||||
g_array_free (state->animators, TRUE);
|
||||
g_hash_table_destroy (state->durations);
|
||||
g_free (state);
|
||||
}
|
||||
@ -510,7 +498,6 @@ state_new (ClutterState *clutter_state,
|
||||
state = g_new0 (State, 1);
|
||||
state->clutter_state = clutter_state;
|
||||
state->name = name;
|
||||
state->animators = g_array_new (TRUE, TRUE, sizeof (StateAnimator));
|
||||
state->durations = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
return state;
|
||||
@ -533,14 +520,6 @@ static void
|
||||
clutter_state_completed (ClutterTimeline *timeline,
|
||||
ClutterState *state)
|
||||
{
|
||||
ClutterStatePrivate *priv = state->priv;
|
||||
|
||||
if (priv->current_animator)
|
||||
{
|
||||
clutter_animator_set_timeline (priv->current_animator, NULL);
|
||||
priv->current_animator = NULL;
|
||||
}
|
||||
|
||||
g_signal_emit (state, state_signals[COMPLETED], 0);
|
||||
}
|
||||
|
||||
@ -556,9 +535,6 @@ clutter_state_new_frame (ClutterTimeline *timeline,
|
||||
GObject *curobj = NULL;
|
||||
gboolean found_specific = FALSE;
|
||||
|
||||
if (priv->current_animator)
|
||||
return;
|
||||
|
||||
progress = clutter_timeline_get_progress (timeline);
|
||||
|
||||
for (k = priv->target_state->keys; k; k = k->next)
|
||||
@ -672,12 +648,6 @@ clutter_state_change (ClutterState *state,
|
||||
clutter_timeline_stop (priv->timeline);
|
||||
clutter_timeline_rewind (priv->timeline);
|
||||
|
||||
if (priv->current_animator)
|
||||
{
|
||||
clutter_animator_set_timeline (priv->current_animator, NULL);
|
||||
priv->current_animator = NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -693,12 +663,6 @@ clutter_state_change (ClutterState *state,
|
||||
return priv->timeline;
|
||||
}
|
||||
|
||||
if (priv->current_animator != NULL)
|
||||
{
|
||||
clutter_animator_set_timeline (priv->current_animator, NULL);
|
||||
priv->current_animator = NULL;
|
||||
}
|
||||
|
||||
priv->source_state_name = priv->target_state_name;
|
||||
priv->target_state_name = target_state_name;
|
||||
|
||||
@ -1530,126 +1494,6 @@ clutter_state_init (ClutterState *self)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clutter_state_get_animator:
|
||||
* @state: a #ClutterState instance.
|
||||
* @source_state_name: the name of a source state
|
||||
* @target_state_name: the name of a target state
|
||||
*
|
||||
* Retrieves the #ClutterAnimator that is being used for transitioning
|
||||
* between the two states, if any has been set
|
||||
*
|
||||
* Return value: (transfer none): a #ClutterAnimator instance, or %NULL
|
||||
*
|
||||
* Since: 1.4
|
||||
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
|
||||
* #ClutterTransitionGroup instead
|
||||
*/
|
||||
ClutterAnimator *
|
||||
clutter_state_get_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name)
|
||||
{
|
||||
State *target_state;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_STATE (state), NULL);
|
||||
|
||||
source_state_name = g_intern_string (source_state_name);
|
||||
if (source_state_name == g_intern_static_string (""))
|
||||
source_state_name = NULL;
|
||||
|
||||
target_state_name = g_intern_string (target_state_name);
|
||||
|
||||
target_state = clutter_state_fetch_state (state, target_state_name, FALSE);
|
||||
if (target_state == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < target_state->animators->len; i++)
|
||||
{
|
||||
const StateAnimator *animator;
|
||||
|
||||
animator = &g_array_index (target_state->animators, StateAnimator, i);
|
||||
if (animator->source_state_name == source_state_name)
|
||||
return animator->animator;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_state_set_animator:
|
||||
* @state: a #ClutterState instance.
|
||||
* @source_state_name: the name of a source state
|
||||
* @target_state_name: the name of a target state
|
||||
* @animator: (allow-none): a #ClutterAnimator instance, or %NULL to
|
||||
* unset an existing #ClutterAnimator
|
||||
*
|
||||
* Specifies a #ClutterAnimator to be used when transitioning between
|
||||
* the two named states.
|
||||
*
|
||||
* The @animator allows specifying a transition between the state that is
|
||||
* more elaborate than the basic transitions allowed by the tweening of
|
||||
* properties defined in the #ClutterState keys.
|
||||
*
|
||||
* If @animator is %NULL it will unset an existing animator.
|
||||
*
|
||||
* #ClutterState will take a reference on the passed @animator, if any
|
||||
*
|
||||
* Since: 1.4
|
||||
* Deprecated: 1.12: Use #ClutterKeyframeTransition and
|
||||
* #ClutterTransitionGroup instead
|
||||
*/
|
||||
void
|
||||
clutter_state_set_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
ClutterAnimator *animator)
|
||||
{
|
||||
State *target_state;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_STATE (state));
|
||||
|
||||
source_state_name = g_intern_string (source_state_name);
|
||||
target_state_name = g_intern_string (target_state_name);
|
||||
|
||||
target_state = clutter_state_fetch_state (state, target_state_name, TRUE);
|
||||
if (target_state == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; target_state->animators->len; i++)
|
||||
{
|
||||
StateAnimator *a;
|
||||
|
||||
a = &g_array_index (target_state->animators, StateAnimator, i);
|
||||
if (a->source_state_name == source_state_name)
|
||||
{
|
||||
g_object_unref (a->animator);
|
||||
|
||||
if (animator != NULL)
|
||||
a->animator = g_object_ref (animator);
|
||||
else
|
||||
{
|
||||
/* remove the matched animator if passed NULL */
|
||||
g_array_remove_index (target_state->animators, i);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (animator != NULL)
|
||||
{
|
||||
StateAnimator state_animator = {
|
||||
source_state_name,
|
||||
g_object_ref (animator)
|
||||
};
|
||||
|
||||
g_array_append_val (target_state->animators, state_animator);
|
||||
}
|
||||
}
|
||||
|
||||
static gpointer
|
||||
clutter_state_key_copy (gpointer boxed)
|
||||
{
|
||||
@ -2088,12 +1932,10 @@ parse_state_transition (JsonArray *array,
|
||||
|
||||
if (!json_object_has_member (object, "source") ||
|
||||
!json_object_has_member (object, "target") ||
|
||||
!(json_object_has_member (object, "keys") ||
|
||||
json_object_has_member (object, "animator")))
|
||||
!(json_object_has_member (object, "keys")))
|
||||
{
|
||||
g_warning ("The transition description at index %d is missing one "
|
||||
"of the mandatory members: source, target and keys or "
|
||||
"animator", index_);
|
||||
"of the mandatory members: source, target and keys", index_);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2112,29 +1954,11 @@ parse_state_transition (JsonArray *array,
|
||||
duration);
|
||||
}
|
||||
|
||||
if (json_object_has_member (object, "animator"))
|
||||
{
|
||||
const gchar *id_ = json_object_get_string_member (object, "animator");
|
||||
GObject *animator;
|
||||
|
||||
animator = clutter_script_get_object (clos->script, id_);
|
||||
if (animator == NULL)
|
||||
{
|
||||
g_warning ("No object with id '%s' has been defined.", id_);
|
||||
return;
|
||||
}
|
||||
|
||||
clutter_state_set_animator (clos->state,
|
||||
source_name,
|
||||
target_name,
|
||||
CLUTTER_ANIMATOR (animator));
|
||||
}
|
||||
|
||||
if (!json_object_has_member (object, "keys"))
|
||||
return;
|
||||
|
||||
keys = json_object_get_array_member (object, "keys");
|
||||
if (keys == NULL && !json_object_has_member (object, "animator"))
|
||||
if (keys == NULL)
|
||||
{
|
||||
g_warning ("The transition description at index %d has an invalid "
|
||||
"key member of type '%s' when an array was expected.",
|
||||
|
@ -145,15 +145,6 @@ void clutter_state_remove_key (ClutterState *state,
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_state_set_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_state_get_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_state_get_state (ClutterState *state);
|
||||
|
||||
/*
|
||||
|
@ -220,7 +220,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-alpha.h',
|
||||
'deprecated/clutter-animatable.h',
|
||||
'deprecated/clutter-animation.h',
|
||||
'deprecated/clutter-animator.h',
|
||||
'deprecated/clutter-behaviour.h',
|
||||
'deprecated/clutter-behaviour-depth.h',
|
||||
'deprecated/clutter-behaviour-ellipse.h',
|
||||
@ -252,7 +251,6 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-actor-deprecated.c',
|
||||
'deprecated/clutter-alpha.c',
|
||||
'deprecated/clutter-animation.c',
|
||||
'deprecated/clutter-animator.c',
|
||||
'deprecated/clutter-behaviour.c',
|
||||
'deprecated/clutter-behaviour-depth.c',
|
||||
'deprecated/clutter-behaviour-ellipse.c',
|
||||
|
@ -1,199 +0,0 @@
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static void
|
||||
animator_multi_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL, *foo = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
GList *keys;
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-3.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
foo = clutter_script_get_object (script, "foo");
|
||||
g_assert (G_IS_OBJECT (foo));
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
/* get all the keys for foo:x */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
foo, "x",
|
||||
-1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 1);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("(foo, x).keys[1] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
|
||||
/* get all the keys for foo:y */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
foo, "y",
|
||||
-1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 2);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("(foo, y).keys[2] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.8);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "y");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 200.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
static void
|
||||
animator_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
GList *keys;
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-2.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
/* get all the keys */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
NULL, NULL, -1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 1);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("keys[1] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
static void
|
||||
animator_base (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
GError *error = NULL;
|
||||
guint duration = 0;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-1.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
duration = clutter_animator_get_duration (CLUTTER_ANIMATOR (animator));
|
||||
g_assert_cmpint (duration, ==, 1000);
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/script/animator/base", animator_base)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/properties", animator_properties)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/multi-properties", animator_multi_properties)
|
||||
)
|
@ -40,7 +40,6 @@ clutter_conform_tests_general_tests = [
|
||||
]
|
||||
|
||||
clutter_conform_tests_deprecated_tests = [
|
||||
'animator',
|
||||
'behaviours',
|
||||
'group',
|
||||
'rectangle',
|
||||
|
@ -27,7 +27,6 @@ clutter_tests_interactive_test_sources = [
|
||||
'test-script.c',
|
||||
'test-grab.c',
|
||||
'test-cogl-shader-glsl.c',
|
||||
'test-animator.c',
|
||||
'test-state.c',
|
||||
'test-fbo.c',
|
||||
'test-multistage.c',
|
||||
|
@ -1,142 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static ClutterAnimator *animator;
|
||||
|
||||
gint
|
||||
test_animator_main (gint argc,
|
||||
gchar **argv);
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *rectangle;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
rectangle = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
|
||||
clutter_actor_set_size (rectangle, 128, 128);
|
||||
clutter_color_free (color);
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
static gboolean nuke_one (gpointer actor)
|
||||
{
|
||||
clutter_actor_destroy (actor);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define COUNT 4
|
||||
|
||||
static void reverse_timeline (ClutterTimeline *timeline,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterTimelineDirection direction = clutter_timeline_get_direction (timeline);
|
||||
if (direction == CLUTTER_TIMELINE_FORWARD)
|
||||
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD);
|
||||
else
|
||||
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_FORWARD);
|
||||
clutter_timeline_start (timeline);
|
||||
}
|
||||
|
||||
|
||||
G_MODULE_EXPORT gint
|
||||
test_animator_main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *rects[COUNT];
|
||||
gint i;
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Animator");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i = 0; i < COUNT; i++)
|
||||
{
|
||||
rects[i] = new_rect (255 * (i * 1.0 / COUNT), 50, 160, 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
|
||||
clutter_actor_set_anchor_point (rects[i], 64, 64);
|
||||
clutter_actor_set_position (rects[i], 320.0, 240.0);
|
||||
clutter_actor_set_opacity (rects[i], 0x70);
|
||||
}
|
||||
|
||||
clutter_threads_add_timeout (10000, nuke_one, rects[2]);
|
||||
|
||||
animator = clutter_animator_new ();
|
||||
|
||||
/* Note: when both animations are active for the same actor at the same
|
||||
* time there is a race, such races should be handled by avoiding
|
||||
* controlling the same properties from multiple animations. This is
|
||||
* an intentional design flaw of this test for testing the corner case.
|
||||
*/
|
||||
|
||||
clutter_animator_set (animator,
|
||||
rects[0], "x", 1, 0.0, 180.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.25, 450.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.5, 450.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.75, 180.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 1.0, 180.0,
|
||||
|
||||
rects[0], "y", -1, 0.0, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.25, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.5, 380.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.75, 380.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 1.0, 100.0,
|
||||
|
||||
rects[3], "x", 0, 0.0, 180.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.25, 180.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.5, 450.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.75, 450.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 1.0, 180.0,
|
||||
|
||||
rects[3], "y", 0, 0.0, 100.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.25, 380.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.5, 380.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.75, 100.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 1.0, 100.0,
|
||||
|
||||
|
||||
rects[2], "rotation-angle-y", 0, 0.0, 0.0,
|
||||
rects[2], "rotation-angle-y", CLUTTER_LINEAR, 1.0, 360.0,
|
||||
|
||||
rects[1], "scale-x", 0, 0.0, 1.0,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
rects[1], "scale-y", 0, 0.0, 1.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
NULL);
|
||||
|
||||
|
||||
clutter_actor_set_scale (rects[0], 1.4, 1.4);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "x",
|
||||
TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "y",
|
||||
TRUE);
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
|
||||
"x", CLUTTER_INTERPOLATION_CUBIC);
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
|
||||
"y", CLUTTER_INTERPOLATION_CUBIC);
|
||||
|
||||
clutter_stage_hide_cursor(CLUTTER_STAGE (stage));
|
||||
clutter_actor_show (stage);
|
||||
clutter_animator_set_duration (animator, 5000);
|
||||
|
||||
g_signal_connect (clutter_animator_start (animator),
|
||||
"completed", G_CALLBACK (reverse_timeline), NULL);
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (animator);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -57,7 +57,6 @@ clutter/clutter/clutter-virtual-input-device.c
|
||||
clutter/clutter/clutter-zoom-action.c
|
||||
clutter/clutter/deprecated/clutter-alpha.c
|
||||
clutter/clutter/deprecated/clutter-animation.c
|
||||
clutter/clutter/deprecated/clutter-animator.c
|
||||
clutter/clutter/deprecated/clutter-behaviour.c
|
||||
clutter/clutter/deprecated/clutter-behaviour-depth.c
|
||||
clutter/clutter/deprecated/clutter-behaviour-ellipse.c
|
||||
|
Loading…
Reference in New Issue
Block a user