diff options
author | kobewi <kobewi4e@gmail.com> | 2022-04-22 20:37:28 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-04-22 22:28:15 +0200 |
commit | cf74b3674031f30f9f28fd0d673f2d40fe246075 (patch) | |
tree | 52d0e2ab2558347b81df3aa3901f21fc3dc93731 /editor | |
parent | f4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff) |
Fix RESET animation not being created
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 685dde4d98..7554d97aef 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4033,12 +4033,20 @@ Ref<Animation> AnimationTrackEditor::_create_and_get_reset_animation() { if (player->has_animation(SceneStringNames::get_singleton()->RESET)) { return player->get_animation(SceneStringNames::get_singleton()->RESET); } else { + Ref<AnimationLibrary> al; + if (!player->has_animation_library("")) { + al.instantiate(); + player->add_animation_library("", al); + } else { + al = player->get_animation_library(""); + } + Ref<Animation> reset_anim; reset_anim.instantiate(); reset_anim->set_length(ANIM_MIN_LENGTH); - undo_redo->add_do_method(player, "add_animation", SceneStringNames::get_singleton()->RESET, reset_anim); + undo_redo->add_do_method(al.ptr(), "add_animation", SceneStringNames::get_singleton()->RESET, reset_anim); undo_redo->add_do_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player); - undo_redo->add_undo_method(player, "remove_animation", SceneStringNames::get_singleton()->RESET); + undo_redo->add_undo_method(al.ptr(), "remove_animation", SceneStringNames::get_singleton()->RESET); undo_redo->add_undo_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player); return reset_anim; } |