diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index 4129e2b3e26..777e5339262 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -49,6 +49,11 @@ + + + Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn. + + Emitted when [member frame] changed. diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 60442346f34..e686ce0b74d 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -1047,12 +1047,14 @@ void AnimatedSprite3D::_notification(int p_what) { } else { frame = fc - 1; } + emit_signal(SceneStringNames::get_singleton()->animation_finished); } else { frame++; } _queue_update(); _change_notify("frame"); + emit_signal(SceneStringNames::get_singleton()->frame_changed); } float to_process = MIN(timeout, remaining); @@ -1246,6 +1248,7 @@ void AnimatedSprite3D::_bind_methods() { ClassDB::bind_method(D_METHOD("_res_changed"), &AnimatedSprite3D::_res_changed); ADD_SIGNAL(MethodInfo("frame_changed")); + ADD_SIGNAL(MethodInfo("animation_finished")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "frames", PROPERTY_HINT_RESOURCE_TYPE, "SpriteFrames"), "set_sprite_frames", "get_sprite_frames"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "animation"), "set_animation", "get_animation");