Fix custom types showing on wrong dialogs
* The custom types are visible when the dialog is shown
This commit is contained in:
parent
ae3d316798
commit
c6a0b0dab3
|
@ -42,12 +42,13 @@
|
||||||
|
|
||||||
void CreateDialog::popup(bool p_dontclear) {
|
void CreateDialog::popup(bool p_dontclear) {
|
||||||
|
|
||||||
popup_centered_ratio(0.6);
|
popup_centered_ratio();
|
||||||
if (p_dontclear)
|
if (p_dontclear)
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
else
|
else
|
||||||
search_box->clear();
|
search_box->clear();
|
||||||
search_box->grab_focus();
|
search_box->grab_focus();
|
||||||
|
|
||||||
_update_search();
|
_update_search();
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,9 +166,10 @@ void CreateDialog::_update_search() {
|
||||||
|
|
||||||
if (!ObjectTypeDB::can_instance(type))
|
if (!ObjectTypeDB::can_instance(type))
|
||||||
continue; // cant create what can't be instanced
|
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);
|
add_type(type,types,root,&to_select);
|
||||||
else {
|
} else {
|
||||||
|
|
||||||
bool found=false;
|
bool found=false;
|
||||||
String type=I->get();
|
String type=I->get();
|
||||||
|
@ -186,7 +188,7 @@ void CreateDialog::_update_search() {
|
||||||
add_type(I->get(),types,root,&to_select);
|
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.
|
//there are custom types based on this... cool.
|
||||||
//print_line("there are custom types");
|
//print_line("there are custom types");
|
||||||
|
|
||||||
|
@ -198,6 +200,7 @@ void CreateDialog::_update_search() {
|
||||||
|
|
||||||
if (!show)
|
if (!show)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!types.has(type))
|
if (!types.has(type))
|
||||||
add_type(type,types,root,&to_select);
|
add_type(type,types,root,&to_select);
|
||||||
|
|
||||||
|
@ -216,7 +219,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;
|
to_select=item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +249,6 @@ void CreateDialog::_notification(int p_what) {
|
||||||
if (p_what==NOTIFICATION_ENTER_TREE) {
|
if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||||
|
|
||||||
connect("confirmed",this,"_confirmed");
|
connect("confirmed",this,"_confirmed");
|
||||||
_update_search();
|
|
||||||
}
|
}
|
||||||
if (p_what==NOTIFICATION_EXIT_TREE) {
|
if (p_what==NOTIFICATION_EXIT_TREE) {
|
||||||
|
|
||||||
|
|
|
@ -2494,7 +2494,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
||||||
#endif
|
#endif
|
||||||
case RESOURCE_NEW: {
|
case RESOURCE_NEW: {
|
||||||
|
|
||||||
create_dialog->popup_centered_ratio();
|
create_dialog->popup(true);
|
||||||
} break;
|
} break;
|
||||||
case RESOURCE_LOAD: {
|
case RESOURCE_LOAD: {
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
|
|
||||||
//if (!_validate_no_foreign())
|
//if (!_validate_no_foreign())
|
||||||
// break;
|
// break;
|
||||||
create_dialog->popup_centered_ratio();
|
create_dialog->popup(true);
|
||||||
} break;
|
} break;
|
||||||
case TOOL_INSTANCE: {
|
case TOOL_INSTANCE: {
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
} break;
|
} break;
|
||||||
case TOOL_REPLACE: {
|
case TOOL_REPLACE: {
|
||||||
|
|
||||||
create_dialog->popup_centered_ratio();
|
create_dialog->popup(false);
|
||||||
} break;
|
} break;
|
||||||
case TOOL_CONNECT: {
|
case TOOL_CONNECT: {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue