Fix scripting bindings codegen for SoftTypeReference and SceneReference

#2761
This commit is contained in:
Wojtek Figat
2025-02-26 22:43:30 +01:00
parent 809fd2653a
commit b2c8c4018c
8 changed files with 95 additions and 37 deletions

View File

@@ -38,6 +38,16 @@ namespace FlaxEngine
_typeName = typeName;
}
/// <summary>
/// Implicit cast operator from type name to string.
/// </summary>
/// <param name="s">The soft type reference.</param>
/// <returns>The type name.</returns>
public static implicit operator string(SoftTypeReference s)
{
return s._typeName;
}
/// <summary>
/// Gets the soft type reference from full name.
/// </summary>

View File

@@ -12,7 +12,7 @@
/// The soft reference to the scripting type contained in the scripting assembly.
/// </summary>
template<typename T = ScriptingObject>
API_STRUCT(InBuild) struct SoftTypeReference
API_STRUCT(InBuild, MarshalAs=StringAnsi) struct SoftTypeReference
{
protected:
StringAnsi _typeName;
@@ -64,7 +64,7 @@ public:
return *this;
}
FORCE_INLINE SoftTypeReference& operator=(const StringAnsiView& s)
FORCE_INLINE SoftTypeReference& operator=(const StringAnsiView& s) noexcept
{
_typeName = s;
return *this;
@@ -95,6 +95,16 @@ public:
return _typeName.HasChars();
}
operator StringAnsi() const
{
return _typeName;
}
String ToString() const
{
return _typeName.ToString();
}
public:
// Gets the type full name (eg. FlaxEngine.Actor).
StringAnsiView GetTypeName() const