diff options
| author | Franklin Sobrinho | 2016-01-08 08:27:34 -0300 |
|---|---|---|
| committer | Franklin Sobrinho | 2016-01-08 08:27:34 -0300 |
| commit | 7fa3bd4e78a36e32c7020e92c74974a6d30051ae (patch) | |
| tree | 80a0cfcd18b8bfedb7fef273ea86bcb850f639f9 /tools/editor/quick_open.cpp | |
| parent | a0c39a4b333a2f05c9bb2ccf1be71ac8e18fc9a9 (diff) | |
| download | godot-7fa3bd4e78a36e32c7020e92c74974a6d30051ae.tar.gz godot-7fa3bd4e78a36e32c7020e92c74974a6d30051ae.tar.zst godot-7fa3bd4e78a36e32c7020e92c74974a6d30051ae.zip | |
Quick open now can open multiple scenes and scripts
Diffstat (limited to 'tools/editor/quick_open.cpp')
| -rw-r--r-- | tools/editor/quick_open.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp index bfbcb739a..22f4a40c8 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")); } |
