Add ability to copy and paste animations in SpriteFrames

This commit is contained in:
DexterFstone 2025-06-23 02:30:37 -07:00 committed by Dexter
parent 084d5d407e
commit 7d8370a5fb
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);
}