Instantiate global classes properly, fixes #20857
This commit is contained in:
parent
d0f289b0d9
commit
98ffb6b37e
|
@ -2187,7 +2187,19 @@ void EditorPropertyResource::_menu_option(int p_which) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object *obj = ClassDB::instance(intype);
|
Object *obj = NULL;
|
||||||
|
|
||||||
|
if (ScriptServer::is_global_class(intype)) {
|
||||||
|
obj = ClassDB::instance(ScriptServer::get_global_class_base(intype));
|
||||||
|
if (obj) {
|
||||||
|
Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype));
|
||||||
|
if (script.is_valid()) {
|
||||||
|
obj->set_script(Variant(script));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj = ClassDB::instance(intype);
|
||||||
|
}
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
|
obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
|
||||||
|
|
Loading…
Reference in New Issue