diff options
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r-- | editor/create_dialog.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index e8fd97fa1a..61ec8abacf 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -446,14 +446,14 @@ void CreateDialog::_notification(int p_what) { } } -void CreateDialog::select_type(const String &p_type) { +void CreateDialog::select_type(const String &p_type, bool p_center_on_item) { if (!search_options_types.has(p_type)) { return; } TreeItem *to_select = search_options_types[p_type]; to_select->select(0); - search_options->scroll_to_item(to_select); + search_options->scroll_to_item(to_select, p_center_on_item); if (EditorHelp::get_doc_data()->class_list.has(p_type) && !DTR(EditorHelp::get_doc_data()->class_list[p_type].brief_description).is_empty()) { // Display both class name and description, since the help bit may be displayed @@ -503,24 +503,14 @@ 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; } void CreateDialog::_item_selected() { String name = get_selected_type(); - select_type(name); + select_type(name, false); } void CreateDialog::_hide_requested() { |