diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 23a84a1f9d6..320d80a96c3 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -196,6 +196,9 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { next_tab = next_tab >= 0 ? next_tab : editor_data.get_edited_scene_count() - 1; _scene_tab_changed(next_tab); } + if (ED_IS_SHORTCUT("editor/filter_files", p_event)) { + filesystem_dock->focus_on_filter(); + } switch(p_event.key.scancode) { @@ -2072,14 +2075,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { quick_open->popup("Script", true); quick_open->set_title(TTR("Quick Open Script..")); - } break; - case FILE_QUICK_OPEN_FILE: { - - - //quick_open->popup("Resource", false, true); - //quick_open->set_title("Quick Search File.."); - scenes_dock->focus_on_filter(); - } break; case FILE_RUN_SCRIPT: { @@ -3841,9 +3836,9 @@ void EditorNode::request_instance_scenes(const Vector& p_files) { scene_tree_dock->instance_scenes(p_files); } -FileSystemDock *EditorNode::get_scenes_dock() { +FileSystemDock *EditorNode::get_filesystem_dock() { - return scenes_dock; + return filesystem_dock; } SceneTreeDock *EditorNode::get_scene_tree_dock() { @@ -5152,7 +5147,7 @@ Variant EditorNode::drag_files_and_dirs(const Vector& p_files, Control * void EditorNode::_dropped_files(const Vector& p_files,int p_screen) { - String cur_path = scenes_dock->get_current_path(); + String cur_path = filesystem_dock->get_current_path(); for(int i=0;iget_import_plugin_count();i++) { EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); } @@ -5680,6 +5675,7 @@ EditorNode::EditorNode() { ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD+KEY_TAB); ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB); + ED_SHORTCUT("editor/filter_files", TTR("Filter Files.."), KEY_MASK_ALT+KEY_MASK_CMD+KEY_P); file_menu->set_tooltip(TTR("Operations with scene files.")); @@ -5699,7 +5695,6 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene",TTR("Quick Open Scene.."),KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_O),FILE_QUICK_OPEN_SCENE); p->add_shortcut(ED_SHORTCUT("editor/quick_open_script",TTR("Quick Open Script.."),KEY_MASK_ALT+KEY_MASK_CMD+KEY_O),FILE_QUICK_OPEN_SCRIPT); - p->add_shortcut(ED_SHORTCUT("editor/quick_filter_files",TTR("Quick Filter Files.."),KEY_MASK_ALT+KEY_MASK_CMD+KEY_P),FILE_QUICK_OPEN_FILE); p->add_separator(); PopupMenu *pm_export = memnew(PopupMenu ); @@ -6183,13 +6178,13 @@ EditorNode::EditorNode() { //node_dock->set_undoredo(&editor_data.get_undo_redo()); dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); - scenes_dock = memnew( FileSystemDock(this) ); - scenes_dock->set_name(TTR("FileSystem")); - scenes_dock->set_display_mode(int(EditorSettings::get_singleton()->get("filesystem_dock/display_mode"))); - dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock); - //prop_pallete->add_child(scenes_dock); - scenes_dock->connect("open",this,"open_request"); - scenes_dock->connect("instance",this,"_instance_request"); + filesystem_dock = memnew( FileSystemDock(this) ); + filesystem_dock->set_name(TTR("FileSystem")); + filesystem_dock->set_display_mode(int(EditorSettings::get_singleton()->get("filesystem_dock/display_mode"))); + dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock); + //prop_pallete->add_child(filesystem_dock); + filesystem_dock->connect("open",this,"open_request"); + filesystem_dock->connect("instance",this,"_instance_request"); const String docks_section = "docks"; diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index a66ea1d8a84..ca5327abfcf 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -137,7 +137,6 @@ private: FILE_OPEN_OLD_SCENE, FILE_QUICK_OPEN_SCENE, FILE_QUICK_OPEN_SCRIPT, - FILE_QUICK_OPEN_FILE, FILE_RUN_SCRIPT, FILE_OPEN_PREV, FILE_CLOSE, @@ -276,7 +275,7 @@ private: PropertyEditor *property_editor; NodeDock *node_dock; VBoxContainer *prop_editor_vb; - FileSystemDock *scenes_dock; + FileSystemDock *filesystem_dock; EditorRunNative *run_native; HBoxContainer *search_bar; @@ -669,7 +668,7 @@ public: void request_instance_scene(const String &p_path); void request_instance_scenes(const Vector& p_files); - FileSystemDock *get_scenes_dock(); + FileSystemDock *get_filesystem_dock(); SceneTreeDock *get_scene_tree_dock(); static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 86c2fe2a6a6..e18e6925108 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -168,7 +168,7 @@ void FileSystemDock::_notification(int p_what) { _update_tree(); //maybe it finished already if (EditorFileSystem::get_singleton()->is_scanning()) { - _set_scannig_mode(); + _set_scanning_mode(); } } break; @@ -660,7 +660,7 @@ void FileSystemDock::_fs_changed() { set_process(false); } -void FileSystemDock::_set_scannig_mode() { +void FileSystemDock::_set_scanning_mode() { split_box->hide(); button_hist_prev->set_disabled(true); @@ -1137,7 +1137,7 @@ void FileSystemDock::_search_changed(const String& p_text) { void FileSystemDock::_rescan() { - _set_scannig_mode(); + _set_scanning_mode(); EditorFileSystem::get_singleton()->scan(); } @@ -1149,6 +1149,14 @@ void FileSystemDock::fix_dependencies(const String& p_for_file) { void FileSystemDock::focus_on_filter() { + if (!search_box->is_visible()) { + // Tree mode, switch to files list with search box + tree->hide(); + file_list_vb->show(); + button_favorite->hide(); + } + + search_box->grab_focus(); } void FileSystemDock::set_display_mode(int p_mode) { diff --git a/tools/editor/filesystem_dock.h b/tools/editor/filesystem_dock.h index c23428fcb88..506a4107e94 100644 --- a/tools/editor/filesystem_dock.h +++ b/tools/editor/filesystem_dock.h @@ -146,7 +146,7 @@ private: void _dir_selected(); void _update_tree(); void _rescan(); - void _set_scannig_mode(); + void _set_scanning_mode(); void _favorites_pressed(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 799be854f27..0a78c11babd 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -3437,7 +3437,7 @@ void SpatialEditor::_instance_scene() { #if 0 EditorNode *en = get_scene()->get_root_node()->cast_to(); ERR_FAIL_COND(!en); - String path = en->get_scenes_dock()->get_selected_path(); + String path = en->get_filesystem_dock()->get_selected_path(); if (path=="") { set_message(TTR("No scene selected to instance!")); return;