summaryrefslogtreecommitdiff
path: root/tools/editor/create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/create_dialog.cpp')
-rw-r--r--tools/editor/create_dialog.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp
index 5275e1beeb..3ab2e35242 100644
--- a/tools/editor/create_dialog.cpp
+++ b/tools/editor/create_dialog.cpp
@@ -42,12 +42,13 @@
void CreateDialog::popup(bool p_dontclear) {
- popup_centered_ratio(0.6);
+ popup_centered_ratio();
if (p_dontclear)
search_box->select_all();
else
search_box->clear();
search_box->grab_focus();
+
_update_search();
@@ -153,6 +154,9 @@ void CreateDialog::_update_search() {
TreeItem *root = search_options->create_item();
root->set_text(0,base_type);
+ if (has_icon(base_type,"EditorIcons")) {
+ root->set_icon(0,get_icon(base_type,"EditorIcons"));
+ }
List<StringName>::Element *I=type_list.front();
TreeItem *to_select=NULL;
@@ -160,14 +164,18 @@ void CreateDialog::_update_search() {
for(;I;I=I->next()) {
+
String type=I->get();
+ if (base_type=="Node" && type.begins_with("Editor"))
+ continue; // do not show editor nodes
if (!ObjectTypeDB::can_instance(type))
continue; // cant create what can't be instanced
- if (search_box->get_text()=="")
+
+ if (search_box->get_text()=="") {
add_type(type,types,root,&to_select);
- else {
+ } else {
bool found=false;
String type=I->get();
@@ -186,7 +194,7 @@ void CreateDialog::_update_search() {
add_type(I->get(),types,root,&to_select);
}
- if (EditorNode::get_editor_data().get_custom_types().has(type)) {
+ if (EditorNode::get_editor_data().get_custom_types().has(type) && ObjectTypeDB::is_type(type, base_type)) {
//there are custom types based on this... cool.
//print_line("there are custom types");
@@ -198,6 +206,7 @@ void CreateDialog::_update_search() {
if (!show)
continue;
+
if (!types.has(type))
add_type(type,types,root,&to_select);
@@ -216,7 +225,7 @@ void CreateDialog::_update_search() {
}
- if (!to_select && (search_box->get_text()=="" || ct[i].name.findn(search_box->get_text())!=-1)) {
+ if (!to_select) {
to_select=item;
}
@@ -246,7 +255,6 @@ void CreateDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
connect("confirmed",this,"_confirmed");
- _update_search();
}
if (p_what==NOTIFICATION_EXIT_TREE) {