summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-01 11:47:37 +0200
committerGitHub <noreply@github.com>2018-05-01 11:47:37 +0200
commit8dd2b2e6f5873a7a2ed841fc89e0c69c25a09113 (patch)
tree186cb71461824dd14f15b3fae4b25b0aea815a58
parent5281415a7b6a7b5f2a43c6ee5a43721dd08aee14 (diff)
parent75897710b301b7c5254ecd67099f31cb6ee840d5 (diff)
Merge pull request #18434 from YeldhamDev/animation_autoplay_fix
Fixed deleting an animation marked to autoplay in the editor affecting the creation of one with the same name
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 220003eb73..b387972558 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -459,6 +459,12 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
Ref<Animation> anim = player->get_animation(current);
undo_redo->create_action(TTR("Remove Animation"));
+ if (player->get_autoplay() == current) {
+ undo_redo->add_do_method(player, "set_autoplay", "");
+ undo_redo->add_undo_method(player, "set_autoplay", current);
+ // Avoid having the autoplay icon linger around if there is only one animation in the player
+ undo_redo->add_do_method(this, "_animation_player_changed", player);
+ }
undo_redo->add_do_method(player, "remove_animation", current);
undo_redo->add_undo_method(player, "add_animation", current, anim);
undo_redo->add_do_method(this, "_animation_player_changed", player);
@@ -822,6 +828,7 @@ void AnimationPlayerEditor::_update_player() {
save_anim->set_disabled(animlist.size() == 0);
tool_anim->set_disabled(player == NULL);
onion_skinning->set_disabled(player == NULL);
+ pin->set_disabled(player == NULL);
int active_idx = -1;
for (List<StringName>::Element *E = animlist.front(); E; E = E->next()) {