diff --git a/Content/Editor/Icons/Textures/AudioListner.flax b/Content/Editor/Icons/Textures/AudioListner.flax
index 8c8c4920d..cafe7a63e 100644
--- a/Content/Editor/Icons/Textures/AudioListner.flax
+++ b/Content/Editor/Icons/Textures/AudioListner.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:6eeba8388149269d67ab06fd52eb8e8e1411f187393b6160f20750d565e12f32
-size 22576
+oid sha256:71244c864e5f1ca5232a5800ecb36379fad9bc75d3e0fb735a6105accf274fb0
+size 88362
diff --git a/Content/Editor/Icons/Textures/AudioSource.flax b/Content/Editor/Icons/Textures/AudioSource.flax
index 059b900c8..a630a1052 100644
--- a/Content/Editor/Icons/Textures/AudioSource.flax
+++ b/Content/Editor/Icons/Textures/AudioSource.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:84afd860b8ebcaf166846220f275ea16bb69729ec5abfdf07fa9985e355539fe
-size 22575
+oid sha256:0ba27db325a9d3c33f7b030b61730d03cca1727ed2477122a1a60de5578c1d22
+size 88361
diff --git a/Content/Editor/Icons/Textures/Decal.flax b/Content/Editor/Icons/Textures/Decal.flax
index 73b661465..8e1028b54 100644
--- a/Content/Editor/Icons/Textures/Decal.flax
+++ b/Content/Editor/Icons/Textures/Decal.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:22a3d53ddc4792fa4cf127da5d6a3e4d8a95757cb51fa04d7cb6b5abae2a643c
-size 22569
+oid sha256:c6d258e04be1835c8164e93289bd496dd9b9bdb2cc9f7633db6b9929f08575ed
+size 88355
diff --git a/Content/Editor/Icons/Textures/DirectionalLight.flax b/Content/Editor/Icons/Textures/DirectionalLight.flax
index 1e4b650c4..6a26009d3 100644
--- a/Content/Editor/Icons/Textures/DirectionalLight.flax
+++ b/Content/Editor/Icons/Textures/DirectionalLight.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:0d16e0df628d13c72aef9f214c9459536832b9c8c21293444a6fb0f75d40a411
-size 22251
+oid sha256:742bd2c5755db7672e8a1fe27f1db013ebe885f495956b4406226f25c0c49536
+size 88366
diff --git a/Content/Editor/Icons/Textures/EnvironmentProbe.flax b/Content/Editor/Icons/Textures/EnvironmentProbe.flax
index dfd69645f..d3c6b136a 100644
--- a/Content/Editor/Icons/Textures/EnvironmentProbe.flax
+++ b/Content/Editor/Icons/Textures/EnvironmentProbe.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2386df0b9a39ab819f166f5a48c0d859f2f3aaeb1c98451565446fd9f35f70c4
-size 22251
+oid sha256:d9c4e7a93cb5548253270063226452cedc6648edd95b0227a4146cee5013eae2
+size 88366
diff --git a/Content/Editor/Icons/Textures/ParticleEffect.flax b/Content/Editor/Icons/Textures/ParticleEffect.flax
index fa4788651..7a6211e39 100644
--- a/Content/Editor/Icons/Textures/ParticleEffect.flax
+++ b/Content/Editor/Icons/Textures/ParticleEffect.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:eced258052ad7aad0abcdb1abc7a811087b9688688eb0923d01b62277111e319
-size 22633
+oid sha256:ad12b06bd7e64460f43442e8700d5f7862c1dd522e5e7335b21bd8fef1b7f1c1
+size 88364
diff --git a/Content/Editor/Icons/Textures/PointLight.flax b/Content/Editor/Icons/Textures/PointLight.flax
index 5bc463f7c..caa8a09f6 100644
--- a/Content/Editor/Icons/Textures/PointLight.flax
+++ b/Content/Editor/Icons/Textures/PointLight.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:205c29a130708367cfd920c02dad1ff5ce029bca2e4ba8b846ee924db6ed5ce8
-size 22245
+oid sha256:ccf4443326fc4efa30acce040684f620b1ec55b2e22081184b28abb7e4a5a45e
+size 88360
diff --git a/Content/Editor/Icons/Textures/SceneAnimationPlayer.flax b/Content/Editor/Icons/Textures/SceneAnimationPlayer.flax
index 498aa4a2c..2f20de087 100644
--- a/Content/Editor/Icons/Textures/SceneAnimationPlayer.flax
+++ b/Content/Editor/Icons/Textures/SceneAnimationPlayer.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:42a79e33f6237ff570ec799cf21859bde252280120a460d117a46c64e171f131
-size 22639
+oid sha256:419fd82bce8ffbb155ddcb5bd7387279571283555b212b374a18d95be88d5c62
+size 88370
diff --git a/Content/Editor/Icons/Textures/SkyLight.flax b/Content/Editor/Icons/Textures/SkyLight.flax
index 9e557e37a..caa94f5b1 100644
--- a/Content/Editor/Icons/Textures/SkyLight.flax
+++ b/Content/Editor/Icons/Textures/SkyLight.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:821d8878412cdaebf1472f7a8afc8f081dd4bf7818c3824d6d02d18c474e4355
-size 22243
+oid sha256:3c5d5f9ec5a3e9bff677b18b420ac8cc83aeeee778033471aa6677092c1e9f6d
+size 88358
diff --git a/Content/Editor/Icons/Textures/Skybox.flax b/Content/Editor/Icons/Textures/Skybox.flax
index c252d2fbf..ec3060c98 100644
--- a/Content/Editor/Icons/Textures/Skybox.flax
+++ b/Content/Editor/Icons/Textures/Skybox.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:54e8d8520f6d1e6dea5c4596309700358d97692fefbfea68ff76a058f4161e32
-size 22241
+oid sha256:2ebe5c47347d28484a4cbc0eca7f727bc93a3f9e90b781b72bc34bb44046fe75
+size 88356
diff --git a/Content/Shaders/GI/GlobalSurfaceAtlas.flax b/Content/Shaders/GI/GlobalSurfaceAtlas.flax
index baf00844c..5f8f33c5c 100644
--- a/Content/Shaders/GI/GlobalSurfaceAtlas.flax
+++ b/Content/Shaders/GI/GlobalSurfaceAtlas.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3e56bf2cd056460a987fb98529e9a78ffa0bd7326ad9cae82145aa169c2dae4f
-size 12952
+oid sha256:eab4a83e97b445fa657ad96dcfaaa87845055027a8b2db42795c8ed4311271be
+size 12612
diff --git a/Content/Shaders/VolumetricFog.flax b/Content/Shaders/VolumetricFog.flax
index f4990d1cc..0e780413c 100644
--- a/Content/Shaders/VolumetricFog.flax
+++ b/Content/Shaders/VolumetricFog.flax
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1a3f3207746368c6d516d51e1053c08cbd4beea71703fa540b4229aa836cff14
-size 14255
+oid sha256:6a2dbc9352900c45d20d80af203f34bae5b6ace3e3ff85305c068a9849f5ccbb
+size 13841
diff --git a/Source/Editor/Utilities/ViewportIconsRenderer.cpp b/Source/Editor/Utilities/ViewportIconsRenderer.cpp
index 8b8e0d74f..72533d6dc 100644
--- a/Source/Editor/Utilities/ViewportIconsRenderer.cpp
+++ b/Source/Editor/Utilities/ViewportIconsRenderer.cpp
@@ -29,6 +29,7 @@ enum class IconTypes
DirectionalLight,
EnvironmentProbe,
Skybox,
+ SkyLight,
AudioListener,
AudioSource,
Decal,
@@ -155,6 +156,7 @@ bool ViewportIconsRendererService::Init()
INIT(DirectionalLight, "Editor/Icons/DirectionalLight");
INIT(EnvironmentProbe, "Editor/Icons/EnvironmentProbe");
INIT(Skybox, "Editor/Icons/Skybox");
+ INIT(SkyLight, "Editor/Icons/SkyLight");
INIT(AudioListener, "Editor/Icons/AudioListener");
INIT(AudioSource, "Editor/Icons/AudioSource");
INIT(Decal, "Editor/Icons/Decal");
@@ -173,7 +175,7 @@ bool ViewportIconsRendererService::Init()
MAP_TYPE(SceneAnimationPlayer, SceneAnimationPlayer);
MAP_TYPE(ExponentialHeightFog, Skybox);
MAP_TYPE(Sky, Skybox);
- MAP_TYPE(SkyLight, PointLight);
+ MAP_TYPE(SkyLight, SkyLight);
MAP_TYPE(SpotLight, PointLight);
#undef MAP_TYPE
diff --git a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
index fdd685439..f6fa47c61 100644
--- a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
+++ b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
@@ -198,6 +198,7 @@ namespace FlaxEditor.Viewport.Previews
// Preview LOD
{
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
+ previewLOD.CloseMenuOnClick = false;
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
{
Parent = previewLOD
diff --git a/Source/Editor/Viewport/Previews/ModelBasePreview.cs b/Source/Editor/Viewport/Previews/ModelBasePreview.cs
index 445cc0250..388cf8a41 100644
--- a/Source/Editor/Viewport/Previews/ModelBasePreview.cs
+++ b/Source/Editor/Viewport/Previews/ModelBasePreview.cs
@@ -62,6 +62,7 @@ namespace FlaxEditor.Viewport.Previews
// Preview LOD
{
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
+ previewLOD.CloseMenuOnClick = false;
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
{
Parent = previewLOD
diff --git a/Source/Editor/Viewport/Previews/ModelPreview.cs b/Source/Editor/Viewport/Previews/ModelPreview.cs
index 59dbbecb4..4b0439572 100644
--- a/Source/Editor/Viewport/Previews/ModelPreview.cs
+++ b/Source/Editor/Viewport/Previews/ModelPreview.cs
@@ -201,6 +201,7 @@ namespace FlaxEditor.Viewport.Previews
// Preview LOD
{
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
+ previewLOD.CloseMenuOnClick = false;
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
{
Parent = previewLOD
diff --git a/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs b/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs
index c1289509e..e59016856 100644
--- a/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs
+++ b/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs
@@ -67,6 +67,7 @@ namespace FlaxEditor.Viewport.Previews
if (useWidgets)
{
var playbackDuration = ViewWidgetButtonMenu.AddButton("Duration");
+ playbackDuration.CloseMenuOnClick = false;
var playbackDurationValue = new FloatValueBox(_playbackDuration, 90, 2, 70.0f, 0.1f, 1000000.0f, 0.1f)
{
Parent = playbackDuration
diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs
index 1cc0f049d..ec1cc4cc8 100644
--- a/Source/Editor/Windows/ContentWindow.cs
+++ b/Source/Editor/Windows/ContentWindow.cs
@@ -204,6 +204,7 @@ namespace FlaxEditor.Windows
showFileExtensionsButton.AutoCheck = true;
var viewScale = menu.AddButton("View Scale");
+ viewScale.CloseMenuOnClick = false;
var scaleValue = new FloatValueBox(1, 75, 2, 50.0f, 0.3f, 3.0f, 0.01f)
{
Parent = viewScale
diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs
index 23558c396..c800692f7 100644
--- a/Source/Editor/Windows/GameWindow.cs
+++ b/Source/Editor/Windows/GameWindow.cs
@@ -353,6 +353,7 @@ namespace FlaxEditor.Windows
// Viewport Brightness
{
var brightness = menu.AddButton("Viewport Brightness");
+ brightness.CloseMenuOnClick = false;
var brightnessValue = new FloatValueBox(_viewport.Brightness, 140, 2, 50.0f, 0.001f, 10.0f, 0.001f)
{
Parent = brightness
@@ -363,6 +364,7 @@ namespace FlaxEditor.Windows
// Viewport Resolution
{
var resolution = menu.AddButton("Viewport Resolution");
+ resolution.CloseMenuOnClick = false;
var resolutionValue = new FloatValueBox(_viewport.ResolutionScale, 140, 2, 50.0f, 0.1f, 4.0f, 0.001f)
{
Parent = resolution
@@ -381,6 +383,7 @@ namespace FlaxEditor.Windows
// Show GUI
{
var button = menu.AddButton("Show GUI");
+ button.CloseMenuOnClick = false;
var checkbox = new CheckBox(140, 2, ShowGUI) { Parent = button };
checkbox.StateChanged += x => ShowGUI = x.Checked;
}
@@ -388,6 +391,7 @@ namespace FlaxEditor.Windows
// Show Debug Draw
{
var button = menu.AddButton("Show Debug Draw");
+ button.CloseMenuOnClick = false;
var checkbox = new CheckBox(140, 2, ShowDebugDraw) { Parent = button };
checkbox.StateChanged += x => ShowDebugDraw = x.Checked;
}
diff --git a/Source/Engine/Content/Assets/Material.cpp b/Source/Engine/Content/Assets/Material.cpp
index f6de35df7..7dd338633 100644
--- a/Source/Engine/Content/Assets/Material.cpp
+++ b/Source/Engine/Content/Assets/Material.cpp
@@ -126,7 +126,7 @@ Asset::LoadResult Material::load()
FlaxChunk* materialParamsChunk;
// Wait for the GPU Device to be ready (eg. case when loading material before GPU init)
-#define IS_GPU_NOT_READY() (GPUDevice::Instance == nullptr || GPUDevice::Instance->GetState() != GPUDevice::DeviceState::Ready || GPUDevice::Instance->QuadShader == nullptr)
+#define IS_GPU_NOT_READY() (GPUDevice::Instance == nullptr || GPUDevice::Instance->GetState() != GPUDevice::DeviceState::Ready)
if (!IsInMainThread() && IS_GPU_NOT_READY())
{
int32 timeout = 1000;
diff --git a/Source/Engine/Core/ObjectsRemovalService.cpp b/Source/Engine/Core/ObjectsRemovalService.cpp
index f3ef498ef..7d79a9523 100644
--- a/Source/Engine/Core/ObjectsRemovalService.cpp
+++ b/Source/Engine/Core/ObjectsRemovalService.cpp
@@ -22,11 +22,10 @@ namespace ObjectsRemovalServiceImpl
using namespace ObjectsRemovalServiceImpl;
-class ObjectsRemovalServiceService : public EngineService
+class ObjectsRemoval : public EngineService
{
public:
-
- ObjectsRemovalServiceService()
+ ObjectsRemoval()
: EngineService(TEXT("Objects Removal Service"), -1000)
{
}
@@ -36,7 +35,7 @@ public:
void Dispose() override;
};
-ObjectsRemovalServiceService ObjectsRemovalServiceServiceInstance;
+ObjectsRemoval ObjectsRemovalInstance;
bool ObjectsRemovalService::IsInPool(Object* obj)
{
@@ -63,7 +62,6 @@ bool ObjectsRemovalService::HasNewItemsForFlush()
NewItemsLocker.Lock();
const bool result = NewItemsPool.HasItems();
NewItemsLocker.Unlock();
-
return result;
}
@@ -95,6 +93,8 @@ void ObjectsRemovalService::Add(Object* obj, float timeToLive, bool useGameTime)
void ObjectsRemovalService::Flush(float dt, float gameDelta)
{
+ PROFILE_CPU();
+
// Add new items
{
ScopeLock lock(NewItemsLocker);
@@ -173,14 +173,14 @@ void ObjectsRemovalService::Flush(float dt, float gameDelta)
}
}
-bool ObjectsRemovalServiceService::Init()
+bool ObjectsRemoval::Init()
{
LastUpdate = DateTime::NowUTC();
LastUpdateGameTime = 0;
return false;
}
-void ObjectsRemovalServiceService::LateUpdate()
+void ObjectsRemoval::LateUpdate()
{
PROFILE_CPU();
@@ -194,7 +194,7 @@ void ObjectsRemovalServiceService::LateUpdate()
LastUpdate = now;
}
-void ObjectsRemovalServiceService::Dispose()
+void ObjectsRemoval::Dispose()
{
// Collect new objects
ObjectsRemovalService::Flush();
diff --git a/Source/Engine/Core/ObjectsRemovalService.h b/Source/Engine/Core/ObjectsRemovalService.h
index 92a5bd1af..e9120a6dd 100644
--- a/Source/Engine/Core/ObjectsRemovalService.h
+++ b/Source/Engine/Core/ObjectsRemovalService.h
@@ -10,7 +10,6 @@
class FLAXENGINE_API ObjectsRemovalService
{
public:
-
///
/// Determines whether object has been registered in the pool for the removing.
///
diff --git a/Source/Engine/Level/Actor.cs b/Source/Engine/Level/Actor.cs
index cd774fca6..76e95810f 100644
--- a/Source/Engine/Level/Actor.cs
+++ b/Source/Engine/Level/Actor.cs
@@ -125,7 +125,7 @@ namespace FlaxEngine
{
if (type.IsAbstract)
return null;
-
+
var result = (Actor)New(type);
result.SetParent(this, false, false);
return result;
@@ -180,7 +180,7 @@ namespace FlaxEngine
{
if (typeof(T).IsAbstract)
return null;
-
+
result = New();
result.SetParent(this, false, false);
}
@@ -196,7 +196,7 @@ namespace FlaxEngine
{
if (type.IsAbstract)
return null;
-
+
var script = (Script)New(type);
script.Parent = this;
return script;
@@ -211,7 +211,7 @@ namespace FlaxEngine
{
if (typeof(T).IsAbstract)
return null;
-
+
var script = New();
script.Parent = this;
return script;
diff --git a/Source/Engine/Streaming/Streaming.cpp b/Source/Engine/Streaming/Streaming.cpp
index d11724fe8..f9866f111 100644
--- a/Source/Engine/Streaming/Streaming.cpp
+++ b/Source/Engine/Streaming/Streaming.cpp
@@ -320,7 +320,7 @@ GPUSampler* Streaming::GetTextureGroupSampler(int32 index)
{
FallbackSampler = GPUSampler::New();
#if GPU_ENABLE_RESOURCE_NAMING
- sampler->SetName(TEXT("FallbackSampler"));
+ FallbackSampler->SetName(TEXT("FallbackSampler"));
#endif
FallbackSampler->Init(GPUSamplerDescription::New(GPUSamplerFilter::Trilinear));
}
diff --git a/Source/Engine/Tests/TestScripting.cpp b/Source/Engine/Tests/TestScripting.cpp
new file mode 100644
index 000000000..ecea80db7
--- /dev/null
+++ b/Source/Engine/Tests/TestScripting.cpp
@@ -0,0 +1,40 @@
+// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+
+#include "TestScripting.h"
+#include "Engine/Scripting/Scripting.h"
+#include
+
+TestClassNative::TestClassNative(const SpawnParams& params)
+ : ScriptingObject(params)
+{
+}
+
+TEST_CASE("Scripting")
+{
+ SECTION("Test Class")
+ {
+ // Test native class
+ ScriptingTypeHandle type = Scripting::FindScriptingType("FlaxEngine.TestClassNative");
+ CHECK(type == TestClassNative::TypeInitializer);
+ ScriptingObject* object = Scripting::NewObject(type.GetType().ManagedClass);
+ CHECK(object);
+ CHECK(object->Is());
+ TestClassNative* testClass = (TestClassNative*)object;
+ CHECK(testClass->SimpleField == 1);
+ int32 methodResult = testClass->Test(TEXT("123"));
+ CHECK(methodResult == 3);
+
+ // Test managed class
+ type = Scripting::FindScriptingType("FlaxEngine.TestClassManaged");
+ CHECK(type);
+ object = Scripting::NewObject(type.GetType().ManagedClass);
+ CHECK(object);
+ CHECK(object->Is());
+ testClass = (TestClassNative*)object;
+ MObject* managed = testClass->GetOrCreateManagedInstance(); // Ensure to create C# object and run it's ctor
+ CHECK(managed);
+ CHECK(testClass->SimpleField == 2);
+ methodResult = testClass->Test(TEXT("123"));
+ CHECK(methodResult == 6);
+ }
+}
diff --git a/Source/Engine/Tests/TestScripting.cs b/Source/Engine/Tests/TestScripting.cs
new file mode 100644
index 000000000..6abc667a1
--- /dev/null
+++ b/Source/Engine/Tests/TestScripting.cs
@@ -0,0 +1,23 @@
+// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+
+#if FLAX_TESTS
+namespace FlaxEngine
+{
+ ///
+ /// Test class.
+ ///
+ public class TestClassManaged : TestClassNative
+ {
+ TestClassManaged()
+ {
+ SimpleField = 2;
+ }
+
+ ///
+ public override int Test(string str)
+ {
+ return str.Length + base.Test(str);
+ }
+ }
+}
+#endif
diff --git a/Source/Engine/Tests/TestScripting.h b/Source/Engine/Tests/TestScripting.h
new file mode 100644
index 000000000..06b5dddb5
--- /dev/null
+++ b/Source/Engine/Tests/TestScripting.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+
+#pragma once
+
+#include "Engine/Core/ISerializable.h"
+#include "Engine/Scripting/ScriptingObject.h"
+
+// Test class.
+API_CLASS() class TestClassNative : public ScriptingObject, public ISerializable
+{
+ API_AUTO_SERIALIZATION();
+ DECLARE_SCRIPTING_TYPE(TestClassNative);
+
+public:
+ // Test value
+ API_FIELD() int32 SimpleField = 1;
+
+ // Test virtual method
+ API_FUNCTION() virtual int32 Test(const String& str)
+ {
+ return str.Length();
+ }
+};
diff --git a/Source/FlaxTests.Build.cs b/Source/FlaxTests.Build.cs
index 1c02439f7..06bc06d23 100644
--- a/Source/FlaxTests.Build.cs
+++ b/Source/FlaxTests.Build.cs
@@ -45,6 +45,8 @@ public class FlaxTestsTarget : FlaxEditor
{
base.SetupTargetEnvironment(options);
+ options.ScriptingAPI.Defines.Add("FLAX_TESTS");
+
// Produce console program
options.LinkEnv.LinkAsConsoleProgram = true;
}
diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs
index 8636e0bab..5a62096c3 100644
--- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs
+++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs
@@ -1360,7 +1360,8 @@ namespace Flax.Build.Bindings
thunkCall += GenerateCppWrapperNativeToBox(buildData, parameterInfo.Type, classInfo, parameterInfo.Name);
}
- if (functionInfo.ReturnType.IsVoid)
+ var returnType = functionInfo.ReturnType;
+ if (returnType.IsVoid)
{
contents.AppendLine($" typedef void (*Thunk)(void* instance{thunkParams}, MonoObject** exception);");
contents.AppendLine(" const auto thunk = (Thunk)method->GetThunk();");
@@ -1378,18 +1379,30 @@ namespace Flax.Build.Bindings
contents.AppendLine(" if (exception)");
contents.AppendLine(" DebugLog::LogException(exception);");
- if (!functionInfo.ReturnType.IsVoid)
+ if (!returnType.IsVoid)
{
- if (functionInfo.ReturnType.IsRef)
+ if (returnType.IsRef)
throw new NotSupportedException($"Passing return value by reference is not supported for virtual API methods. Used on method '{functionInfo}'.");
- switch (functionInfo.ReturnType.Type)
+ switch (returnType.Type)
{
case "bool":
- contents.AppendLine($" return __result != 0;");
+ contents.AppendLine(" return __result != 0;");
+ break;
+ case "int8":
+ case "int16":
+ case "int32":
+ case "int64":
+ contents.AppendLine($" return ({returnType.Type})(intptr)__result;");
+ break;
+ case "uint8":
+ case "uint16":
+ case "uint32":
+ case "uint64":
+ contents.AppendLine($" return ({returnType.Type})(uintptr)__result;");
break;
default:
- contents.AppendLine($" return MUtils::Unbox<{functionInfo.ReturnType}>(__result);");
+ contents.AppendLine($" return MUtils::Unbox<{returnType}>(__result);");
break;
}
}
diff --git a/Source/Tools/Flax.Build/Platforms/UWP/UWPPlatform.cs b/Source/Tools/Flax.Build/Platforms/UWP/UWPPlatform.cs
index 3eb2ed123..165a2f6fe 100644
--- a/Source/Tools/Flax.Build/Platforms/UWP/UWPPlatform.cs
+++ b/Source/Tools/Flax.Build/Platforms/UWP/UWPPlatform.cs
@@ -28,7 +28,7 @@ namespace Flax.Build.Platforms
}
// Visual Studio 2017+ supported only
- var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019);
+ var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
if (visualStudio == null)
_hasRequiredSDKsInstalled = false;
@@ -43,9 +43,7 @@ namespace Flax.Build.Platforms
if (!toolsets.ContainsKey(WindowsPlatformToolset.v141) &&
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
!toolsets.ContainsKey(WindowsPlatformToolset.v143))
- {
_hasRequiredSDKsInstalled = false;
- }
}
///
diff --git a/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs b/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs
index 3a5c63c90..c6690d678 100644
--- a/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs
+++ b/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs
@@ -29,7 +29,7 @@ namespace Flax.Build.Platforms
public UWPToolchain(UWPPlatform platform, TargetArchitecture architecture, WindowsPlatformToolset toolsetVer = WindowsPlatformToolset.Latest, WindowsPlatformSDK sdkVer = WindowsPlatformSDK.Latest)
: base(platform, architecture, toolsetVer, sdkVer)
{
- var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019);
+ var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
if (visualStudio == null)
throw new Exception("Missing Visual Studio 2017 or newer. It's required to build for UWP.");
_usingDirs.Add(Path.Combine(visualStudio.Path, "VC", "vcpackages"));
@@ -45,6 +45,14 @@ namespace Flax.Build.Platforms
_usingDirs.Add(Path.Combine(sdk10, "UnionMetadata", sdk10Ver));
}
+ ///
+ public override void LogInfo()
+ {
+ base.LogInfo();
+
+ Log.Error("UWP (Windows Store) platform has been deprecated and soon will be removed!");
+ }
+
///
protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List args)
{