Refactor Plugins system to support plugins in C++ scripts
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "MType.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/DataContainer.h"
|
||||
#include "Engine/Core/Types/Version.h"
|
||||
#include "Engine/Core/Math/BoundingBox.h"
|
||||
#include "Engine/Core/Math/BoundingSphere.h"
|
||||
#include "Engine/Core/Math/Rectangle.h"
|
||||
@@ -1279,4 +1280,18 @@ void* MUtils::VariantToManagedArgPtr(Variant& value, const MType& type, bool& fa
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MonoObject* MUtils::ToManaged(const Version& value)
|
||||
{
|
||||
auto obj = mono_object_new(mono_domain_get(), Scripting::FindClassNative("System.Version"));
|
||||
Platform::MemoryCopy((byte*)obj + sizeof(MonoObject), &value, sizeof(Version));
|
||||
return obj;
|
||||
}
|
||||
|
||||
Version MUtils::ToNative(MonoObject* value)
|
||||
{
|
||||
if (value)
|
||||
return *(Version*)((byte*)value + sizeof(MonoObject));
|
||||
return Version();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/object.h>
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/appdomain.h>
|
||||
|
||||
struct Version;
|
||||
|
||||
namespace MUtils
|
||||
{
|
||||
extern FLAXENGINE_API StringView ToString(MonoString* str);
|
||||
@@ -500,6 +502,9 @@ namespace MUtils
|
||||
}
|
||||
|
||||
extern void* VariantToManagedArgPtr(Variant& value, const MType& type, bool& failed);
|
||||
extern MonoObject* ToManaged(const Version& value);
|
||||
extern Version ToNative(MonoObject* value);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user