summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_editor.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-18 09:33:22 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-18 09:33:22 +0100
commitb5dcb5f58aec77f8e282ff134f279c7bc7467e8e (patch)
treeb57f54bca03094d2293ef287993cbe85f0a5a984 /modules/gdscript/gdscript_editor.cpp
parent96296e476ffda2d4c36680b2271e9eeff0c3b9f8 (diff)
parent4ab985d1380805f33d35af87cc192cf2e439672f (diff)
downloadredot-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_editor.cpp')
-rw-r--r--modules/gdscript/gdscript_editor.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index c330037bd6..210e2c3898 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1432,8 +1432,19 @@ static GDScriptCompletionIdentifier _type_from_property(const PropertyInfo &p_pr
ci.type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
ci.type.builtin_type = p_property.type;
if (p_property.type == Variant::OBJECT) {
- ci.type.kind = GDScriptParser::DataType::NATIVE;
- ci.type.native_type = p_property.class_name == StringName() ? "Object" : p_property.class_name;
+ if (ScriptServer::is_global_class(p_property.class_name)) {
+ ci.type.kind = GDScriptParser::DataType::SCRIPT;
+ ci.type.script_path = ScriptServer::get_global_class_path(p_property.class_name);
+ ci.type.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()) {
+ ci.type.script_type = scr;
+ }
+ } else {
+ ci.type.kind = GDScriptParser::DataType::NATIVE;
+ ci.type.native_type = p_property.class_name == StringName() ? "Object" : p_property.class_name;
+ }
} else {
ci.type.kind = GDScriptParser::DataType::BUILTIN;
}