From 31008c91998107fe434e96ebc86414336e842bf8 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 25 Jul 2018 08:25:03 -0700 Subject: [PATCH] Visualscript: Don't show Shift+A search box at every screen and reuse EDIT_FIND_NODE_TYPE (ctrl-f) shortcut. The generic search shortcut is now CTRL-F. --- modules/visual_script/visual_script_editor.cpp | 14 ++++++-------- modules/visual_script/visual_script_editor.h | 3 +++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index ad6d32b5671..d29104ed45d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1327,12 +1327,10 @@ void VisualScriptEditor::_input(const Ref &p_event) { if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { revert_on_drag = String(); //so we can still drag functions } +} - Ref k = p_event; - if (k.is_valid() && k->get_scancode() == KEY_A && k->get_shift() && k->is_pressed()) { - new_connect_node_select->select_from_visual_script(String("")); - accept_event(); - } +void VisualScriptEditor::_generic_search() { + new_connect_node_select->select_from_visual_script(String("")); } void VisualScriptEditor::_members_gui_input(const Ref &p_event) { @@ -3148,9 +3146,7 @@ void VisualScriptEditor::_menu_option(int p_what) { } break; case EDIT_FIND_NODE_TYPE: { - //popup disappearing grabs focus to owner, so use call deferred - node_filter->call_deferred("grab_focus"); - node_filter->call_deferred("select_all"); + _generic_search(); } break; case EDIT_COPY_NODES: case EDIT_CUT_NODES: { @@ -3487,6 +3483,8 @@ void VisualScriptEditor::_bind_methods() { ClassDB::bind_method("_member_option", &VisualScriptEditor::_member_option); ClassDB::bind_method("_update_available_nodes", &VisualScriptEditor::_update_available_nodes); + + ClassDB::bind_method("_generic_search", &VisualScriptEditor::_generic_search); } VisualScriptEditor::VisualScriptEditor() { diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 0283f7b162c..e0f8a0aaa7a 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -212,6 +212,9 @@ class VisualScriptEditor : public ScriptEditorBase { String revert_on_drag; void _input(const Ref &p_event); + + void _generic_search(); + void _members_gui_input(const Ref &p_event); void _on_nodes_delete(); void _on_nodes_duplicate();