mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
C#: Add global class support
Co-authored-by: willnationsdev <willnationsdev@gmail.com>
This commit is contained in:
parent
2eec9a67d5
commit
a1f454fee3
15 changed files with 201 additions and 25 deletions
|
@ -547,25 +547,32 @@ namespace Godot.SourceGenerators
|
|||
{
|
||||
if (memberNamedType.InheritsFrom("GodotSharp", "Godot.Resource"))
|
||||
{
|
||||
string nativeTypeName = memberNamedType.GetGodotScriptNativeClassName()!;
|
||||
|
||||
hint = PropertyHint.ResourceType;
|
||||
hintString = nativeTypeName;
|
||||
hintString = GetTypeName(memberNamedType);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (memberNamedType.InheritsFrom("GodotSharp", "Godot.Node"))
|
||||
{
|
||||
string nativeTypeName = memberNamedType.GetGodotScriptNativeClassName()!;
|
||||
|
||||
hint = PropertyHint.NodeType;
|
||||
hintString = nativeTypeName;
|
||||
hintString = GetTypeName(memberNamedType);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static string GetTypeName(INamedTypeSymbol memberSymbol)
|
||||
{
|
||||
if (memberSymbol.GetAttributes()
|
||||
.Any(a => a.AttributeClass?.IsGodotGlobalClassAttribute() ?? false))
|
||||
{
|
||||
return memberSymbol.Name;
|
||||
}
|
||||
|
||||
return memberSymbol.GetGodotScriptNativeClassName()!;
|
||||
}
|
||||
|
||||
static bool GetStringArrayEnumHint(VariantType elementVariantType,
|
||||
AttributeData exportAttr, out string? hintString)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue