Fix error when scripting structure uses StringAnsi field

This commit is contained in:
Wojtek Figat
2023-08-18 13:32:06 +02:00
parent f088f2b61d
commit 32c47949fa

View File

@@ -151,6 +151,8 @@ namespace Flax.Build.Bindings
return value;
if (typeInfo.Type == "String")
return $"Variant(StringView({value}))";
if (typeInfo.Type == "StringAnsi")
return $"Variant(StringAnsiView({value}))";
if (typeInfo.Type == "AssetReference" ||
typeInfo.Type == "WeakAssetReference" ||
typeInfo.Type == "SoftAssetReference" ||
@@ -207,6 +209,8 @@ namespace Flax.Build.Bindings
return value;
if (typeInfo.Type == "String")
return $"(StringView){value}";
if (typeInfo.Type == "StringAnsi")
return $"(StringAnsiView){value}";
if (typeInfo.IsPtr && typeInfo.IsConst && typeInfo.Type == "Char")
return $"((StringView){value}).GetText()"; // (StringView)Variant, if not empty, is guaranteed to point to a null-terminated buffer.
if (typeInfo.Type == "AssetReference" || typeInfo.Type == "WeakAssetReference" || typeInfo.Type == "SoftAssetReference")