1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Remove dead code in AnimationStateMachine editor

This commit is contained in:
Haoyu Qiu
2025-04-08 11:45:21 +08:00
parent 4248411baf
commit 75314c2f87
2 changed files with 2 additions and 72 deletions

View File

@@ -39,10 +39,10 @@
#include "editor/gui/editor_file_dialog.h"
#include "editor/themes/editor_scale.h"
#include "scene/animation/animation_blend_tree.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/tree.h"
#include "scene/main/viewport.h"
#include "scene/main/window.h"
#include "scene/resources/style_box_flat.h"
@@ -706,50 +706,6 @@ void AnimationNodeStateMachineEditor::_stop_connecting() {
state_machine_draw->queue_redraw();
}
void AnimationNodeStateMachineEditor::_delete_selected() {
TreeItem *item = delete_tree->get_next_selected(nullptr);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
while (item) {
if (!updating) {
updating = true;
undo_redo->create_action("Transition(s) Removed");
}
Vector<String> path = item->get_text(0).split(" -> ");
selected_transition_from = path[0];
selected_transition_to = path[1];
_erase_selected(true);
item = delete_tree->get_next_selected(item);
}
if (updating) {
undo_redo->commit_action();
updating = false;
}
}
void AnimationNodeStateMachineEditor::_delete_all() {
updating = true;
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action("Transition(s) Removed");
_erase_selected(true);
undo_redo->commit_action();
updating = false;
delete_window->hide();
}
void AnimationNodeStateMachineEditor::_delete_tree_draw() {
TreeItem *item = delete_tree->get_next_selected(nullptr);
while (item) {
delete_window->get_cancel_button()->set_disabled(false);
return;
}
delete_window->get_cancel_button()->set_disabled(true);
}
void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) {
file_loaded = ResourceLoader::load(p_file);
if (file_loaded.is_valid()) {
@@ -1948,25 +1904,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_title(TTR("Open Animation Node"));
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
delete_window = memnew(ConfirmationDialog);
delete_window->set_flag(Window::FLAG_RESIZE_DISABLED, true);
delete_window->set_flag(Window::FLAG_MINIMIZE_DISABLED, true);
delete_window->set_flag(Window::FLAG_MAXIMIZE_DISABLED, true);
add_child(delete_window);
delete_tree = memnew(Tree);
delete_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
delete_tree->set_hide_root(true);
delete_tree->connect(SceneStringName(draw), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_tree_draw));
delete_window->add_child(delete_tree);
Button *ok = delete_window->get_cancel_button();
ok->set_text(TTR("Delete Selected"));
ok->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_selected));
Button *delete_all = delete_window->add_button(TTR("Delete All"), true);
delete_all->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_delete_all));
}
void EditorAnimationMultiTransitionEdit::add_transition(const StringName &p_from, const StringName &p_to, Ref<AnimationNodeStateMachineTransition> p_transition) {