diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-27 18:18:12 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-27 18:18:54 -0300 |
commit | 98ffb6b37e5f02a1b1e52aaa63ad615c06da541f (patch) | |
tree | a4013b00d995e92ce1f76ee24321bff09e6c22e6 | |
parent | d0f289b0d91297c5a1094cc4f6fa98186fbfb804 (diff) |
Instantiate global classes properly, fixes #20857
-rw-r--r-- | editor/editor_properties.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index f19eac6878..56bab440c9 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2187,7 +2187,19 @@ void EditorPropertyResource::_menu_option(int p_which) { 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) { obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource"); |