Remove dead code in AnimationStateMachine editor
This commit is contained in:
@ -39,10 +39,10 @@
|
|||||||
#include "editor/gui/editor_file_dialog.h"
|
#include "editor/gui/editor_file_dialog.h"
|
||||||
#include "editor/themes/editor_scale.h"
|
#include "editor/themes/editor_scale.h"
|
||||||
#include "scene/animation/animation_blend_tree.h"
|
#include "scene/animation/animation_blend_tree.h"
|
||||||
|
#include "scene/gui/line_edit.h"
|
||||||
#include "scene/gui/option_button.h"
|
#include "scene/gui/option_button.h"
|
||||||
#include "scene/gui/panel_container.h"
|
#include "scene/gui/panel_container.h"
|
||||||
#include "scene/gui/separator.h"
|
#include "scene/gui/separator.h"
|
||||||
#include "scene/gui/tree.h"
|
|
||||||
#include "scene/main/viewport.h"
|
#include "scene/main/viewport.h"
|
||||||
#include "scene/main/window.h"
|
#include "scene/main/window.h"
|
||||||
#include "scene/resources/style_box_flat.h"
|
#include "scene/resources/style_box_flat.h"
|
||||||
@ -706,50 +706,6 @@ void AnimationNodeStateMachineEditor::_stop_connecting() {
|
|||||||
state_machine_draw->queue_redraw();
|
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) {
|
void AnimationNodeStateMachineEditor::_file_opened(const String &p_file) {
|
||||||
file_loaded = ResourceLoader::load(p_file);
|
file_loaded = ResourceLoader::load(p_file);
|
||||||
if (file_loaded.is_valid()) {
|
if (file_loaded.is_valid()) {
|
||||||
@ -1948,25 +1904,6 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
|
|||||||
open_file->set_title(TTR("Open Animation Node"));
|
open_file->set_title(TTR("Open Animation Node"));
|
||||||
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
|
||||||
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
|
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) {
|
void EditorAnimationMultiTransitionEdit::add_transition(const StringName &p_from, const StringName &p_to, Ref<AnimationNodeStateMachineTransition> p_transition) {
|
||||||
|
|||||||
@ -34,10 +34,10 @@
|
|||||||
#include "scene/animation/animation_node_state_machine.h"
|
#include "scene/animation/animation_node_state_machine.h"
|
||||||
#include "scene/gui/graph_edit.h"
|
#include "scene/gui/graph_edit.h"
|
||||||
#include "scene/gui/popup.h"
|
#include "scene/gui/popup.h"
|
||||||
#include "scene/gui/tree.h"
|
|
||||||
|
|
||||||
class ConfirmationDialog;
|
class ConfirmationDialog;
|
||||||
class EditorFileDialog;
|
class EditorFileDialog;
|
||||||
|
class LineEdit;
|
||||||
class OptionButton;
|
class OptionButton;
|
||||||
class PanelContainer;
|
class PanelContainer;
|
||||||
|
|
||||||
@ -149,9 +149,6 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
|
|||||||
|
|
||||||
Vector2 add_node_pos;
|
Vector2 add_node_pos;
|
||||||
|
|
||||||
ConfirmationDialog *delete_window = nullptr;
|
|
||||||
Tree *delete_tree = nullptr;
|
|
||||||
|
|
||||||
bool box_selecting = false;
|
bool box_selecting = false;
|
||||||
Point2 box_selecting_from;
|
Point2 box_selecting_from;
|
||||||
Point2 box_selecting_to;
|
Point2 box_selecting_to;
|
||||||
@ -252,10 +249,6 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
|
|||||||
bool _create_submenu(PopupMenu *p_menu, Ref<AnimationNodeStateMachine> p_nodesm, const StringName &p_name, const StringName &p_path);
|
bool _create_submenu(PopupMenu *p_menu, Ref<AnimationNodeStateMachine> p_nodesm, const StringName &p_name, const StringName &p_path);
|
||||||
void _stop_connecting();
|
void _stop_connecting();
|
||||||
|
|
||||||
void _delete_selected();
|
|
||||||
void _delete_all();
|
|
||||||
void _delete_tree_draw();
|
|
||||||
|
|
||||||
bool last_active = false;
|
bool last_active = false;
|
||||||
StringName last_fading_from_node;
|
StringName last_fading_from_node;
|
||||||
StringName last_current_node;
|
StringName last_current_node;
|
||||||
|
|||||||
Reference in New Issue
Block a user