Merge pull request #107887 from DexterFstone/add-copy-paste-animation-sprite-frames

Add ability to copy and paste animations in SpriteFrames
This commit is contained in:
Thaddeus Crews 2025-10-29 13:13:52 -05:00
commit 95977711ed
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
4 changed files with 200 additions and 52 deletions

View file

@ -1431,8 +1431,7 @@ void AnimatedSprite3D::set_animation(const StringName &p_name) {
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));
}
int frame_count = frames->get_frame_count(animation);
if (animation == StringName() || frame_count == 0) {
if (animation == StringName() || frames->get_frame_count(animation) == 0) {
stop();
return;
} else if (!frames->get_animation_names().has(animation)) {
@ -1442,7 +1441,7 @@ void AnimatedSprite3D::set_animation(const StringName &p_name) {
}
if (std::signbit(get_playing_speed())) {
set_frame_and_progress(frame_count - 1, 1.0);
set_frame_and_progress(frames->get_frame_count(animation) - 1, 1.0);
} else {
set_frame_and_progress(0, 0.0);
}