diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index dd5a87ff30..3a63100012 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -408,15 +408,15 @@ String CreateDialog::get_selected_type() { return selected->get_text(0); } -Object *CreateDialog::instance_selected() { +Variant CreateDialog::instance_selected() { TreeItem *selected = search_options->get_selected(); if (!selected) { - return nullptr; + return Variant(); } Variant md = selected->get_metadata(0); - Object *obj = nullptr; + Variant obj; if (md.get_type() != Variant::NIL) { String custom = md; if (ScriptServer::is_global_class(custom)) { @@ -434,13 +434,13 @@ Object *CreateDialog::instance_selected() { // Check if any Object-type property should be instantiated. List pinfo; - obj->get_property_list(&pinfo); + ((Object *)obj)->get_property_list(&pinfo); for (List::Element *E = pinfo.front(); E; E = E->next()) { PropertyInfo pi = E->get(); if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) { Object *prop = ClassDB::instance(pi.class_name); - obj->set(pi.name, prop); + ((Object *)obj)->set(pi.name, prop); } } diff --git a/editor/create_dialog.h b/editor/create_dialog.h index b76155365f..b08cb72f14 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -102,7 +102,7 @@ protected: void _save_and_update_favorite_list(); public: - Object *instance_selected(); + Variant instance_selected(); String get_selected_type(); void set_base_type(const String &p_base) { base_type = p_base; } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4c4dacbeb5..1d3bd55ed3 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -468,24 +468,25 @@ void EditorData::add_custom_type(const String &p_type, const String &p_inherits, custom_types[p_inherits].push_back(ct); } -Object *EditorData::instance_custom_type(const String &p_type, const String &p_inherits) { +Variant EditorData::instance_custom_type(const String &p_type, const String &p_inherits) { if (get_custom_types().has(p_inherits)) { for (int i = 0; i < get_custom_types()[p_inherits].size(); i++) { if (get_custom_types()[p_inherits][i].name == p_type) { Ref