summaryrefslogtreecommitdiff
path: root/editor/scene_tree_dock.cpp
diff options
context:
space:
mode:
authorAndrew McDonald <andy@vcmobile.net>2018-10-16 22:03:22 -0700
committerAndrew McDonald <andy@vcmobile.net>2018-10-16 22:19:51 -0700
commit66503465dbf599be4392b71c9f4e146c95b501c0 (patch)
tree1b9a28d50731e9e2d14f10c1fe78d901d0ade57a /editor/scene_tree_dock.cpp
parent43c28681add010b5daccbcfde3e3065d7be7b52c (diff)
Use EditorQuickOpen dialog instead of EditorFileDialog when instancing a child scene.
Addresses the bulk of #5180
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r--editor/scene_tree_dock.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index a6a014f3bd..ffe75c38f3 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -53,6 +53,13 @@ void SceneTreeDock::_nodes_drag_begin() {
}
}
+void SceneTreeDock::_quick_open() {
+ Vector<String> files = quick_open->get_selected_files();
+ for (int i = 0; i < files.size(); i++) {
+ instance(files[i]);
+ }
+}
+
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
Ref<InputEventMouseButton> mb = p_event;
@@ -319,16 +326,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
break;
}
- file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- List<String> extensions;
- ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
- file->clear_filters();
- for (int i = 0; i < extensions.size(); i++) {
-
- file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
- }
-
- file->popup_centered_ratio();
+ quick_open->popup_dialog("PackedScene", true);
+ quick_open->set_title(TTR("Instance Child Scene"));
} break;
case TOOL_REPLACE: {
@@ -2283,6 +2282,7 @@ void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_new_scene_from"), &SceneTreeDock::_new_scene_from);
ClassDB::bind_method(D_METHOD("_nodes_dragged"), &SceneTreeDock::_nodes_dragged);
ClassDB::bind_method(D_METHOD("_files_dropped"), &SceneTreeDock::_files_dropped);
+ ClassDB::bind_method(D_METHOD("_quick_open"), &SceneTreeDock::_quick_open);
ClassDB::bind_method(D_METHOD("_script_dropped"), &SceneTreeDock::_script_dropped);
ClassDB::bind_method(D_METHOD("_tree_rmb"), &SceneTreeDock::_tree_rmb);
ClassDB::bind_method(D_METHOD("_filter_changed"), &SceneTreeDock::_filter_changed);
@@ -2433,9 +2433,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
accept = memnew(AcceptDialog);
add_child(accept);
- file = memnew(EditorFileDialog);
- add_child(file);
- file->connect("file_selected", this, "instance");
+ quick_open = memnew(EditorQuickOpen);
+ add_child(quick_open);
+ quick_open->connect("quick_open", this, "_quick_open");
set_process_unhandled_key_input(true);
delete_dialog = memnew(ConfirmationDialog);