Add ScriptingTypeHandle support for scripting bindings as System.Type

This commit is contained in:
Wojciech Figat
2022-10-13 13:35:15 +02:00
parent 77f8df02e5
commit 5c24f8c365
5 changed files with 48 additions and 8 deletions

View File

@@ -174,14 +174,22 @@ namespace Flax.Build.Bindings
return false;
// Skip for special types
if (typeInfo.Type == "BytesContainer" && typeInfo.GenericArgs == null)
return false;
if (typeInfo.Type == "Variant" && typeInfo.GenericArgs == null)
return false;
if (typeInfo.Type == "VariantType" && typeInfo.GenericArgs == null)
return false;
if (typeInfo.Type == "Function" && typeInfo.GenericArgs != null)
return false;
if (typeInfo.GenericArgs == null)
{
if (typeInfo.Type == "BytesContainer")
return false;
if (typeInfo.Type == "Variant")
return false;
if (typeInfo.Type == "VariantType")
return false;
if (typeInfo.Type == "ScriptingTypeHandle")
return false;
}
else
{
if (typeInfo.Type == "Function")
return false;
}
// Find API type info
var apiType = FindApiTypeInfo(buildData, typeInfo, caller);

View File

@@ -43,6 +43,7 @@ namespace Flax.Build.Bindings
{ "StringAnsi", "string" },
{ "StringAnsiView", "string" },
{ "ScriptingObject", "FlaxEngine.Object" },
{ "ScriptingTypeHandle", "System.Type" },
{ "PersistentScriptingObject", "FlaxEngine.Object" },
{ "ManagedScriptingObject", "FlaxEngine.Object" },
{ "MClass", "System.Type" },

View File

@@ -407,6 +407,9 @@ namespace Flax.Build.Bindings
case "VariantType":
type = "MonoReflectionType*";
return "MUtils::BoxVariantType({0})";
case "ScriptingTypeHandle":
type = "MonoReflectionType*";
return "MUtils::BoxScriptingTypeHandle({0})";
case "ScriptingObject":
case "ManagedScriptingObject":
case "PersistentScriptingObject":
@@ -590,6 +593,9 @@ namespace Flax.Build.Bindings
case "VariantType":
type = "MonoReflectionType*";
return "MUtils::UnboxVariantType({0})";
case "ScriptingTypeHandle":
type = "MonoReflectionType*";
return "MUtils::UnboxScriptingTypeHandle({0})";
case "CultureInfo":
type = "void*";
return "MUtils::ToNative({0})";