diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-18 09:33:22 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-18 09:33:22 +0100 |
commit | b5dcb5f58aec77f8e282ff134f279c7bc7467e8e (patch) | |
tree | b57f54bca03094d2293ef287993cbe85f0a5a984 /modules/gdscript/gdscript_analyzer.cpp | |
parent | 96296e476ffda2d4c36680b2271e9eeff0c3b9f8 (diff) | |
parent | 4ab985d1380805f33d35af87cc192cf2e439672f (diff) | |
download | redot-engine-b5dcb5f58aec77f8e282ff134f279c7bc7467e8e.tar.gz |
Merge pull request #85215 from HolonProduction/type-from-property-class-name
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 3fd5b3f519..7026d131e3 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -4908,8 +4908,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; |