summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorFranklin Sobrinho <franklin_gs@hotmail.com>2016-01-08 08:27:34 -0300
committerFranklin Sobrinho <franklin_gs@hotmail.com>2016-01-08 08:27:34 -0300
commit7fa3bd4e78a36e32c7020e92c74974a6d30051ae (patch)
tree80a0cfcd18b8bfedb7fef273ea86bcb850f639f9 /tools
parenta0c39a4b333a2f05c9bb2ccf1be71ac8e18fc9a9 (diff)
Quick open now can open multiple scenes and scripts
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp27
-rw-r--r--tools/editor/editor_node.h2
-rw-r--r--tools/editor/quick_open.cpp31
-rw-r--r--tools/editor/quick_open.h5
4 files changed, 50 insertions, 15 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 9fe0409c0e..4fbd2c0b69 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2076,21 +2076,21 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case FILE_QUICK_OPEN_SCENE: {
- quick_open->popup("PackedScene");
+ quick_open->popup("PackedScene", true);
quick_open->set_title("Quick Open Scene..");
} break;
case FILE_QUICK_OPEN_SCRIPT: {
- quick_open->popup("Script");
+ quick_open->popup("Script", true);
quick_open->set_title("Quick Open Script..");
} break;
case FILE_QUICK_OPEN_FILE: {
- quick_open->popup("Resource",false,true);
+ quick_open->popup("Resource", false, true);
quick_open->set_title("Quick Search File..");
} break;
@@ -3927,19 +3927,26 @@ void EditorNode::hide_animation_player_editors() {
emit_signal("hide_animation_player_editors");
}
-void EditorNode::_quick_opened(const String& p_resource) {
+void EditorNode::_quick_opened() {
if (current_option==FILE_QUICK_OPEN_FILE) {
- scenes_dock->open(p_resource);
+ String res_path = quick_open->get_selected();
+
+ scenes_dock->open(res_path);
return;
}
- if (quick_open->get_base_type()=="PackedScene") {
- open_request(p_resource);
- } else {
- load_resource(p_resource);
- }
+ Vector<String> files = quick_open->get_selected_files();
+
+ for (int i = 0; i < files.size(); i++) {
+ String res_path = files[i];
+ if (quick_open->get_base_type()=="PackedScene") {
+ open_request(res_path);
+ } else {
+ load_resource(res_path);
+ }
+ }
}
void EditorNode::_quick_run(const String& p_resource) {
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 2228e0948b..ca230a4d5e 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -440,7 +440,7 @@ class EditorNode : public Node {
void _update_keying();
void _hide_top_editors();
- void _quick_opened(const String& p_resource);
+ void _quick_opened();
void _quick_run(const String& p_resource);
void _run(bool p_current=false, const String &p_custom="");
diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp
index bfbcb739ac..22f4a40c83 100644
--- a/tools/editor/quick_open.cpp
+++ b/tools/editor/quick_open.cpp
@@ -30,7 +30,7 @@
#include "os/keyboard.h"
-void EditorQuickOpen::popup(const StringName &p_base, bool p_dontclear, bool p_add_dirs) {
+void EditorQuickOpen::popup(const StringName &p_base, bool p_enable_multi, bool p_add_dirs, bool p_dontclear) {
add_directories=p_add_dirs;
popup_centered_ratio(0.6);
@@ -38,13 +38,38 @@ void EditorQuickOpen::popup(const StringName &p_base, bool p_dontclear, bool p_a
search_box->select_all();
else
search_box->clear();
+ if (p_enable_multi)
+ search_options->set_select_mode(Tree::SELECT_MULTI);
+ else
+ search_options->set_select_mode(Tree::SELECT_SINGLE);
search_box->grab_focus();
base_type=p_base;
_update_search();
+}
+
+String EditorQuickOpen::get_selected() const {
+ TreeItem *ti = search_options->get_selected();
+ if (!ti)
+ return String();
+ return "res://" + ti->get_text(0);
}
+Vector<String> EditorQuickOpen::get_selected_files() const {
+
+ Vector<String> files;
+
+ TreeItem* item = search_options->get_next_selected(search_options->get_root());
+ while (item) {
+
+ files.push_back("res://"+item->get_text(0));
+
+ item = search_options->get_next_selected(item);
+ }
+
+ return files;
+}
void EditorQuickOpen::_text_changed(const String& p_newtext) {
@@ -132,7 +157,7 @@ void EditorQuickOpen::_confirmed() {
TreeItem *ti = search_options->get_selected();
if (!ti)
return;
- emit_signal("quick_open","res://"+ti->get_text(0));
+ emit_signal("quick_open");
hide();
}
@@ -156,7 +181,7 @@ void EditorQuickOpen::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_confirmed"),&EditorQuickOpen::_confirmed);
ObjectTypeDB::bind_method(_MD("_sbox_input"),&EditorQuickOpen::_sbox_input);
- ADD_SIGNAL(MethodInfo("quick_open",PropertyInfo(Variant::STRING,"respath")));
+ ADD_SIGNAL(MethodInfo("quick_open"));
}
diff --git a/tools/editor/quick_open.h b/tools/editor/quick_open.h
index 7f2091e5d1..520f7e569d 100644
--- a/tools/editor/quick_open.h
+++ b/tools/editor/quick_open.h
@@ -61,7 +61,10 @@ public:
StringName get_base_type() const;
- void popup(const StringName& p_base,bool p_dontclear=false,bool p_add_dirs=false);
+ String get_selected() const;
+ Vector<String> get_selected_files() const;
+
+ void popup(const StringName& p_base,bool p_enable_multi=false,bool p_add_dirs=false,bool p_dontclear=false);
EditorQuickOpen();
};