From 1b0930c435b3aa4a3ab41b4936b9ceaa2f1da775 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 8 Jan 2017 17:35:11 -0300 Subject: [PATCH] Renamed finished to animation_finished, also passes the animation name when finished --- scene/2d/animated_sprite.cpp | 4 ++-- scene/animation/animation_player.cpp | 4 ++-- scene/scene_string_names.cpp | 1 + scene/scene_string_names.h | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index f9f6525686d..97c23f3a461 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -363,7 +363,7 @@ void AnimatedSprite::_notification(int p_what) { } else { frame++; if (frame==fc-1) { - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringNames::get_singleton()->animation_finished); } } @@ -685,7 +685,7 @@ void AnimatedSprite::_bind_methods() { ClassDB::bind_method(_MD("_res_changed"),&AnimatedSprite::_res_changed); ADD_SIGNAL(MethodInfo("frame_changed")); - ADD_SIGNAL(MethodInfo("finished")); + ADD_SIGNAL(MethodInfo("animation_finished")); ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); ADD_PROPERTY( PropertyInfo( Variant::STRING, "animation"), _SCS("set_animation"),_SCS("get_animation")); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 97efb26753e..253c643b980 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -733,7 +733,7 @@ void AnimationPlayer::_animation_process(float p_delta) { playing = false; _set_process(false); end_notify=false; - emit_signal(SceneStringNames::get_singleton()->finished); + emit_signal(SceneStringNames::get_singleton()->animation_finished,playback.assigned); } } @@ -1353,7 +1353,7 @@ void AnimationPlayer::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), _SCS("set_default_blend_time"), _SCS("get_default_blend_time")); ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "root_node"), _SCS("set_root"), _SCS("get_root")); - ADD_SIGNAL( MethodInfo("finished") ); + ADD_SIGNAL( MethodInfo("animation_finished", PropertyInfo(Variant::STRING,"name")) ); ADD_SIGNAL( MethodInfo("animation_changed", PropertyInfo(Variant::STRING,"old_name"), PropertyInfo(Variant::STRING,"new_name")) ); ADD_SIGNAL( MethodInfo("animation_started", PropertyInfo(Variant::STRING,"name")) ); diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 3c420626cf9..8e7ca882a49 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -51,6 +51,7 @@ SceneStringNames::SceneStringNames() { sleeping_state_changed=StaticCString::create("sleeping_state_changed"); finished=StaticCString::create("finished"); + animation_finished=StaticCString::create("animation_finished"); animation_changed=StaticCString::create("animation_changed"); animation_started=StaticCString::create("animation_started"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index a73f40ac7c1..5befaa2b69a 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -80,6 +80,7 @@ public: StringName sort_children; StringName finished; + StringName animation_finished; StringName animation_changed; StringName animation_started;