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.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index dec4f50f03..6bf14df8a1 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -173,7 +173,7 @@ void CreateDialog::_update_search() {
_configure_search_option_item(root, base_type, ClassDB::class_exists(base_type));
const String search_text = search_box->get_text();
- bool empty_search = search_text == "";
+ bool empty_search = search_text.is_empty();
// Filter all candidate results.
Vector<String> candidates;
@@ -244,7 +244,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback));
}
- if (search_box->get_text() != "") {
+ if (!search_box->get_text().is_empty()) {
r_item->set_collapsed(false);
} else {
// Don't collapse the root node or an abstract node on the first tree level.
@@ -322,7 +322,7 @@ void CreateDialog::_cleanup() {
void CreateDialog::_confirmed() {
String selected_item = get_selected_type();
- if (selected_item == String()) {
+ if (selected_item.is_empty()) {
return;
}
@@ -339,8 +339,10 @@ void CreateDialog::_confirmed() {
memdelete(f);
}
- emit_signal(SNAME("create"));
+ // To prevent, emitting an error from the transient window (shader dialog for example) hide this dialog before emitting the "create" signal.
hide();
+
+ emit_signal(SNAME("create"));
_cleanup();
}
@@ -640,7 +642,7 @@ void CreateDialog::_load_favorites_and_history() {
while (!f->eof_reached()) {
String l = f->get_line().strip_edges();
- if (l != String()) {
+ if (!l.is_empty()) {
favorite_list.push_back(l);
}
}