Renamed finished to animation_finished, also passes the animation name when finished

This commit is contained in:
Juan Linietsky 2017-01-08 17:35:11 -03:00
parent 8b7a86ec7b
commit 1b0930c435
4 changed files with 6 additions and 4 deletions

View file

@ -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"));

View file

@ -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")) );

View file

@ -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");

View file

@ -80,6 +80,7 @@ public:
StringName sort_children;
StringName finished;
StringName animation_finished;
StringName animation_changed;
StringName animation_started;