Fix POD structure check in scripting api if contains array field
This commit is contained in:
@@ -886,7 +886,7 @@ namespace Flax.Build.Bindings
|
||||
contents.Append("static ");
|
||||
string type;
|
||||
|
||||
if (fieldInfo.NoArray && fieldInfo.Type.IsArray)
|
||||
if (fieldInfo.Type.IsArray && (fieldInfo.NoArray || structureInfo.IsPod))
|
||||
{
|
||||
// Fixed-size array that needs to be inlined into structure instead of passing it as managed array
|
||||
fieldInfo.Type.IsArray = false;
|
||||
|
||||
@@ -18,6 +18,18 @@ namespace Flax.Build.Bindings
|
||||
|
||||
public bool HasDefaultValue => !string.IsNullOrEmpty(DefaultValue);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this type is POD (plain old data).
|
||||
/// </summary>
|
||||
public bool IsPod(Builder.BuildData buildData, ApiTypeInfo caller)
|
||||
{
|
||||
// Fixed array in C++ is converted into managed array in C# by default (char Data[100] -> char[] Data)
|
||||
if (Type.IsArray && !NoArray)
|
||||
return false;
|
||||
|
||||
return Type.IsPod(buildData, caller);
|
||||
}
|
||||
|
||||
public override void Write(BinaryWriter writer)
|
||||
{
|
||||
BindingsGenerator.Write(writer, Type);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Flax.Build.Bindings
|
||||
for (int i = 0; _isPod && i < Fields.Count; i++)
|
||||
{
|
||||
var field = Fields[i];
|
||||
if (!field.IsStatic && !field.Type.IsPod(buildData, this))
|
||||
if (!field.IsStatic && !field.IsPod(buildData, this))
|
||||
{
|
||||
_isPod = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user