diff options
author | HolonProduction <holonproduction@gmail.com> | 2023-11-22 14:12:50 +0100 |
---|---|---|
committer | HolonProduction <holonproduction@gmail.com> | 2024-01-17 21:39:51 +0100 |
commit | 4ab985d1380805f33d35af87cc192cf2e439672f (patch) | |
tree | dc3dbe50c58afe8ed8ddb86fa457ea6827e1f971 /modules/gdscript/gdscript_analyzer.cpp | |
parent | 80de898d721f952dac0b102d48bb73d6b02ee1e8 (diff) | |
download | redot-engine-4ab985d1380805f33d35af87cc192cf2e439672f.tar.gz |
Handle global classes when resolving type from `PropertyInfo`
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 983a19470a..56c87ef988 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -4842,8 +4842,19 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_property(const PropertyInfo } result.builtin_type = p_property.type; if (p_property.type == Variant::OBJECT) { - result.kind = GDScriptParser::DataType::NATIVE; - result.native_type = p_property.class_name == StringName() ? SNAME("Object") : p_property.class_name; + if (ScriptServer::is_global_class(p_property.class_name)) { + result.kind = GDScriptParser::DataType::SCRIPT; + result.script_path = ScriptServer::get_global_class_path(p_property.class_name); + result.native_type = ScriptServer::get_global_class_native_base(p_property.class_name); + + Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(p_property.class_name)); + if (scr.is_valid()) { + result.script_type = scr; + } + } else { + result.kind = GDScriptParser::DataType::NATIVE; + result.native_type = p_property.class_name == StringName() ? "Object" : p_property.class_name; + } } else { result.kind = GDScriptParser::DataType::BUILTIN; result.builtin_type = p_property.type; |