diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-12-06 13:27:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 13:27:27 +0100 |
commit | a512edcfb9cfff28689f526b6954087b3b596211 (patch) | |
tree | 86b58da4e88705142b0cc781efdccb337659b93d /editor | |
parent | 3a7d5a1c64fa6e5a46b49101f3c04104ad9b954b (diff) | |
parent | 9cb66cac2dea07d2ea7012780bdf8e6bac65c978 (diff) |
Merge pull request #55654 from KoBeWi/reset_softcode
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 11 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 6fce55f8e3..f36a2099d5 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -39,6 +39,7 @@ #include "editor_scale.h" #include "scene/animation/animation_player.h" #include "scene/main/window.h" +#include "scene/scene_string_names.h" #include "servers/audio/audio_stream.h" class AnimationTrackKeyEdit : public Object { @@ -3505,7 +3506,7 @@ void AnimationTrackEditor::make_insert_queue() { void AnimationTrackEditor::commit_insert_queue() { bool reset_allowed = true; AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation("RESET") && player->get_animation("RESET") == animation) { + if (player->has_animation(SceneStringNames::get_singleton()->RESET) && player->get_animation(SceneStringNames::get_singleton()->RESET) == animation) { // Avoid messing with the reset animation itself. reset_allowed = false; } else { @@ -3925,15 +3926,15 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari Ref<Animation> AnimationTrackEditor::_create_and_get_reset_animation() { AnimationPlayer *player = AnimationPlayerEditor::get_singleton()->get_player(); - if (player->has_animation("RESET")) { - return player->get_animation("RESET"); + if (player->has_animation(SceneStringNames::get_singleton()->RESET)) { + return player->get_animation(SceneStringNames::get_singleton()->RESET); } else { Ref<Animation> reset_anim; reset_anim.instantiate(); reset_anim->set_length(ANIM_MIN_LENGTH); - undo_redo->add_do_method(player, "add_animation", "RESET", reset_anim); + undo_redo->add_do_method(player, "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", "RESET"); + undo_redo->add_undo_method(player, "remove_animation", SceneStringNames::get_singleton()->RESET); undo_redo->add_undo_method(AnimationPlayerEditor::get_singleton(), "_animation_player_changed", player); return reset_anim; } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 226046f250..f936871bce 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -42,6 +42,7 @@ #include "editor/plugins/node_3d_editor_plugin.h" // For onion skinning. #include "scene/main/window.h" #include "scene/resources/animation.h" +#include "scene/scene_string_names.h" #include "servers/rendering_server.h" void AnimationPlayerEditor::_node_removed(Node *p_node) { @@ -836,12 +837,12 @@ void AnimationPlayerEditor::_update_player() { for (const StringName &E : animlist) { Ref<Texture2D> icon; if (E == player->get_autoplay()) { - if (E == "RESET") { + if (E == SceneStringNames::get_singleton()->RESET) { icon = autoplay_reset_icon; } else { icon = autoplay_icon; } - } else if (E == "RESET") { + } else if (E == SceneStringNames::get_singleton()->RESET) { icon = reset_icon; } animation->add_icon_item(icon, E); |