summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-04-25 22:09:41 -0300
committerMichael Alexsander Silva Dias <michaelalexsander@protonmail.com>2018-04-27 16:06:05 -0300
commite93a56ef3e517edfa6146ed62af4b9f85de96500 (patch)
tree1462189119b45101c2ec67d51f70a6adcca635d9
parentb22f048700105dec26154cc90f10b0ef34b3f5ed (diff)
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.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 220003eb73..ae3a609f6a 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);