Skip to content

Commit

Permalink
Merge pull request #92495 from matheusmdx/fix-animation-player-error
Browse files Browse the repository at this point in the history
Fix error after create a new animation in an empty AnimationPlayer
  • Loading branch information
akien-mga committed May 29, 2024
2 parents 5f57256 + 18cdb3c commit a8cc65f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions editor/plugins/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,18 @@ void AnimationPlayerEditor::_animation_name_edited() {
} break;

case TOOL_NEW_ANIM: {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> current_anim = player->get_animation(current);
Ref<Animation> new_anim = Ref<Animation>(memnew(Animation));
new_anim->set_name(new_name);
if (current_anim.is_valid()) {
new_anim->set_step(current_anim->get_step());

if (animation->get_item_count() > 0) {
String current = animation->get_item_text(animation->get_selected());
Ref<Animation> current_anim = player->get_animation(current);

if (current_anim.is_valid()) {
new_anim->set_step(current_anim->get_step());
}
}

String library_name;
Ref<AnimationLibrary> al;
library_name = library->get_item_metadata(library->get_selected());
Expand Down

0 comments on commit a8cc65f

Please sign in to comment.