diff options
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r-- | editor/create_dialog.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index d0dfbc7c11..33e5100cb4 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -178,7 +178,7 @@ void CreateDialog::_update_search() { // Filter all candidate results. Vector<String> candidates; for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) { - if (empty_search || search_text.is_subsequence_ofi(I->get())) { + if (empty_search || search_text.is_subsequence_ofn(I->get())) { candidates.push_back(I->get()); } } @@ -467,7 +467,7 @@ void CreateDialog::select_type(const String &p_type) { } favorite->set_disabled(false); - favorite->set_pressed(favorite_list.find(p_type) != -1); + favorite->set_pressed(favorite_list.has(p_type)); get_ok_button()->set_disabled(false); } @@ -503,17 +503,7 @@ Variant CreateDialog::instance_selected() { } else { obj = ClassDB::instantiate(selected->get_text(0)); } - - // Check if any Object-type property should be instantiated. - List<PropertyInfo> pinfo; - ((Object *)obj)->get_property_list(&pinfo); - - for (const PropertyInfo &pi : pinfo) { - if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) { - Object *prop = ClassDB::instantiate(pi.class_name); - ((Object *)obj)->set(pi.name, prop); - } - } + EditorNode::get_editor_data().instantiate_object_properties(obj); return obj; } @@ -539,12 +529,12 @@ void CreateDialog::_favorite_toggled() { String name = item->get_text(0); - if (favorite_list.find(name) == -1) { - favorite_list.push_back(name); - favorite->set_pressed(true); - } else { + if (favorite_list.has(name)) { favorite_list.erase(name); favorite->set_pressed(false); + } else { + favorite_list.push_back(name); + favorite->set_pressed(true); } _save_and_update_favorite_list(); |