summaryrefslogtreecommitdiff
path: root/editor/create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r--editor/create_dialog.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 520bf480fd..95b4f7e982 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -171,6 +171,9 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type);
String to_select_type = *to_select ? (*to_select)->get_text(0) : "";
bool current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type);
+ if (*to_select && p_type.length() < (*to_select)->get_text(0).length()) {
+ current_item_is_preffered = true;
+ }
if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) {
*to_select = item;
@@ -211,9 +214,6 @@ void CreateDialog::_update_search() {
_parse_fs(EditorFileSystem::get_singleton()->get_filesystem());
*/
- List<StringName> type_list;
- ClassDB::get_class_list(&type_list);
-
HashMap<String, TreeItem *> types;
TreeItem *root = search_options->create_item();
@@ -293,6 +293,7 @@ void CreateDialog::_update_search() {
if (to_select) {
to_select->select(0);
+ search_options->scroll_to_item(to_select);
favorite->set_disabled(false);
favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1);
}
@@ -615,6 +616,9 @@ void CreateDialog::_bind_methods() {
CreateDialog::CreateDialog() {
+ ClassDB::get_class_list(&type_list);
+ type_list.sort_custom<StringName::AlphCompare>();
+
set_resizable(true);
HSplitContainer *hbc = memnew(HSplitContainer);