|
@@ -360,8 +360,14 @@ namespace Godot.SourceGenerators
|
|
.Append("\", usage: (global::Godot.PropertyUsageFlags)")
|
|
.Append("\", usage: (global::Godot.PropertyUsageFlags)")
|
|
.Append((int)propertyInfo.Usage)
|
|
.Append((int)propertyInfo.Usage)
|
|
.Append(", exported: ")
|
|
.Append(", exported: ")
|
|
- .Append(propertyInfo.Exported ? "true" : "false")
|
|
|
|
- .Append(")");
|
|
|
|
|
|
+ .Append(propertyInfo.Exported ? "true" : "false");
|
|
|
|
+ if (propertyInfo.ClassName != null)
|
|
|
|
+ {
|
|
|
|
+ source.Append(", className: new global::Godot.StringName(\"")
|
|
|
|
+ .Append(propertyInfo.ClassName)
|
|
|
|
+ .Append("\")");
|
|
|
|
+ }
|
|
|
|
+ source.Append(")");
|
|
}
|
|
}
|
|
|
|
|
|
private static MethodInfo DetermineMethodInfo(GodotSignalDelegateData signalDelegateData)
|
|
private static MethodInfo DetermineMethodInfo(GodotSignalDelegateData signalDelegateData)
|
|
@@ -372,7 +378,9 @@ namespace Godot.SourceGenerators
|
|
|
|
|
|
if (invokeMethodData.RetType != null)
|
|
if (invokeMethodData.RetType != null)
|
|
{
|
|
{
|
|
- returnVal = DeterminePropertyInfo(invokeMethodData.RetType.Value.MarshalType, name: string.Empty);
|
|
|
|
|
|
+ returnVal = DeterminePropertyInfo(invokeMethodData.RetType.Value.MarshalType,
|
|
|
|
+ invokeMethodData.RetType.Value.TypeSymbol,
|
|
|
|
+ name: string.Empty);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -391,6 +399,7 @@ namespace Godot.SourceGenerators
|
|
for (int i = 0; i < paramCount; i++)
|
|
for (int i = 0; i < paramCount; i++)
|
|
{
|
|
{
|
|
arguments.Add(DeterminePropertyInfo(invokeMethodData.ParamTypes[i],
|
|
arguments.Add(DeterminePropertyInfo(invokeMethodData.ParamTypes[i],
|
|
|
|
+ invokeMethodData.Method.Parameters[i].Type,
|
|
name: invokeMethodData.Method.Parameters[i].Name));
|
|
name: invokeMethodData.Method.Parameters[i].Name));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -403,7 +412,7 @@ namespace Godot.SourceGenerators
|
|
defaultArguments: null);
|
|
defaultArguments: null);
|
|
}
|
|
}
|
|
|
|
|
|
- private static PropertyInfo DeterminePropertyInfo(MarshalType marshalType, string name)
|
|
|
|
|
|
+ private static PropertyInfo DeterminePropertyInfo(MarshalType marshalType, ITypeSymbol typeSymbol, string name)
|
|
{
|
|
{
|
|
var memberVariantType = MarshalUtils.ConvertMarshalTypeToVariantType(marshalType)!.Value;
|
|
var memberVariantType = MarshalUtils.ConvertMarshalTypeToVariantType(marshalType)!.Value;
|
|
|
|
|
|
@@ -412,8 +421,14 @@ namespace Godot.SourceGenerators
|
|
if (memberVariantType == VariantType.Nil)
|
|
if (memberVariantType == VariantType.Nil)
|
|
propUsage |= PropertyUsageFlags.NilIsVariant;
|
|
propUsage |= PropertyUsageFlags.NilIsVariant;
|
|
|
|
|
|
|
|
+ string? className = null;
|
|
|
|
+ if (memberVariantType == VariantType.Object && typeSymbol is INamedTypeSymbol namedTypeSymbol)
|
|
|
|
+ {
|
|
|
|
+ className = namedTypeSymbol.GetGodotScriptNativeClassName();
|
|
|
|
+ }
|
|
|
|
+
|
|
return new PropertyInfo(memberVariantType, name,
|
|
return new PropertyInfo(memberVariantType, name,
|
|
- PropertyHint.None, string.Empty, propUsage, exported: false);
|
|
|
|
|
|
+ PropertyHint.None, string.Empty, propUsage, className, exported: false);
|
|
}
|
|
}
|
|
|
|
|
|
private static void GenerateHasSignalEntry(
|
|
private static void GenerateHasSignalEntry(
|