Fix missing Variant marshalling for scripting structures bindings
#1395
This commit is contained in:
@@ -1512,8 +1512,8 @@ namespace Flax.Build.Bindings
|
||||
type = "IntPtr";
|
||||
else if (type == "bool")
|
||||
type = "byte";
|
||||
else if (type == "object")
|
||||
type = "NativeVariant";
|
||||
else if (fieldInfo.Type.Type == "Variant")
|
||||
type = "IntPtr";
|
||||
else if (internalType)
|
||||
{
|
||||
internalTypeMarshaller = type + "Marshaller";
|
||||
@@ -1530,9 +1530,6 @@ namespace Flax.Build.Bindings
|
||||
if (fieldInfo.NoArray && fieldInfo.Type.IsArray)
|
||||
continue;
|
||||
|
||||
if (type == "NativeVariant")
|
||||
continue; // TODO: FIXME
|
||||
|
||||
if (useSeparator)
|
||||
{
|
||||
toManagedContent.Append(", ");
|
||||
@@ -1634,6 +1631,12 @@ namespace Flax.Build.Bindings
|
||||
toManagedContent.Append($"managed.{fieldInfo.Name} != 0");
|
||||
toNativeContent.Append($"managed.{fieldInfo.Name} ? (byte)1 : (byte)0");
|
||||
}
|
||||
else if (fieldInfo.Type.Type == "Variant")
|
||||
{
|
||||
// Variant passed as boxed object handle
|
||||
toManagedContent.Append($"ManagedHandleMarshaller.NativeToManaged.ConvertToManaged(managed.{fieldInfo.Name})");
|
||||
toNativeContent.Append($"ManagedHandleMarshaller.NativeToManaged.ConvertToUnmanaged(managed.{fieldInfo.Name})");
|
||||
}
|
||||
else if (internalType)
|
||||
{
|
||||
toManagedContent.Append($"{internalTypeMarshaller}.ToManaged(managed.{fieldInfo.Name})");
|
||||
|
||||
Reference in New Issue
Block a user