summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-18 08:12:40 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-18 08:12:40 +0200
commit6b41544a3955c71ffe6882e9494c48d8f0a59451 (patch)
treefa194c90906cc283c1a6fb48c87d86ed350905e5
parentf124b5e0acc0e06eb1e641902c68efd96cf7281a (diff)
parentfd9b82a082c5122df5dffeda4d2d90adf31e2a42 (diff)
Merge pull request #4319 from kubecz3k/played_signal
animation_started signal for AnimationPlayer
-rw-r--r--scene/animation/animation_player.cpp3
-rw-r--r--scene/scene_string_names.cpp1
-rw-r--r--scene/scene_string_names.h1
3 files changed, 5 insertions, 0 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 32958112e5..25f49a8a8b 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1012,6 +1012,8 @@ void AnimationPlayer::play(const StringName& p_name, float p_custom_blend, float
queued.clear();
_set_process(true); // always process when starting an animation
playing = true;
+
+ emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned);
if (is_inside_tree() && get_tree()->is_editor_hint())
return; // no next in this case
@@ -1347,6 +1349,7 @@ void AnimationPlayer::_bind_methods() {
ADD_SIGNAL( MethodInfo("finished") );
ADD_SIGNAL( MethodInfo("animation_changed", PropertyInfo(Variant::STRING,"old_name"), PropertyInfo(Variant::STRING,"new_name")) );
+ ADD_SIGNAL( MethodInfo("animation_started", PropertyInfo(Variant::STRING,"name")) );
BIND_CONSTANT( ANIMATION_PROCESS_FIXED );
BIND_CONSTANT( ANIMATION_PROCESS_IDLE );
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index f47b61001c..28834c732d 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -52,6 +52,7 @@ SceneStringNames::SceneStringNames() {
finished=StaticCString::create("finished");
animation_changed=StaticCString::create("animation_changed");
+ animation_started=StaticCString::create("animation_started");
mouse_enter=StaticCString::create("mouse_enter");
mouse_exit=StaticCString::create("mouse_exit");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index fc45351c33..f85a858423 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -79,6 +79,7 @@ public:
StringName finished;
StringName animation_changed;
+ StringName animation_started;
StringName body_enter_shape;
StringName body_enter;