Add support for compiling and running engine without C# scripting
(configurable via `EngineConfiguration.UseCSharp` in Flax.Build)
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Threading/MainThreadTask.h"
|
||||
#include "Engine/Threading/ConcurrentTaskQueue.h"
|
||||
#if USE_MONO
|
||||
#include <ThirdParty/mono-2.0/mono/metadata/mono-gc.h>
|
||||
#endif
|
||||
|
||||
AssetReferenceBase::~AssetReferenceBase()
|
||||
{
|
||||
@@ -202,7 +204,9 @@ void Asset::OnManagedInstanceDeleted()
|
||||
// Cleanup
|
||||
if (_gcHandle)
|
||||
{
|
||||
#if USE_MONO
|
||||
mono_gchandle_free(_gcHandle);
|
||||
#endif
|
||||
_gcHandle = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets managed instance object (or null if no asset set).
|
||||
/// </summary>
|
||||
FORCE_INLINE MonoObject* GetManagedInstance() const
|
||||
FORCE_INLINE MObject* GetManagedInstance() const
|
||||
{
|
||||
return _asset ? _asset->GetOrCreateManagedInstance() : nullptr;
|
||||
}
|
||||
|
||||
@@ -310,10 +310,17 @@ void VisualScriptExecutor::ProcessGroupTools(Box* box, Node* node, Value& value)
|
||||
const StringAsANSI<100> typeNameAnsi(typeName.Get(), typeName.Length());
|
||||
if (StringUtils::Compare(typeNameAnsi.Get(), obj.Type.GetTypeName()) != 0)
|
||||
{
|
||||
#if USE_MONO
|
||||
MonoClass* klass = Scripting::FindClassNative(StringAnsiView(typeNameAnsi.Get(), typeName.Length()));
|
||||
MonoClass* objKlass = MUtils::GetClass(obj);
|
||||
if (!klass || !objKlass || mono_class_is_subclass_of(objKlass, klass, false) == 0)
|
||||
obj = Value::Null;
|
||||
#else
|
||||
const ScriptingTypeHandle type = Scripting::FindScriptingType(StringAnsiView(typeNameAnsi.Get(), typeName.Length()));
|
||||
const ScriptingTypeHandle objType = Scripting::FindScriptingType(obj.Type.GetTypeName());
|
||||
if (!type || !objType || objType.IsSubclassOf(type))
|
||||
obj = Value::Null;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,6 +455,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
// Fallback to C#-only types
|
||||
const auto mclass = Scripting::FindClass(StringAnsiView(typeNameAnsi.Get(), typeName.Length()));
|
||||
if (mclass)
|
||||
@@ -461,6 +469,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (typeName.HasChars())
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets managed instance object (or null if no asset set).
|
||||
/// </summary>
|
||||
FORCE_INLINE MonoObject* GetManagedInstance() const
|
||||
FORCE_INLINE MObject* GetManagedInstance() const
|
||||
{
|
||||
return _asset ? _asset->GetOrCreateManagedInstance() : nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user