summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-04-27 11:06:20 +0200
committerGitHub <noreply@github.com>2022-04-27 11:06:20 +0200
commit6c20ade250f358ff44d1556d8f11622c5a3048b8 (patch)
tree5940194c385fdc3f626ef1d9ee28ef1de5ca1a44
parent1b5d943fbbda7b5abd69650d07500cb62b9a343d (diff)
parentcf74b3674031f30f9f28fd0d673f2d40fe246075 (diff)
Merge pull request #60440 from KoBeWi/Ȑ̶̛̘̻̹̪͙̇̍̔͐̊̆̏̏̓̈́̉͌͘Ȩ̸͉̳̘̬̣̩̽̈́́̅̈́̕͝ͅS̷͓̮̙̪̪̺̭̰̓̎̌́͗͆͌̈́̒͋͊͘Ë̷̡̨͔̻͈̺͓̘͉́̏̍̓͋̋͠T̶̠̙͍̱̠̱̟͎͇̬̥̞̘͛̔̄̏̆̽̄̌̅͝ͅ
-rw-r--r--editor/animation_track_editor.cpp12
-rw-r--r--scene/animation/animation_tree.cpp4
2 files changed, 12 insertions, 4 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 80e251f6c8..e724d4ccdb 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -4076,12 +4076,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;
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index f5236adbad..424716e002 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -541,9 +541,9 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
player->get_animation_list(&sname);
Ref<Animation> reset_anim;
- bool has_reset_anim = player->has_animation("RESET");
+ bool has_reset_anim = player->has_animation(SceneStringNames::get_singleton()->RESET);
if (has_reset_anim) {
- reset_anim = player->get_animation("RESET");
+ reset_anim = player->get_animation(SceneStringNames::get_singleton()->RESET);
}
for (const StringName &E : sname) {
Ref<Animation> anim = player->get_animation(E);