Fix scripting api bindings for types with changed scripting name (other than native type name)

This commit is contained in:
Wojciech Figat
2022-10-26 15:00:29 +02:00
parent d90245bf32
commit 19f1c4251c
6 changed files with 10 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ API_INJECT_CODE(cpp, "#include \"Engine/Platform/Clipboard.h\"");
/// <summary> /// <summary>
/// Native platform clipboard service. /// Native platform clipboard service.
/// </summary> /// </summary>
API_CLASS(Static, Name="Clipboard") API_CLASS(Static, Name="Clipboard", Tag="NativeInvokeUseName")
class FLAXENGINE_API ClipboardBase class FLAXENGINE_API ClipboardBase
{ {
public: public:

View File

@@ -40,7 +40,8 @@ API_INJECT_CODE(cpp, "#include \"Engine/Platform/FileSystem.h\"");
/// <summary> /// <summary>
/// Platform implementation of filesystem service. /// Platform implementation of filesystem service.
/// </summary> /// </summary>
API_CLASS(Static, Name="FileSystem") class FLAXENGINE_API FileSystemBase API_CLASS(Static, Name="FileSystem", Tag="NativeInvokeUseName")
class FLAXENGINE_API FileSystemBase
{ {
DECLARE_SCRIPTING_TYPE_MINIMAL(FileSystemBase); DECLARE_SCRIPTING_TYPE_MINIMAL(FileSystemBase);

View File

@@ -138,7 +138,8 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkSocketGroup)
/// <summary> /// <summary>
/// Low-level networking implementation interface with Berkeley sockets. /// Low-level networking implementation interface with Berkeley sockets.
/// </summary> /// </summary>
API_CLASS(Static, Name="Network") class FLAXENGINE_API NetworkBase API_CLASS(Static, Name="Network", Tag="NativeInvokeUseName")
class FLAXENGINE_API NetworkBase
{ {
public: public:
static struct FLAXENGINE_API ScriptingTypeInitializer TypeInitializer; static struct FLAXENGINE_API ScriptingTypeInitializer TypeInitializer;

View File

@@ -129,7 +129,8 @@ API_INJECT_CODE(cpp, "#include \"Engine/Platform/Platform.h\"");
/// <summary> /// <summary>
/// Runtime platform service. /// Runtime platform service.
/// </summary> /// </summary>
API_CLASS(Static, Name="Platform") class FLAXENGINE_API PlatformBase API_CLASS(Static, Name="Platform", Tag="NativeInvokeUseName")
class FLAXENGINE_API PlatformBase
{ {
DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase); DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase);

View File

@@ -10,7 +10,8 @@ API_INJECT_CODE(cpp, "#include \"Engine/Platform/User.h\"");
/// <summary> /// <summary>
/// Native platform user object. /// Native platform user object.
/// </summary> /// </summary>
API_CLASS(NoSpawn, NoConstructor, Sealed, Name="User") class FLAXENGINE_API UserBase : public ScriptingObject API_CLASS(NoSpawn, NoConstructor, Sealed, Name="User")
class FLAXENGINE_API UserBase : public ScriptingObject
{ {
DECLARE_SCRIPTING_TYPE_NO_SPAWN(UserBase); DECLARE_SCRIPTING_TYPE_NO_SPAWN(UserBase);
protected: protected:

View File

@@ -983,7 +983,7 @@ namespace Flax.Build.Bindings
if (functionInfo.IsStatic) if (functionInfo.IsStatic)
{ {
// Call native static method // Call native static method
string nativeType = caller.Name; string nativeType = caller.Tags != null && caller.Tags.ContainsKey("NativeInvokeUseName") ? caller.Name : caller.NativeName;
if (caller.Parent != null && !(caller.Parent is FileInfo)) if (caller.Parent != null && !(caller.Parent is FileInfo))
nativeType = caller.Parent.FullNameNative + "::" + nativeType; nativeType = caller.Parent.FullNameNative + "::" + nativeType;
call = $"{nativeType}::{functionInfo.Name}"; call = $"{nativeType}::{functionInfo.Name}";