From 6c32e4a842cb804014d6a79f1f674474edfd6bef Mon Sep 17 00:00:00 2001 From: nothingTVatYT Date: Sat, 18 Nov 2023 05:34:34 +0100 Subject: [PATCH 01/30] force DeepClone() to use runtime class --- Source/Engine/Utilities/Extensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Utilities/Extensions.cs b/Source/Engine/Utilities/Extensions.cs index f8376699a..a1834624e 100644 --- a/Source/Engine/Utilities/Extensions.cs +++ b/Source/Engine/Utilities/Extensions.cs @@ -27,7 +27,7 @@ namespace FlaxEngine.Utilities where T : new() { var json = Json.JsonSerializer.Serialize(instance); - return Json.JsonSerializer.Deserialize(json); + return (T)Json.JsonSerializer.Deserialize(json, instance.GetType()); } /// From 8bcb984180701874f18e9bd41b0cc0ae0aa76f0f Mon Sep 17 00:00:00 2001 From: ExMatics HydrogenC <33123710+HydrogenC@users.noreply.github.com> Date: Sun, 19 Nov 2023 17:02:07 +0800 Subject: [PATCH 02/30] Implement SetNodeTransform --- Source/Engine/Level/Actors/AnimatedModel.cpp | 21 ++++++++++++++++++++ Source/Engine/Level/Actors/AnimatedModel.h | 16 +++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index 88f7e6876..6c67620ae 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -172,6 +172,27 @@ void AnimatedModel::GetNodeTransformation(const StringView& nodeName, Matrix& no GetNodeTransformation(SkinnedModel ? SkinnedModel->FindNode(nodeName) : -1, nodeTransformation, worldSpace); } +void AnimatedModel::SetNodeTransformation(int32 nodeIndex, const Matrix& nodeTransformation, bool worldSpace) +{ + if (GraphInstance.NodesPose.IsEmpty()) + const_cast(this)->PreInitSkinningData(); // Ensure to have valid nodes pose to return + CHECK(nodeIndex >= 0 && nodeIndex < GraphInstance.NodesPose.Count()); + GraphInstance.NodesPose[nodeIndex] = nodeTransformation; + if (worldSpace) + { + Matrix world; + _transform.GetWorld(world); + Matrix invWorld; + Matrix::Invert(world, invWorld); + GraphInstance.NodesPose[nodeIndex] = GraphInstance.NodesPose[nodeIndex] * invWorld; + } + OnAnimationUpdated(); +} +void AnimatedModel::SetNodeTransformation(const StringView& nodeName, const Matrix& nodeTransformation, bool worldSpace) +{ + SetNodeTransformation(SkinnedModel ? SkinnedModel->FindNode(nodeName) : -1, nodeTransformation, worldSpace); +} + int32 AnimatedModel::FindClosestNode(const Vector3& location, bool worldSpace) const { if (GraphInstance.NodesPose.IsEmpty()) diff --git a/Source/Engine/Level/Actors/AnimatedModel.h b/Source/Engine/Level/Actors/AnimatedModel.h index 0c5c4d73b..3a4575bce 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.h +++ b/Source/Engine/Level/Actors/AnimatedModel.h @@ -229,6 +229,22 @@ public: /// True if convert matrices into world-space, otherwise returned values will be in local-space of the actor. API_FUNCTION() void GetNodeTransformation(const StringView& nodeName, API_PARAM(Out) Matrix& nodeTransformation, bool worldSpace = false) const; + /// + /// Gets the node final transformation. + /// + /// The index of the skinned model skeleton node. + /// The final node transformation matrix. + /// True if convert matrices from world-space, otherwise values will be in local-space of the actor. + API_FUNCTION() void SetNodeTransformation(int32 nodeIndex, const Matrix& nodeTransformation, bool worldSpace = false); + + /// + /// Gets the node final transformation. + /// + /// The name of the skinned model skeleton node. + /// The final node transformation matrix. + /// True if convert matrices from world-space, otherwise values will be in local-space of the actor. + API_FUNCTION() void SetNodeTransformation(const StringView& nodeName, const Matrix& nodeTransformation, bool worldSpace = false); + /// /// Finds the closest node to a given location. /// From ddcb792767fe198a2ffa194e926ff721a0626ba7 Mon Sep 17 00:00:00 2001 From: ExMatics HydrogenC <33123710+HydrogenC@users.noreply.github.com> Date: Sun, 19 Nov 2023 17:07:42 +0800 Subject: [PATCH 03/30] Improve documentation --- Source/Engine/Level/Actors/AnimatedModel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Level/Actors/AnimatedModel.h b/Source/Engine/Level/Actors/AnimatedModel.h index 3a4575bce..029e17b62 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.h +++ b/Source/Engine/Level/Actors/AnimatedModel.h @@ -230,7 +230,7 @@ public: API_FUNCTION() void GetNodeTransformation(const StringView& nodeName, API_PARAM(Out) Matrix& nodeTransformation, bool worldSpace = false) const; /// - /// Gets the node final transformation. + /// Sets the node final transformation. If multiple nodes are to be set within a frame, do not use set worldSpace to true, and do the conversion yourself to avoid recalculation of inv matrices. /// /// The index of the skinned model skeleton node. /// The final node transformation matrix. @@ -238,7 +238,7 @@ public: API_FUNCTION() void SetNodeTransformation(int32 nodeIndex, const Matrix& nodeTransformation, bool worldSpace = false); /// - /// Gets the node final transformation. + /// Sets the node final transformation. If multiple nodes are to be set within a frame, do not use set worldSpace to true, and do the conversion yourself to avoid recalculation of inv matrices. /// /// The name of the skinned model skeleton node. /// The final node transformation matrix. From b14d88f8f8d06c95a19a44b80cfaef33b06f4b02 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 20 Nov 2023 07:31:16 -0600 Subject: [PATCH 04/30] Add git submodule init to git cloning. --- Source/Editor/Windows/PluginsWindow.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/Editor/Windows/PluginsWindow.cs b/Source/Editor/Windows/PluginsWindow.cs index 268c22581..372505795 100644 --- a/Source/Editor/Windows/PluginsWindow.cs +++ b/Source/Editor/Windows/PluginsWindow.cs @@ -391,6 +391,25 @@ namespace FlaxEditor.Windows } Editor.Log("Plugin project has been cloned."); + + try + { + // Start git submodule clone + var settings = new CreateProcessSettings + { + FileName = "git", + WorkingDirectory = clonePath, + Arguments = "submodule update --init", + ShellExecute = false, + LogOutput = true, + }; + Platform.CreateProcess(ref settings); + } + catch (Exception e) + { + Editor.LogError($"Failed Git submodule process. {e}"); + return; + } // Find project config file. Could be different then what the user named the folder. var files = Directory.GetFiles(clonePath); From 9a091799fc143f141ba30fa87655968796fafde4 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 00:00:43 +0100 Subject: [PATCH 05/30] Fix crash when debugging BT node state while tree is not running --- Source/Engine/AI/Behavior.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Engine/AI/Behavior.cpp b/Source/Engine/AI/Behavior.cpp index a5b24fc8b..ab853e2a3 100644 --- a/Source/Engine/AI/Behavior.cpp +++ b/Source/Engine/AI/Behavior.cpp @@ -170,7 +170,11 @@ void Behavior::OnDisable() bool Behavior::GetNodeDebugRelevancy(const BehaviorTreeNode* node, const Behavior* behavior) { - return node && behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex); + return node && + behavior && + node->_executionIndex >= 0 && + node->_executionIndex < behavior->_knowledge.RelevantNodes.Count() && + behavior->_knowledge.RelevantNodes.Get(node->_executionIndex); } String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavior) @@ -179,7 +183,7 @@ String Behavior::GetNodeDebugInfo(const BehaviorTreeNode* node, Behavior* behavi return String::Empty; BehaviorUpdateContext context; Platform::MemoryClear(&context, sizeof(context)); - if (behavior && node->_executionIndex != -1 && behavior->_knowledge.RelevantNodes.Get(node->_executionIndex)) + if (GetNodeDebugRelevancy(node, behavior)) { // Pass behavior and knowledge data only for relevant nodes to properly access it context.Behavior = behavior; From 4e37aafe6a5612dd8ac5ae0e235d06f6848ad6fd Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 00:01:46 +0100 Subject: [PATCH 06/30] Fix BT logic flow when start/stopping behavior --- Source/Engine/AI/Behavior.cpp | 8 +++++++- Source/Engine/AI/BehaviorKnowledge.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Engine/AI/Behavior.cpp b/Source/Engine/AI/Behavior.cpp index ab853e2a3..98fb9ba22 100644 --- a/Source/Engine/AI/Behavior.cpp +++ b/Source/Engine/AI/Behavior.cpp @@ -114,14 +114,19 @@ void Behavior::UpdateAsync() void Behavior::StartLogic() { + if (_result == BehaviorUpdateResult::Running) + return; PROFILE_CPU(); - // Ensure to have tree loaded on begin play + // Ensure to have tree loaded on play CHECK(Tree && !Tree->WaitForLoaded()); BehaviorTree* tree = Tree.Get(); CHECK(tree->Graph.Root); + // Setup state _result = BehaviorUpdateResult::Running; + _accumulatedTime = 0.0f; + _totalTime = 0; // Init knowledge _knowledge.InitMemory(tree); @@ -135,6 +140,7 @@ void Behavior::StopLogic(BehaviorUpdateResult result) _accumulatedTime = 0.0f; _totalTime = 0; _result = result; + _knowledge.FreeMemory(); } void Behavior::ResetLogic() diff --git a/Source/Engine/AI/BehaviorKnowledge.cpp b/Source/Engine/AI/BehaviorKnowledge.cpp index ffc011818..a73a1cfd4 100644 --- a/Source/Engine/AI/BehaviorKnowledge.cpp +++ b/Source/Engine/AI/BehaviorKnowledge.cpp @@ -83,7 +83,7 @@ bool AccessVariant(Variant& instance, const StringAnsiView& member, Variant& val } } #endif - else + else if (typeName.HasChars()) { LOG(Warning, "Missing scripting type \'{0}\'", String(typeName)); } From ea81ac6a7152af436ec7785c775fb04b0a1385f2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 11:10:05 +0100 Subject: [PATCH 07/30] Fix crash in Multi Blend 2D node in Anim Graph when using single animation on a triangle --- Source/Engine/Animations/Graph/AnimGroup.Animation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index 5cceb31e3..6f0d7661b 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -1342,7 +1342,12 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu { const bool xAxis = Math::IsZero(v0.X) && Math::IsZero(v1.X); const bool yAxis = Math::IsZero(v0.Y) && Math::IsZero(v1.Y); - if (xAxis || yAxis) + if (xAxis && yAxis) + { + // Single animation + value = SampleAnimation(node, loop, data.Length, startTimePos, bucket.TimePosition, newTimePos, aAnim, aData.W); + } + else if (xAxis || yAxis) { if (yAxis) { From 0db259e300b8204130a1fe891d8e07cc6f01abde Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 12:24:55 +0100 Subject: [PATCH 08/30] Add `CustomScenes` feature to draw a fixed set of scenes within `SceneRenderTask` --- Source/Engine/Graphics/RenderTask.cpp | 23 +++++++++++++++++++---- Source/Engine/Graphics/RenderTask.h | 15 +++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Source/Engine/Graphics/RenderTask.cpp b/Source/Engine/Graphics/RenderTask.cpp index 48e89f59e..8a10a0444 100644 --- a/Source/Engine/Graphics/RenderTask.cpp +++ b/Source/Engine/Graphics/RenderTask.cpp @@ -8,11 +8,12 @@ #include "Engine/Core/Collections/Sorting.h" #include "Engine/Debug/DebugLog.h" #include "Engine/Level/Level.h" +#include "Engine/Level/Scene/Scene.h" #include "Engine/Level/Actors/Camera.h" +#include "Engine/Level/Actors/PostFxVolume.h" #include "Engine/Renderer/Renderer.h" #include "Engine/Render2D/Render2D.h" #include "Engine/Engine/Engine.h" -#include "Engine/Level/Actors/PostFxVolume.h" #include "Engine/Profiler/Profiler.h" #include "Engine/Renderer/RenderList.h" #include "Engine/Threading/Threading.h" @@ -202,15 +203,21 @@ void SceneRenderTask::CollectPostFxVolumes(RenderContext& renderContext) { Level::CollectPostFxVolumes(renderContext); } - if (EnumHasAllFlags(ActorsSource , ActorsSources::CustomActors)) + if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomActors)) { for (Actor* a : CustomActors) { auto* postFxVolume = dynamic_cast(a); if (postFxVolume && a->GetIsActive()) - { postFxVolume->Collect(renderContext); - } + } + } + if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomScenes)) + { + for (Scene* scene : CustomScenes) + { + if (scene && scene->IsActiveInHierarchy()) + scene->Rendering.CollectPostFxVolumes(renderContext); } } } @@ -282,6 +289,14 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContextBatch& renderContextBatch, ASSERT_LOW_LAYER(_customActorsScene); _customActorsScene->Draw(renderContextBatch, (SceneRendering::DrawCategory)category); } + if (EnumHasAllFlags(ActorsSource, ActorsSources::CustomScenes)) + { + for (Scene* scene : CustomScenes) + { + if (scene && scene->IsActiveInHierarchy()) + scene->Rendering.Draw(renderContextBatch, (SceneRendering::DrawCategory)category); + } + } if (EnumHasAllFlags(ActorsSource, ActorsSources::Scenes)) { Level::DrawActors(renderContextBatch, category); diff --git a/Source/Engine/Graphics/RenderTask.h b/Source/Engine/Graphics/RenderTask.h index 9123751bc..864d95214 100644 --- a/Source/Engine/Graphics/RenderTask.h +++ b/Source/Engine/Graphics/RenderTask.h @@ -21,6 +21,7 @@ class PostProcessEffect; struct RenderContext; class Camera; class Actor; +class Scene; /// /// Allows to perform custom rendering using graphics pipeline. @@ -174,6 +175,11 @@ API_ENUM(Attributes="Flags") enum class ActorsSources /// CustomActors = 2, + /// + /// The scenes from the custom collection. + /// + CustomScenes = 4, + /// /// The actors from the loaded scenes and custom collection. /// @@ -267,9 +273,14 @@ public: public: /// - /// The custom set of actors to render. + /// The custom set of actors to render. Used when ActorsSources::CustomActors flag is active. /// - Array CustomActors; + API_FIELD() Array CustomActors; + + /// + /// The custom set of scenes to render. Used when ActorsSources::CustomScenes flag is active. + /// + API_FIELD() Array CustomScenes; /// /// Adds the custom actor to the rendering. From d01990e3bb77bd7ee6158912f5883a2c2961f3f1 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 12:34:06 +0100 Subject: [PATCH 09/30] Fix deadlock in editor when using snap to the group with actor that has empty bounds #1971 --- Source/Editor/Gizmo/TransformGizmo.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Gizmo/TransformGizmo.cs b/Source/Editor/Gizmo/TransformGizmo.cs index ef7558b8d..4a3fa39ba 100644 --- a/Source/Editor/Gizmo/TransformGizmo.cs +++ b/Source/Editor/Gizmo/TransformGizmo.cs @@ -111,7 +111,8 @@ namespace FlaxEditor.Gizmo if (isSelected) { GetSelectedObjectsBounds(out var selectionBounds, out _); - ray.Position = ray.GetPoint(selectionBounds.Size.Y * 0.5f); + var offset = Mathf.Max(selectionBounds.Size.Y * 0.5f, 1.0f); + ray.Position = ray.GetPoint(offset); continue; } From eba4b9bcc13a3a6307838fa7431af398d96f6140 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 21 Nov 2023 12:34:31 +0100 Subject: [PATCH 10/30] Add immediate game viewport sync after aspect ratio change in Editor --- Source/Editor/Windows/GameWindow.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index 8c6f5dc06..4a8c11176 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -386,6 +386,7 @@ namespace FlaxEditor.Windows { _viewport.Bounds = new Rectangle(Width * (1 - scaleWidth) / 2, 0, Width * scaleWidth, Height); } + _viewport.SyncBackbufferSize(); PerformLayout(); } From 5b7a3f97004cb3e7215ac87c7ddaf460cac57663 Mon Sep 17 00:00:00 2001 From: ExMatics HydrogenC <33123710+HydrogenC@users.noreply.github.com> Date: Wed, 22 Nov 2023 21:52:07 +0800 Subject: [PATCH 11/30] Show skeleton when entering skeleton tab --- .../Editor/Windows/Assets/SkinnedModelWindow.cs | 15 ++++++++++++++- Source/Engine/Level/Actors/AnimatedModel.cpp | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs index ccfd5233c..95827240c 100644 --- a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs +++ b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs @@ -371,7 +371,10 @@ namespace FlaxEditor.Windows.Assets private void OnTreeSelectedChanged(List before, List after) { if (after.Count != 0) - ((SkeletonPropertiesProxy)Values[0]).Window._preview.ShowDebugDraw = true; + { + var proxy = (SkeletonPropertiesProxy)Values[0]; + proxy.Window._preview.ShowDebugDraw = true; + } } private void OnTreeNodeCopyName(ContextMenuButton b) @@ -1045,6 +1048,7 @@ namespace FlaxEditor.Windows.Assets { Proxy = new SkeletonPropertiesProxy(); Presenter.Select(Proxy); + // Draw highlight on selected node window._preview.CustomDebugDraw += OnDebugDraw; } @@ -1146,6 +1150,15 @@ namespace FlaxEditor.Windows.Assets _tabs.AddTab(new RetargetTab(this)); _tabs.AddTab(new ImportTab(this)); + // Automatically show nodes when switching to skeleton page + _tabs.SelectedTabChanged += (tabs) => + { + if (tabs.SelectedTab is SkeletonTab) + { + _preview.ShowNodes = true; + } + }; + // Highlight actor (used to highlight selected material slot, see UpdateEffectsOnAsset) _highlightActor = new AnimatedModel { diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index 6c67620ae..c1b5af398 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -188,6 +188,7 @@ void AnimatedModel::SetNodeTransformation(int32 nodeIndex, const Matrix& nodeTra } OnAnimationUpdated(); } + void AnimatedModel::SetNodeTransformation(const StringView& nodeName, const Matrix& nodeTransformation, bool worldSpace) { SetNodeTransformation(SkinnedModel ? SkinnedModel->FindNode(nodeName) : -1, nodeTransformation, worldSpace); From d99a92fd134e95a71f2e307bdbe08f67cfabdbb1 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 23 Nov 2023 13:46:43 +0100 Subject: [PATCH 12/30] Fix generic types including to be recursive in C++ bindings codegen #1966 --- .../Bindings/BindingsGenerator.Cpp.cs | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 991ff196b..63cf9d2f8 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -145,6 +145,20 @@ namespace Flax.Build.Bindings return $"(void*){result}"; } + + private static void GenerateCppAddFileReference(BuildData buildData, ApiTypeInfo caller, TypeInfo typeInfo, ApiTypeInfo apiType) + { + CppReferencesFiles.Add(apiType?.File); + if (typeInfo.GenericArgs != null) + { + for (int i = 0; i < typeInfo.GenericArgs.Count; i++) + { + var g = typeInfo.GenericArgs[i]; + GenerateCppAddFileReference(buildData, caller, g, FindApiTypeInfo(buildData, g, caller)); + } + } + } + public static string GenerateCppWrapperNativeToVariant(BuildData buildData, TypeInfo typeInfo, ApiTypeInfo caller, string value) { if (typeInfo.Type == "Variant") @@ -640,15 +654,7 @@ namespace Flax.Build.Bindings // Register any API types usage apiType = FindApiTypeInfo(buildData, typeInfo, caller); - CppReferencesFiles.Add(apiType?.File); - if (typeInfo.GenericArgs != null) - { - for (int i = 0; i < typeInfo.GenericArgs.Count; i++) - { - var t = FindApiTypeInfo(buildData, typeInfo.GenericArgs[i], caller); - CppReferencesFiles.Add(t?.File); - } - } + GenerateCppAddFileReference(buildData, caller, typeInfo, apiType); // Use dynamic array as wrapper container for fixed-size native arrays if (typeInfo.IsArray) @@ -1795,15 +1801,7 @@ namespace Flax.Build.Bindings return true; // Add includes to properly compile bindings (eg. SoftObjectReference) - CppReferencesFiles.Add(apiTypeInfo?.File); - if (typeInfo.GenericArgs != null) - { - for (int i = 0; i < typeInfo.GenericArgs.Count; i++) - { - var t = FindApiTypeInfo(buildData, typeInfo.GenericArgs[i], caller); - CppReferencesFiles.Add(t?.File); - } - } + GenerateCppAddFileReference(buildData, caller, typeInfo, apiTypeInfo); return false; } From d5075d845c674183cb00e61045e1e4d35f237096 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 23 Nov 2023 17:37:55 +0100 Subject: [PATCH 13/30] Fix content storage usage with relative paths #1966 --- Source/Engine/Content/BinaryAsset.cpp | 30 ++++++++++++------- Source/Engine/Content/Content.cpp | 9 +++--- .../Content/Storage/ContentStorageManager.cpp | 11 +++++++ .../Content/Storage/ContentStorageManager.h | 3 ++ 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Source/Engine/Content/BinaryAsset.cpp b/Source/Engine/Content/BinaryAsset.cpp index b04603a96..9519f73df 100644 --- a/Source/Engine/Content/BinaryAsset.cpp +++ b/Source/Engine/Content/BinaryAsset.cpp @@ -323,26 +323,29 @@ bool BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool { // Ensure path is in a valid format String pathNorm(path); - FileSystem::NormalizePath(pathNorm); + ContentStorageManager::FormatPath(pathNorm); + const StringView filePath = pathNorm; // Find target storage container and the asset - auto storage = ContentStorageManager::TryGetStorage(pathNorm); - auto asset = Content::GetAsset(pathNorm); + auto storage = ContentStorageManager::TryGetStorage(filePath); + auto asset = Content::GetAsset(filePath); auto binaryAsset = dynamic_cast(asset); if (asset && !binaryAsset) { LOG(Warning, "Cannot write to the non-binary asset location."); return true; } + if (!binaryAsset && !storage && FileSystem::FileExists(filePath)) + { + // Force-resolve storage (asset at that path could be not yet loaded into registry) + storage = ContentStorageManager::GetStorage(filePath); + } // Check if can perform write operation to the asset container - if (storage) + if (storage && !storage->AllowDataModifications()) { - if (!storage->AllowDataModifications()) - { - LOG(Warning, "Cannot write to the asset storage container."); - return true; - } + LOG(Warning, "Cannot write to the asset storage container."); + return true; } // Initialize data container @@ -352,6 +355,11 @@ bool BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool // Use the same asset ID data.Header.ID = binaryAsset->GetID(); } + else if (storage && storage->GetEntriesCount()) + { + // Use the same file ID + data.Header.ID = storage->GetEntry(0).ID; + } else { // Randomize ID @@ -373,8 +381,8 @@ bool BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool } else { - ASSERT(pathNorm.HasChars()); - result = FlaxStorage::Create(pathNorm, data, silentMode); + ASSERT(filePath.HasChars()); + result = FlaxStorage::Create(filePath, data, silentMode); } if (binaryAsset) binaryAsset->_isSaving = false; diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index bd27abc5a..910e16d66 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -449,18 +449,19 @@ Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& typ { // Ensure path is in a valid format String pathNorm(path); - StringUtils::PathRemoveRelativeParts(pathNorm); + ContentStorageManager::FormatPath(pathNorm); + const StringView filePath = pathNorm; #if USE_EDITOR - if (!FileSystem::FileExists(pathNorm)) + if (!FileSystem::FileExists(filePath)) { - LOG(Error, "Missing file \'{0}\'", pathNorm); + LOG(Error, "Missing file \'{0}\'", filePath); return nullptr; } #endif AssetInfo assetInfo; - if (GetAssetInfo(pathNorm, assetInfo)) + if (GetAssetInfo(filePath, assetInfo)) { return LoadAsync(assetInfo.ID, type); } diff --git a/Source/Engine/Content/Storage/ContentStorageManager.cpp b/Source/Engine/Content/Storage/ContentStorageManager.cpp index d3e18e9d0..61e73a3f2 100644 --- a/Source/Engine/Content/Storage/ContentStorageManager.cpp +++ b/Source/Engine/Content/Storage/ContentStorageManager.cpp @@ -6,6 +6,7 @@ #include "Engine/Core/Log.h" #include "Engine/Engine/Engine.h" #include "Engine/Engine/EngineService.h" +#include "Engine/Engine/Globals.h" #include "Engine/Platform/FileSystem.h" #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Threading/TaskGraph.h" @@ -185,6 +186,16 @@ void ContentStorageManager::EnsureUnlocked() Locker.Unlock(); } +void ContentStorageManager::FormatPath(String& path) +{ + StringUtils::PathRemoveRelativeParts(path); + if (FileSystem::IsRelative(path)) + { + // Convert local-project paths into absolute format which is used by Content Storage system + path = Globals::ProjectFolder / path; + } +} + bool ContentStorageManager::IsFlaxStoragePath(const String& path) { auto extension = FileSystem::GetExtension(path).ToLower(); diff --git a/Source/Engine/Content/Storage/ContentStorageManager.h b/Source/Engine/Content/Storage/ContentStorageManager.h index c615632e9..84a6dc07e 100644 --- a/Source/Engine/Content/Storage/ContentStorageManager.h +++ b/Source/Engine/Content/Storage/ContentStorageManager.h @@ -75,6 +75,9 @@ public: /// static void EnsureUnlocked(); + // Formats path into valid format used by the storage system (normalized and absolute). + static void FormatPath(String& path); + public: /// /// Determines whether the specified path can be a binary asset file (based on it's extension). From 6cf7d49a10985ec6039e97213ab15e5c61c3e27b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 23 Nov 2023 17:54:50 +0100 Subject: [PATCH 14/30] Fix crash during asset loading due to potential threading issue when 2 threads load the same asset #1930 --- Source/Engine/Content/Content.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 910e16d66..6970fc6d7 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -54,8 +54,7 @@ namespace // Assets CriticalSection AssetsLocker; Dictionary Assets(2048); - CriticalSection LoadCallAssetsLocker; - Array LoadCallAssets(64); + Array LoadCallAssets(PLATFORM_THREADS_LIMIT); CriticalSection LoadedAssetsToInvokeLocker; Array LoadedAssetsToInvoke(64); Array ToUnload; @@ -924,29 +923,29 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) } // Check if that asset is during loading - LoadCallAssetsLocker.Lock(); + AssetsLocker.Lock(); if (LoadCallAssets.Contains(id)) { - LoadCallAssetsLocker.Unlock(); + AssetsLocker.Unlock(); - // Wait for load end - // TODO: dont use active waiting and prevent deadlocks if running on a main thread - //while (!Engine::ShouldExit()) + // Wait for loading end by other thread while (true) { - LoadCallAssetsLocker.Lock(); - const bool contains = LoadCallAssets.Contains(id); - LoadCallAssetsLocker.Unlock(); - if (!contains) - return GetAsset(id); Platform::Sleep(1); + result = nullptr; + AssetsLocker.Lock(); + if (!LoadCallAssets.Contains(id)) + Assets.TryGet(id, result); + AssetsLocker.Unlock(); + if (result) + return result; } } else { // Mark asset as loading LoadCallAssets.Add(id); - LoadCallAssetsLocker.Unlock(); + AssetsLocker.Unlock(); } // Load asset @@ -954,9 +953,9 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) result = load(id, type, assetInfo); // End loading - LoadCallAssetsLocker.Lock(); + AssetsLocker.Lock(); LoadCallAssets.Remove(id); - LoadCallAssetsLocker.Unlock(); + AssetsLocker.Unlock(); return result; } From 359d4ba8efe5efd0e1cb7fd17f61094df988c63c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 10:25:21 +0100 Subject: [PATCH 15/30] More refactoring to 6cf7d49a10985ec6039e97213ab15e5c61c3e27b for better assets loading #1930 --- Source/Engine/Content/Content.cpp | 67 ++++++++++++++----------------- Source/Engine/Content/Content.h | 1 - 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 6970fc6d7..47a465bf0 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -910,9 +910,13 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) return nullptr; // Check if asset has been already loaded - Asset* result = GetAsset(id); + Asset* result = nullptr; + AssetsLocker.Lock(); + Assets.TryGet(id, result); if (result) { + AssetsLocker.Unlock(); + // Validate type if (IsAssetTypeIdInvalid(type, result->GetTypeHandle()) && !result->Is(type)) { @@ -923,57 +927,39 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) } // Check if that asset is during loading - AssetsLocker.Lock(); if (LoadCallAssets.Contains(id)) { AssetsLocker.Unlock(); // Wait for loading end by other thread - while (true) + bool contains = true; + while (contains) { Platform::Sleep(1); - result = nullptr; AssetsLocker.Lock(); - if (!LoadCallAssets.Contains(id)) - Assets.TryGet(id, result); + contains = LoadCallAssets.Contains(id); AssetsLocker.Unlock(); - if (result) - return result; } - } - else - { - // Mark asset as loading - LoadCallAssets.Add(id); - AssetsLocker.Unlock(); + Assets.TryGet(id, result); + return result; } - // Load asset - AssetInfo assetInfo; - result = load(id, type, assetInfo); - - // End loading - AssetsLocker.Lock(); - LoadCallAssets.Remove(id); + // Mark asset as loading and release lock so other threads can load other assets + LoadCallAssets.Add(id); AssetsLocker.Unlock(); - return result; -} - -Asset* Content::load(const Guid& id, const ScriptingTypeHandle& type, AssetInfo& assetInfo) -{ // Get cached asset info (from registry) + AssetInfo assetInfo; if (!GetAssetInfo(id, assetInfo)) { LOG(Warning, "Invalid or missing asset ({0}, {1}).", id, type.ToString()); - return nullptr; + goto LOAD_FAILED; } - #if ASSETS_LOADING_EXTRA_VERIFICATION if (!FileSystem::FileExists(assetInfo.Path)) { LOG(Error, "Cannot find file '{0}'", assetInfo.Path); - return nullptr; + goto LOAD_FAILED; } #endif @@ -982,28 +968,27 @@ Asset* Content::load(const Guid& id, const ScriptingTypeHandle& type, AssetInfo& if (factory == nullptr) { LOG(Error, "Cannot find asset factory. Info: {0}", assetInfo.ToString()); - return nullptr; + goto LOAD_FAILED; } // Create asset object - auto result = factory->New(assetInfo); + result = factory->New(assetInfo); if (result == nullptr) { LOG(Error, "Cannot create asset object. Info: {0}", assetInfo.ToString()); - return nullptr; + goto LOAD_FAILED; } - + ASSERT(result->GetID() == id); #if ASSETS_LOADING_EXTRA_VERIFICATION if (IsAssetTypeIdInvalid(type, result->GetTypeHandle()) && !result->Is(type)) { - LOG(Error, "Different loaded asset type! Asset: '{0}'. Expected type: {1}", assetInfo.ToString(), type.ToString()); + LOG(Warning, "Different loaded asset type! Asset: '{0}'. Expected type: {1}", assetInfo.ToString(), type.ToString()); result->DeleteObject(); - return nullptr; + goto LOAD_FAILED; } #endif // Register asset - ASSERT(result->GetID() == id); AssetsLocker.Lock(); #if ASSETS_LOADING_EXTRA_VERIFICATION ASSERT(!Assets.ContainsKey(id)); @@ -1011,12 +996,20 @@ Asset* Content::load(const Guid& id, const ScriptingTypeHandle& type, AssetInfo& Assets.Add(id, result); // Start asset loading - // TODO: refactor this to create asset loading task-chain before AssetsLocker.Lock() to allow better parallelization result->startLoading(); + // Remove from the loading queue and release lock + LoadCallAssets.Remove(id); AssetsLocker.Unlock(); return result; + +LOAD_FAILED: + // Remove from loading queue + AssetsLocker.Lock(); + LoadCallAssets.Remove(id); + AssetsLocker.Unlock(); + return nullptr; } #if ENABLE_ASSETS_DISCOVERY diff --git a/Source/Engine/Content/Content.h b/Source/Engine/Content/Content.h index 6393ce48b..cce57194c 100644 --- a/Source/Engine/Content/Content.h +++ b/Source/Engine/Content/Content.h @@ -366,7 +366,6 @@ private: static void onAssetLoaded(Asset* asset); static void onAssetUnload(Asset* asset); static void onAssetChangeId(Asset* asset, const Guid& oldId, const Guid& newId); - static Asset* load(const Guid& id, const ScriptingTypeHandle& type, AssetInfo& assetInfo); private: static void deleteFileSafety(const StringView& path, const Guid& id); From aa1b779463cc297d822aa81581703dfaea4ab0d7 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 10:25:46 +0100 Subject: [PATCH 16/30] Fix `Win32CriticalSection` to use spin count of `4000` instead of just `100` #1930 --- Source/Engine/Platform/Win32/Win32CriticalSection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Win32/Win32CriticalSection.h b/Source/Engine/Platform/Win32/Win32CriticalSection.h index 95d85efac..97221626c 100644 --- a/Source/Engine/Platform/Win32/Win32CriticalSection.h +++ b/Source/Engine/Platform/Win32/Win32CriticalSection.h @@ -28,7 +28,7 @@ public: /// Win32CriticalSection() { - Windows::InitializeCriticalSectionEx(&_criticalSection, 100, 0x01000000); + Windows::InitializeCriticalSectionEx(&_criticalSection, 4000, 0x01000000); } /// From f61f35b259757b425f2c4b0817d42d2ad88bbabf Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 10:53:07 +0100 Subject: [PATCH 17/30] Fix compilation regression --- Source/Engine/Content/Content.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 47a465bf0..982ae599f 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -948,18 +948,20 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) LoadCallAssets.Add(id); AssetsLocker.Unlock(); +#define LOAD_FAILED() AssetsLocker.Lock(); LoadCallAssets.Remove(id); AssetsLocker.Unlock(); return nullptr + // Get cached asset info (from registry) AssetInfo assetInfo; if (!GetAssetInfo(id, assetInfo)) { LOG(Warning, "Invalid or missing asset ({0}, {1}).", id, type.ToString()); - goto LOAD_FAILED; + LOAD_FAILED(); } #if ASSETS_LOADING_EXTRA_VERIFICATION if (!FileSystem::FileExists(assetInfo.Path)) { LOG(Error, "Cannot find file '{0}'", assetInfo.Path); - goto LOAD_FAILED; + LOAD_FAILED(); } #endif @@ -968,7 +970,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) if (factory == nullptr) { LOG(Error, "Cannot find asset factory. Info: {0}", assetInfo.ToString()); - goto LOAD_FAILED; + LOAD_FAILED(); } // Create asset object @@ -976,7 +978,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) if (result == nullptr) { LOG(Error, "Cannot create asset object. Info: {0}", assetInfo.ToString()); - goto LOAD_FAILED; + LOAD_FAILED(); } ASSERT(result->GetID() == id); #if ASSETS_LOADING_EXTRA_VERIFICATION @@ -984,7 +986,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) { LOG(Warning, "Different loaded asset type! Asset: '{0}'. Expected type: {1}", assetInfo.ToString(), type.ToString()); result->DeleteObject(); - goto LOAD_FAILED; + LOAD_FAILED(); } #endif @@ -1002,14 +1004,9 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type) LoadCallAssets.Remove(id); AssetsLocker.Unlock(); - return result; +#undef LOAD_FAILED -LOAD_FAILED: - // Remove from loading queue - AssetsLocker.Lock(); - LoadCallAssets.Remove(id); - AssetsLocker.Unlock(); - return nullptr; + return result; } #if ENABLE_ASSETS_DISCOVERY From d0f7a04c589be00a817a730c29b113e4f20d9f29 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 14:59:07 +0100 Subject: [PATCH 18/30] Add support for getter-only properties in blackboard selector access --- .../CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs | 4 +++- Source/Editor/CustomEditors/Editors/GenericEditor.cs | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs b/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs index 8ac6a51cb..b3c5792ac 100644 --- a/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs +++ b/Source/Editor/CustomEditors/Editors/BehaviorKnowledgeSelectorEditor.cs @@ -171,11 +171,13 @@ namespace FlaxEditor.CustomEditors.Editors tree.Select(typeNode); if (addItems) { - var items = GenericEditor.GetItemsForType(type, type.IsClass, true); + var items = GenericEditor.GetItemsForType(type, type.IsClass, true, true); foreach (var item in items) { if (typed && !typed.IsAssignableFrom(item.Info.ValueType)) continue; + if (item.Info.DeclaringType.Type == typeof(FlaxEngine.Object)) + continue; // Skip engine internals var itemPath = typePath + item.Info.Name; var node = new TreeNode { diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index 55ac453a9..68c24a675 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -247,8 +247,9 @@ namespace FlaxEditor.CustomEditors.Editors /// The type. /// True if use type properties. /// True if use type fields. + /// True if use type properties that have only getter method without setter method (aka read-only). /// The items. - public static List GetItemsForType(ScriptType type, bool useProperties, bool useFields) + public static List GetItemsForType(ScriptType type, bool useProperties, bool useFields, bool usePropertiesWithoutSetter = false) { var items = new List(); @@ -264,7 +265,7 @@ namespace FlaxEditor.CustomEditors.Editors var showInEditor = attributes.Any(x => x is ShowInEditorAttribute); // Skip properties without getter or setter - if (!p.HasGet || (!p.HasSet && !showInEditor)) + if (!p.HasGet || (!p.HasSet && !showInEditor && !usePropertiesWithoutSetter)) continue; // Skip hidden fields, handle special attributes From 49bc7d3dcc90b0148efc1476946974f427463a38 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 14:59:25 +0100 Subject: [PATCH 19/30] Fix BehaviorTree node UI after adding decorator that was already there --- Source/Editor/Surface/Archetypes/BehaviorTree.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Editor/Surface/Archetypes/BehaviorTree.cs b/Source/Editor/Surface/Archetypes/BehaviorTree.cs index bfc5bfad8..f8cd7bb5a 100644 --- a/Source/Editor/Surface/Archetypes/BehaviorTree.cs +++ b/Source/Editor/Surface/Archetypes/BehaviorTree.cs @@ -288,6 +288,9 @@ namespace FlaxEditor.Surface.Archetypes } } SetValue(2, ids); + + // Force refresh UI + ResizeAuto(); } } From 40d8d3b972664068176861859d5bf87353bf9c17 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 17:54:44 +0100 Subject: [PATCH 20/30] Update build number --- Flax.flaxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flax.flaxproj b/Flax.flaxproj index b3de36d70..81a63a1fc 100644 --- a/Flax.flaxproj +++ b/Flax.flaxproj @@ -3,8 +3,8 @@ "Version": { "Major": 1, "Minor": 7, - "Revision": 0, - "Build": 6405 + "Revision": 1, + "Build": 6406 }, "Company": "Flax", "Copyright": "Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.", From 2cef36828228f3d46e95dfb32ffda6f726fc801b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 24 Nov 2023 21:45:59 +0100 Subject: [PATCH 21/30] Update missing unmanaged function callback error message --- Source/Engine/Scripting/Runtime/DotNet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Scripting/Runtime/DotNet.cpp b/Source/Engine/Scripting/Runtime/DotNet.cpp index 976c992ea..3c90eb4d1 100644 --- a/Source/Engine/Scripting/Runtime/DotNet.cpp +++ b/Source/Engine/Scripting/Runtime/DotNet.cpp @@ -1808,7 +1808,7 @@ void* GetStaticMethodPointer(const String& methodName) PROFILE_CPU(); const int rc = get_function_pointer(NativeInteropTypeName, FLAX_CORECLR_STRING(methodName).Get(), UNMANAGEDCALLERSONLY_METHOD, nullptr, nullptr, &fun); if (rc != 0) - LOG(Fatal, "Failed to get unmanaged function pointer for method {0}: 0x{1:x}", methodName.Get(), (unsigned int)rc); + LOG(Fatal, "Failed to get unmanaged function pointer for method '{0}': 0x{1:x}", methodName, (unsigned int)rc); CachedFunctions.Add(methodName, fun); return fun; } @@ -2207,7 +2207,7 @@ void* GetStaticMethodPointer(const String& methodName) { const unsigned short errorCode = mono_error_get_error_code(&error); const char* errorMessage = mono_error_get_message(&error); - LOG(Fatal, "mono_method_get_unmanaged_callers_only_ftnptr failed with error code 0x{0:x}, {1}", errorCode, String(errorMessage)); + LOG(Fatal, "Failed to get unmanaged function pointer for method '{0}': 0x{1:x}, {2}", methodName, errorCode, String(errorMessage)); } mono_error_cleanup(&error); From 40d6e18e7e48f374784123a63d724077709fa318 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 12:16:13 +0100 Subject: [PATCH 22/30] Add `-dotnet=ver` command arg to `Flax.Build` to specify .NET SDK version to use for build --- Source/ThirdParty/nethost/nethost.Build.cs | 2 +- .../Flax.Build/Build/DotNet/Builder.DotNet.cs | 2 +- .../Flax.Build/Build/DotNet/DotNetSdk.cs | 78 ++++++++++++++++--- Source/Tools/Flax.Build/Configuration.cs | 14 ++++ Source/Tools/Flax.Build/Deploy/FlaxBuild.cs | 3 +- .../VisualStudio/VCProjectGenerator.cs | 3 +- .../VisualStudioProjectGenerator.cs | 3 +- .../VisualStudioCodeProjectGenerator.cs | 6 ++ 8 files changed, 91 insertions(+), 20 deletions(-) diff --git a/Source/ThirdParty/nethost/nethost.Build.cs b/Source/ThirdParty/nethost/nethost.Build.cs index 8b355d765..75a8a3ab6 100644 --- a/Source/ThirdParty/nethost/nethost.Build.cs +++ b/Source/ThirdParty/nethost/nethost.Build.cs @@ -32,7 +32,7 @@ public class nethost : ThirdPartyModule // Get .NET SDK runtime host var dotnetSdk = DotNetSdk.Instance; if (!dotnetSdk.IsValid) - throw new Exception($"Missing NET SDK {DotNetSdk.MinimumVersion}."); + throw new DotNetSdk.MissingException(); if (!dotnetSdk.GetHostRuntime(options.Platform.Target, options.Architecture, out var hostRuntime)) { if (options.Target.IsPreBuilt) diff --git a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs index 6e9fbea83..c8e709d86 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs @@ -164,7 +164,7 @@ namespace Flax.Build #if USE_NETCORE var dotnetSdk = DotNetSdk.Instance; if (!dotnetSdk.IsValid) - throw new Exception("Cannot compile C# without .NET SDK"); + throw new DotNetSdk.MissingException(); string dotnetPath = "dotnet", referenceAnalyzers; string[] runtimeVersionNameParts = dotnetSdk.RuntimeVersionName.Split('.'); string runtimeVersionShort = runtimeVersionNameParts[0] + '.' + runtimeVersionNameParts[1]; diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index 8eea4d6dd..e7506d363 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -106,6 +106,20 @@ namespace Flax.Build } } + /// + /// Exception when .NET SDK is missing. + /// + public sealed class MissingException : Exception + { + /// + /// Init with a proper message. + /// + public MissingException() + : base(string.IsNullOrEmpty(Configuration.Dotnet) ? $"Missing .NET SDK {MinimumVersion} (or higher)." : $"Missing .NET SDK {Configuration.Dotnet}.") + { + } + } + private Dictionary, HostRuntime> _hostRuntimes = new(); /// @@ -223,7 +237,7 @@ namespace Flax.Build // We need to support two paths here: // 1. We are running an x64 binary and we are running on an arm64 host machine // 2. We are running an Arm64 binary and we are targeting an x64 host machine - if (Flax.Build.Platforms.MacPlatform.GetProcessIsTranslated() || isRunningOnArm64Targetx64) + if (Flax.Build.Platforms.MacPlatform.GetProcessIsTranslated() || isRunningOnArm64Targetx64) { rid = "osx-x64"; dotnetPath = Path.Combine(dotnetPath, "x64"); @@ -260,18 +274,23 @@ namespace Flax.Build Log.Verbose($"Found the following .NET SDK versions: {string.Join(", ", dotnetSdkVersions)}"); Log.Verbose($"Found the following .NET runtime versions: {string.Join(", ", dotnetRuntimeVersions)}"); - string dotnetSdkVersion = dotnetSdkVersions.FirstOrDefault(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major); - string dotnetRuntimeVersion = dotnetRuntimeVersions.FirstOrDefault(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major); + var dotnetSdkVersion = GetVersion(dotnetSdkVersions); + var dotnetRuntimeVersion = GetVersion(dotnetRuntimeVersions); + var minVer = string.IsNullOrEmpty(Configuration.Dotnet) ? MinimumVersion.ToString() : Configuration.Dotnet; if (string.IsNullOrEmpty(dotnetSdkVersion)) - dotnetSdkVersion = dotnetPath; - if (dotnetSdkVersion == null && dotnetSdkVersions.Count() > 0) { - Log.Warning($"Unsupported .NET SDK {dotnetSdkVersions.First()} version found. Minimum version required is .NET {MinimumVersion}."); + if (dotnetSdkVersions.Any()) + Log.Warning($"Unsupported .NET SDK versions found: {string.Join(", ", dotnetSdkVersions)}. Minimum version required is .NET {minVer}."); + else + Log.Warning($"Missing .NET SDK. Minimum version required is .NET {minVer}."); return; } - if (string.IsNullOrEmpty(dotnetSdkVersion) || string.IsNullOrEmpty(dotnetRuntimeVersion)) + if (string.IsNullOrEmpty(dotnetRuntimeVersion)) { - Log.Warning("Missing .NET SDK"); + if (dotnetRuntimeVersions.Any()) + Log.Warning($"Unsupported .NET runtime versions found: {string.Join(", ", dotnetRuntimeVersions)}. Minimum version required is .NET {minVer}."); + else + Log.Warning($"Missing .NET runtime. Minimum version required is .NET {minVer}."); return; } RootPath = dotnetPath; @@ -434,7 +453,7 @@ namespace Flax.Build exists = Directory.Exists(path); if (exists) - _hostRuntimes[new KeyValuePair(platform, arch)] = new HostRuntime(platform, path); + _hostRuntimes[new KeyValuePair(platform, arch)] = new HostRuntime(platform, Utilities.NormalizePath(path)); return exists; } @@ -456,6 +475,8 @@ namespace Flax.Build } if (!Version.TryParse(version, out var ver)) return null; + if (ver.Build == -1) + return new Version(ver.Major, ver.Minor); return new Version(ver.Major, ver.Minor, ver.Build, rev); } @@ -466,9 +487,42 @@ namespace Flax.Build private static string GetVersion(IEnumerable versions) { - return versions.OrderByDescending(ParseVersion) - .Where(x => ParseVersion(x).Major >= MinimumVersion.Major && ParseVersion(x).Major <= MaximumVersion.Major) - .FirstOrDefault(); + Version dotnetVer = null; + int dotnetVerNum = -1; + if (!string.IsNullOrEmpty(Configuration.Dotnet)) + { + dotnetVer = ParseVersion(Configuration.Dotnet); + if (int.TryParse(Configuration.Dotnet, out var tmp) && tmp >= MinimumVersion.Major) + dotnetVerNum = tmp; + } + var sorted = versions.OrderByDescending(ParseVersion); + foreach (var version in sorted) + { + var v = ParseVersion(version); + + // Filter by version specified in command line + if (dotnetVer != null) + { + if (dotnetVer.Major != v.Major) + continue; + if (dotnetVer.Minor != v.Minor) + continue; + if (dotnetVer.Revision != -1 && dotnetVer.Revision != v.Revision) + continue; + if (dotnetVer.Build != -1 && dotnetVer.Build != v.Build) + continue; + } + else if (dotnetVerNum != -1) + { + if (dotnetVerNum != v.Major) + continue; + } + + // Filter by min/max versions supported by Flax.Build + if (v.Major >= MinimumVersion.Major && v.Major <= MaximumVersion.Major) + return version; + } + return null; } private static bool IsValidVersion(string versionPath) diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs index 8ca11b007..f58ffcaf3 100644 --- a/Source/Tools/Flax.Build/Configuration.cs +++ b/Source/Tools/Flax.Build/Configuration.cs @@ -225,10 +225,24 @@ namespace Flax.Build [CommandLine("compiler", "", "Overrides the compiler to use for building. Eg. v140 overrides the toolset when building for Windows.")] public static string Compiler = null; + /// + /// Specifies the dotnet SDK version to use for the build. Eg. set to '7' to use .NET 7 even if .NET 8 is installed. + /// + [CommandLine("dotnet", "", "Specifies the dotnet SDK version to use for the build. Eg. set to '7' to use .NET 7 even if .NET 8 is installed.")] + public static string Dotnet = null; + /// /// Custom configuration defines provided via command line for the build tool. /// public static List CustomDefines = new List(); + + internal static void PassArgs(ref string cmdLine) + { + if (!string.IsNullOrEmpty(Compiler)) + cmdLine += " -compiler=" + Compiler; + if (!string.IsNullOrEmpty(Dotnet)) + cmdLine += " -dotnet=" + Dotnet; + } } /// diff --git a/Source/Tools/Flax.Build/Deploy/FlaxBuild.cs b/Source/Tools/Flax.Build/Deploy/FlaxBuild.cs index b4e8b8680..13f467ccf 100644 --- a/Source/Tools/Flax.Build/Deploy/FlaxBuild.cs +++ b/Source/Tools/Flax.Build/Deploy/FlaxBuild.cs @@ -17,8 +17,7 @@ namespace Flax.Deploy var flaxBuildTool = Path.Combine(Globals.EngineRoot, buildPlatform == TargetPlatform.Windows ? "Binaries/Tools/Flax.Build.exe" : "Binaries/Tools/Flax.Build"); var format = "-build -buildtargets={0} -log -logfile= -perf -platform={1} -arch={2} -configuration={3}"; var cmdLine = string.Format(format, target, platform, architecture, configuration); - if (!string.IsNullOrEmpty(Configuration.Compiler)) - cmdLine += " -compiler=" + Configuration.Compiler; + Configuration.PassArgs(ref cmdLine); Log.Info($"Building {target} for {platform} {architecture} {configuration}..."); int result = Utilities.Run(flaxBuildTool, cmdLine, null, root); diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 84607f6a1..4eba06cb0 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -172,8 +172,7 @@ namespace Flax.Build.Projects.VisualStudio configuration.Configuration, configuration.Platform, target.Name); - if (!string.IsNullOrEmpty(Configuration.Compiler)) - cmdLine += " -compiler=" + Configuration.Compiler; + Configuration.PassArgs(ref cmdLine); vcProjectFileContent.AppendLine(string.Format(" ", configuration.Name)); if (platform is IVisualStudioProjectCustomizer customizer) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs index eda2f7a95..b04531d9f 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs @@ -731,8 +731,7 @@ namespace Flax.Build.Projects.VisualStudio configuration.Configuration, configuration.Platform, configuration.Target); - if (!string.IsNullOrEmpty(Configuration.Compiler)) - cmdLine += " -compiler=" + Configuration.Compiler; + Configuration.PassArgs(ref cmdLine); str.AppendLine(string.Format(" ", cmdLine, extraArgs, configuration.Name)); } diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs index 5c4b2dbe0..15b236972 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs @@ -201,6 +201,8 @@ namespace Flax.Build.Projects.VisualStudioCode json.AddUnnamedField(string.Format("-buildTargets={0}", target.Name)); if (!string.IsNullOrEmpty(Configuration.Compiler)) json.AddUnnamedField(string.Format("-compiler={0}", Configuration.Compiler)); + if (!string.IsNullOrEmpty(Configuration.Dotnet)) + json.AddUnnamedField(string.Format("-dotnet={0}", Configuration.Dotnet)); } json.EndArray(); @@ -228,6 +230,8 @@ namespace Flax.Build.Projects.VisualStudioCode json.AddUnnamedField(string.Format("--buildTargets={0}", target.Name)); if (!string.IsNullOrEmpty(Configuration.Compiler)) json.AddUnnamedField(string.Format("--compiler={0}", Configuration.Compiler)); + if (!string.IsNullOrEmpty(Configuration.Dotnet)) + json.AddUnnamedField(string.Format("-dotnet={0}", Configuration.Dotnet)); } json.EndArray(); @@ -255,6 +259,8 @@ namespace Flax.Build.Projects.VisualStudioCode json.AddUnnamedField(string.Format("--buildTargets={0}", target.Name)); if (!string.IsNullOrEmpty(Configuration.Compiler)) json.AddUnnamedField(string.Format("--compiler={0}", Configuration.Compiler)); + if (!string.IsNullOrEmpty(Configuration.Dotnet)) + json.AddUnnamedField(string.Format("-dotnet={0}", Configuration.Dotnet)); } json.EndArray(); From cf155a4df40e68459d30cb93de6826effc99b1bd Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 12:20:42 +0100 Subject: [PATCH 23/30] Update build scripts to use .NET SDK 7 for engine --- .github/workflows/build_android.yml | 2 +- .github/workflows/build_ios.yml | 2 +- .github/workflows/build_linux.yml | 4 ++-- .github/workflows/build_mac.yml | 4 ++-- .github/workflows/build_windows.yml | 4 ++-- .github/workflows/tests.yml | 10 +++++----- PackageAll.bat | 2 +- PackageEditor.bat | 2 +- PackageEditor.command | 2 +- PackageEditor.sh | 2 +- PackagePlatforms.bat | 2 +- PackagePlatforms.command | 2 +- PackagePlatforms.sh | 2 +- 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 568b4f35e..b0d4633a8 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -33,4 +33,4 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=ARM64 -platform=Android -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index f4b5d8147..2aec46320 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -33,4 +33,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -dotnet=7 -arch=ARM64 -platform=iOS -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index bd1726737..56accba84 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -36,7 +36,7 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxEditor # Game game-linux: @@ -64,4 +64,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Linux -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_mac.yml b/.github/workflows/build_mac.yml index 88cb9b7a8..54bdb77b5 100644 --- a/.github/workflows/build_mac.yml +++ b/.github/workflows/build_mac.yml @@ -30,7 +30,7 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -arch=x64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Mac -configuration=Development -buildtargets=FlaxEditor # Game game-mac: @@ -55,4 +55,4 @@ jobs: git lfs pull - name: Build run: | - ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -arch=x64 -platform=Mac -configuration=Release -buildtargets=FlaxGame + ./Development/Scripts/Mac/CallBuildTool.sh -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Mac -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 513cbfd08..b6131fb53 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -30,7 +30,7 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxEditor # Game game-windows: @@ -55,4 +55,4 @@ jobs: git lfs pull - name: Build run: | - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -printSDKs -dotnet=7 -arch=x64 -platform=Windows -configuration=Release -buildtargets=FlaxGame diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f9d18bcfc..a524bdca2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,8 +34,8 @@ jobs: sudo apt-get install libx11-dev libxcursor-dev libxinerama-dev build-essential gettext libtool libtool-bin libpulse-dev libasound2-dev libjack-dev portaudio19-dev - name: Build run: | - ./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget + ./GenerateProjectFiles.sh -vs2022 -log -verbose -printSDKs -dotnet=7 + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo dotnet msbuild Source/Tools/Flax.Build.Tests/Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo - name: Test @@ -48,7 +48,7 @@ jobs: dotnet test -f net7.0 Binaries/Tests/FlaxEngine.CSharp.dll - name: Test UseLargeWorlds run: | - ./Development/Scripts/Linux/CallBuildTool.sh -build -log -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true + ./Development/Scripts/Linux/CallBuildTool.sh -build -log -dotnet=7 -arch=x64 -platform=Linux -configuration=Development -buildtargets=FlaxTestsTarget -UseLargeWorlds=true ${GITHUB_WORKSPACE}/Binaries/Editor/Linux/Development/FlaxTests # Tests on Windows @@ -72,8 +72,8 @@ jobs: git lfs pull - name: Build run: | - .\GenerateProjectFiles.bat -vs2022 -log -verbose -printSDKs - .\Development\Scripts\Windows\CallBuildTool.bat -build -log -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget + .\GenerateProjectFiles.bat -vs2022 -log -verbose -printSDKs -dotnet=7 + .\Development\Scripts\Windows\CallBuildTool.bat -build -log -dotnet=7 -arch=x64 -platform=Windows -configuration=Development -buildtargets=FlaxTestsTarget dotnet msbuild Source\Tools\Flax.Build.Tests\Flax.Build.Tests.csproj /m /t:Restore,Build /p:Configuration=Debug /p:Platform=AnyCPU /nologo - name: Test run: | diff --git a/PackageAll.bat b/PackageAll.bat index 02ab69f4d..0325f2244 100644 --- a/PackageAll.bat +++ b/PackageAll.bat @@ -7,7 +7,7 @@ pushd echo Performing the full package... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -deployPlatforms -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -deployPlatforms -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackageEditor.bat b/PackageEditor.bat index 2dc90f7f4..515b81871 100644 --- a/PackageEditor.bat +++ b/PackageEditor.bat @@ -7,7 +7,7 @@ pushd echo Building and packaging Flax Editor... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployEditor -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackageEditor.command b/PackageEditor.command index d7cc909a0..eb62ae1a4 100755 --- a/PackageEditor.command +++ b/PackageEditor.command @@ -9,4 +9,4 @@ echo Building and packaging Flax Editor... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployEditor --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployEditor --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackageEditor.sh b/PackageEditor.sh index 0584ab4e7..151147b6a 100755 --- a/PackageEditor.sh +++ b/PackageEditor.sh @@ -9,4 +9,4 @@ echo Building and packaging Flax Editor... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployEditor --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployEditor --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackagePlatforms.bat b/PackagePlatforms.bat index d8ebd0980..eb9c42d34 100644 --- a/PackagePlatforms.bat +++ b/PackagePlatforms.bat @@ -7,7 +7,7 @@ pushd echo Building and packaging platforms data... rem Run the build tool. -call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployPlatforms -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* +call "Development\Scripts\Windows\CallBuildTool.bat" -deploy -deployPlatforms -dotnet=7 -verbose -log -logFile="Cache\Intermediate\PackageLog.txt" %* if errorlevel 1 goto BuildToolFailed popd diff --git a/PackagePlatforms.command b/PackagePlatforms.command index 20847f232..e9182a627 100755 --- a/PackagePlatforms.command +++ b/PackagePlatforms.command @@ -9,4 +9,4 @@ echo Building and packaging platforms data... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployPlatforms --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Mac/CallBuildTool.sh --deploy --deployPlatforms --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" diff --git a/PackagePlatforms.sh b/PackagePlatforms.sh index 3f9a9c550..f7e43cc42 100755 --- a/PackagePlatforms.sh +++ b/PackagePlatforms.sh @@ -9,4 +9,4 @@ echo Building and packaging platforms data... cd "`dirname "$0"`" # Run Flax.Build (also pass the arguments) -bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployPlatforms --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" +bash ./Development/Scripts/Linux/CallBuildTool.sh --deploy --deployPlatforms --dotnet=7 --verbose --log --logFile="Cache/Intermediate/PackageLog.txt" "$@" From 3fc0a3dc8460520c1b0e0eb4aee0c08d5f194b9d Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 12:46:21 +0100 Subject: [PATCH 24/30] Add test debug log for broken ci build debug --- Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index e7506d363..8aabdfd1a 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -206,6 +206,10 @@ namespace Flax.Build dotnetSdkVersions = sdkVersionsKey.GetValueNames(); dotnetRuntimeVersions = runtimeKey.GetValueNames(); #pragma warning restore CA1416 + // DEBUG: + Log.Info($"[WIN] dotnetPath={dotnetPath}"); + Log.Info($"[WIN] dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); + Log.Info($"[WIN] dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); break; } case TargetPlatform.Linux: @@ -267,9 +271,17 @@ namespace Flax.Build dotnetSdkVersions = dotnetSdkVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "sdk", x))); dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App", x))); + + // DEBUG: + Log.Info($"[WIN] valid dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); + Log.Info($"[WIN] valid dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); dotnetSdkVersions = dotnetSdkVersions.OrderByDescending(ParseVersion); dotnetRuntimeVersions = dotnetRuntimeVersions.OrderByDescending(ParseVersion); + + // DEBUG: + Log.Info($"[WIN] sorted dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); + Log.Info($"[WIN] sorted dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); Log.Verbose($"Found the following .NET SDK versions: {string.Join(", ", dotnetSdkVersions)}"); Log.Verbose($"Found the following .NET runtime versions: {string.Join(", ", dotnetRuntimeVersions)}"); @@ -482,6 +494,9 @@ namespace Flax.Build private static IEnumerable GetVersions(string folder) { + Log.Info($"[WIN] GetVersions={folder}"); + foreach (var c in Directory.GetDirectories(folder).Select(Path.GetFileName)) + Log.Info($" [WIN] {c}"); return Directory.GetDirectories(folder).Select(Path.GetFileName); } From eaabd56caef5a8ca8054fff508d23f78475642ad Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 13:03:22 +0100 Subject: [PATCH 25/30] Add manual dotnet versions search on windows --- .../Flax.Build/Build/DotNet/DotNetSdk.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index 8aabdfd1a..a291451f2 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -264,10 +264,9 @@ namespace Flax.Build Log.Warning($"Missing .NET SDK ({dotnetPath})"); return; } - if (dotnetSdkVersions == null) - dotnetSdkVersions = GetVersions(Path.Combine(dotnetPath, "sdk")); - if (dotnetRuntimeVersions == null) - dotnetRuntimeVersions = GetVersions(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App")); + + dotnetSdkVersions = MergeVersions(dotnetSdkVersions, GetVersions(Path.Combine(dotnetPath, "sdk"))); + dotnetRuntimeVersions = MergeVersions(dotnetRuntimeVersions, GetVersions(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App"))); dotnetSdkVersions = dotnetSdkVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "sdk", x))); dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App", x))); @@ -476,6 +475,18 @@ namespace Flax.Build return Path.Combine(root, version); } + private static IEnumerable MergeVersions(IEnumerable a, IEnumerable b) + { + if (a == null || !a.Any()) + return b; + if (b == null || !b.Any()) + return a; + var result = new HashSet(); + result.AddRange(a); + result.AddRange(b); + return result; + } + private static Version ParseVersion(string version) { // Give precedence to final releases over release candidate / beta releases From f4f49f63bcc07a45837972a861728d201dd5b356 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 14:19:30 +0100 Subject: [PATCH 26/30] Remove debug logs from 3fc0a3dc8460520c1b0e0eb4aee0c08d5f194b9d --- Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index a291451f2..240c95c16 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -206,10 +206,6 @@ namespace Flax.Build dotnetSdkVersions = sdkVersionsKey.GetValueNames(); dotnetRuntimeVersions = runtimeKey.GetValueNames(); #pragma warning restore CA1416 - // DEBUG: - Log.Info($"[WIN] dotnetPath={dotnetPath}"); - Log.Info($"[WIN] dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); - Log.Info($"[WIN] dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); break; } case TargetPlatform.Linux: @@ -270,17 +266,9 @@ namespace Flax.Build dotnetSdkVersions = dotnetSdkVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "sdk", x))); dotnetRuntimeVersions = dotnetRuntimeVersions.Where(x => IsValidVersion(Path.Combine(dotnetPath, "shared", "Microsoft.NETCore.App", x))); - - // DEBUG: - Log.Info($"[WIN] valid dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); - Log.Info($"[WIN] valid dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); dotnetSdkVersions = dotnetSdkVersions.OrderByDescending(ParseVersion); dotnetRuntimeVersions = dotnetRuntimeVersions.OrderByDescending(ParseVersion); - - // DEBUG: - Log.Info($"[WIN] sorted dotnetSdkVersions={(dotnetSdkVersions != null ? string.Join(", ", dotnetSdkVersions) : "null")}"); - Log.Info($"[WIN] sorted dotnetRuntimeVersions={(dotnetRuntimeVersions != null ? string.Join(", ", dotnetRuntimeVersions) : "null")}"); Log.Verbose($"Found the following .NET SDK versions: {string.Join(", ", dotnetSdkVersions)}"); Log.Verbose($"Found the following .NET runtime versions: {string.Join(", ", dotnetRuntimeVersions)}"); @@ -505,9 +493,6 @@ namespace Flax.Build private static IEnumerable GetVersions(string folder) { - Log.Info($"[WIN] GetVersions={folder}"); - foreach (var c in Directory.GetDirectories(folder).Select(Path.GetFileName)) - Log.Info($" [WIN] {c}"); return Directory.GetDirectories(folder).Select(Path.GetFileName); } From 9e74f3ae2205bab33e91c2f91248c48b857817fa Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 17:54:50 +0100 Subject: [PATCH 27/30] Update engine assets --- Content/Editor/DebugMaterials/DDGIDebugProbes.flax | 4 ++-- Content/Editor/DebugMaterials/SingleColor/Particle.flax | 4 ++-- .../Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax | 4 ++-- Content/Editor/Gizmo/FoliageBrushMaterial.flax | 4 ++-- Content/Editor/Particles/Constant Burst.flax | 4 ++-- Content/Editor/Particles/Periodic Burst.flax | 4 ++-- Content/Editor/Particles/Smoke.flax | 4 ++-- Content/Editor/Particles/Sparks.flax | 4 ++-- Content/Editor/Terrain/Circle Brush Material.flax | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Content/Editor/DebugMaterials/DDGIDebugProbes.flax b/Content/Editor/DebugMaterials/DDGIDebugProbes.flax index 8e810f7d4..cc4a16fe3 100644 --- a/Content/Editor/DebugMaterials/DDGIDebugProbes.flax +++ b/Content/Editor/DebugMaterials/DDGIDebugProbes.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57066ba805fd3f21a1d48048c7d3a0ec4e4c66c5cdd1ca97553605987f43b460 -size 41028 +oid sha256:5d0dc041c6b8712c2f892ac3185c1f9e0b3608b774db5590bcaad3ad0775dc93 +size 41042 diff --git a/Content/Editor/DebugMaterials/SingleColor/Particle.flax b/Content/Editor/DebugMaterials/SingleColor/Particle.flax index 72e956e7a..e22b6c1fa 100644 --- a/Content/Editor/DebugMaterials/SingleColor/Particle.flax +++ b/Content/Editor/DebugMaterials/SingleColor/Particle.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e737c911cffc1e1ad5cad3d7d4e13e24cdba7d08da4b488bf7bb41f098cb1638 -size 31713 +oid sha256:a54c7442f97baa1ab835485f906911372847808e2865790109b0524614663210 +size 31722 diff --git a/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax b/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax index 2fffdd0eb..790690cd8 100644 --- a/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax +++ b/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7933e14f937b148d6b0c4a7fff10aa9b931f01e1bfe42ce3e5ff4575fbeeb463 -size 31873 +oid sha256:4cd7963263033f8f6e09de86da1ce14aa9baee3f1811986d56441cc62164e231 +size 31882 diff --git a/Content/Editor/Gizmo/FoliageBrushMaterial.flax b/Content/Editor/Gizmo/FoliageBrushMaterial.flax index 8eb64e89d..f1fa6e3f5 100644 --- a/Content/Editor/Gizmo/FoliageBrushMaterial.flax +++ b/Content/Editor/Gizmo/FoliageBrushMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67e5aba4c1eeb15231aef4001c7b0bb25db4243b871b1493774b1d1348310b22 -size 37868 +oid sha256:f87fe1172cc96b6aaef5653b9d7c5ef336b7f5934c620ae13661fd89b636cfcc +size 37909 diff --git a/Content/Editor/Particles/Constant Burst.flax b/Content/Editor/Particles/Constant Burst.flax index 16ca82be3..bb90199fe 100644 --- a/Content/Editor/Particles/Constant Burst.flax +++ b/Content/Editor/Particles/Constant Burst.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f6a7d30653808828c9f3ece113eb55684a330253366ff34de953085de4f9766 -size 2671 +oid sha256:fc1e46708152005dc92532e940b3ce19ec527b595fb18365b41ebdcd338ad2c4 +size 2705 diff --git a/Content/Editor/Particles/Periodic Burst.flax b/Content/Editor/Particles/Periodic Burst.flax index 80a4c306d..784d456c5 100644 --- a/Content/Editor/Particles/Periodic Burst.flax +++ b/Content/Editor/Particles/Periodic Burst.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eeedc5055dc5a8218fd229a7a433ede79ce036eaf07326a9cee5f988b9b67a06 -size 3621 +oid sha256:94bf88983e3cf9fe555141a867af3c20e5bd58d13a527a9b4e02d4d1be157be9 +size 3664 diff --git a/Content/Editor/Particles/Smoke.flax b/Content/Editor/Particles/Smoke.flax index b42c2f325..a682db6ee 100644 --- a/Content/Editor/Particles/Smoke.flax +++ b/Content/Editor/Particles/Smoke.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:334ac0d00495fc88b10839061ff0c3f45323d4f75ab6176b19005199a7324a19 -size 14569 +oid sha256:dc72b3152b85137a22b7dc72209ece02e8c2fff6674ddd395eaa4a4b089a51da +size 14662 diff --git a/Content/Editor/Particles/Sparks.flax b/Content/Editor/Particles/Sparks.flax index 7ee0ed6e9..227d9e381 100644 --- a/Content/Editor/Particles/Sparks.flax +++ b/Content/Editor/Particles/Sparks.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:87046a9bfe275cac290b4764de8a512c222ccc386d01af9026d57c3e4b7773b6 -size 13625 +oid sha256:d38b4ed6a68e0c327e7d6dda2f47c6665611c4ae9c7f8b1ba6148eb26abb205f +size 13650 diff --git a/Content/Editor/Terrain/Circle Brush Material.flax b/Content/Editor/Terrain/Circle Brush Material.flax index b014ffb1f..9b21e6c82 100644 --- a/Content/Editor/Terrain/Circle Brush Material.flax +++ b/Content/Editor/Terrain/Circle Brush Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e73a50fe4296e58eff5942855dd655ba4c2c776ee3acc0451844645dda14247 -size 27150 +oid sha256:a20f7283220500bb17c8c5afbab5a5c1bfdc03703868b8ced7da462657806fd7 +size 27409 From 71f30f18a680bb6aefe0df71ea409facbc4d66f3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 18:08:34 +0100 Subject: [PATCH 28/30] Add support for including global configs in engine configuration options --- Source/Tools/Flax.Build/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Program.cs b/Source/Tools/Flax.Build/Program.cs index d6a70de30..10ead8595 100644 --- a/Source/Tools/Flax.Build/Program.cs +++ b/Source/Tools/Flax.Build/Program.cs @@ -82,7 +82,10 @@ namespace Flax.Build { var engineProject = EngineTarget.EngineProject; if (engineProject != null && engineProject.Configuration != null && engineProject.Configuration.Count != 0) + { CommandLine.Configure(typeof(EngineConfiguration), engineProject.Configuration); + CommandLine.Configure(typeof(Configuration), engineProject.Configuration); + } CommandLine.Configure(typeof(EngineConfiguration)); } @@ -90,7 +93,6 @@ namespace Flax.Build if (Configuration.Mutex) { singleInstanceMutex = new Mutex(true, "Flax.Build", out var oneInstanceMutexCreated); - if (!oneInstanceMutexCreated) { try From 98b42d3e2e4f59471171c8e8c889df5a29bb6e09 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 18:14:21 +0100 Subject: [PATCH 29/30] Add .NET SDK version `7` as forced to be used during game cooking (compatibility with) --- Source/Editor/Cooker/CookingData.h | 7 +++++++ Source/Editor/Cooker/Steps/CompileScriptsStep.cpp | 4 ++-- Source/Editor/Cooker/Steps/DeployDataStep.cpp | 8 ++++---- Source/Editor/Cooker/Steps/PrecompileAssembliesStep.cpp | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/Editor/Cooker/CookingData.h b/Source/Editor/Cooker/CookingData.h index 51a3fcd79..1924b0c56 100644 --- a/Source/Editor/Cooker/CookingData.h +++ b/Source/Editor/Cooker/CookingData.h @@ -12,6 +12,13 @@ class GameCooker; class PlatformTools; +#if OFFICIAL_BUILD +// Use the fixed .NET SDK version in packaged builds for compatibility (FlaxGame is precompiled with it) +#define GAME_BUILD_DOTNET_VER TEXT("-dotnet=7") +#else +#define GAME_BUILD_DOTNET_VER TEXT("") +#endif + /// /// Game building options. Used as flags. /// diff --git a/Source/Editor/Cooker/Steps/CompileScriptsStep.cpp b/Source/Editor/Cooker/Steps/CompileScriptsStep.cpp index 361e5f937..befc41640 100644 --- a/Source/Editor/Cooker/Steps/CompileScriptsStep.cpp +++ b/Source/Editor/Cooker/Steps/CompileScriptsStep.cpp @@ -188,8 +188,8 @@ bool CompileScriptsStep::Perform(CookingData& data) LOG(Info, "Starting scripts compilation for game..."); const String logFile = data.CacheDirectory / TEXT("CompileLog.txt"); auto args = String::Format( - TEXT("-log -logfile=\"{4}\" -build -mutex -buildtargets={0} -platform={1} -arch={2} -configuration={3} -aotMode={5}"), - target, platform, architecture, configuration, logFile, ToString(data.Tools->UseAOT())); + TEXT("-log -logfile=\"{4}\" -build -mutex -buildtargets={0} -platform={1} -arch={2} -configuration={3} -aotMode={5} {6}"), + target, platform, architecture, configuration, logFile, ToString(data.Tools->UseAOT()), GAME_BUILD_DOTNET_VER); #if PLATFORM_WINDOWS if (data.Platform == BuildPlatform::LinuxX64) #elif PLATFORM_LINUX diff --git a/Source/Editor/Cooker/Steps/DeployDataStep.cpp b/Source/Editor/Cooker/Steps/DeployDataStep.cpp index 8306475d1..c1179c77a 100644 --- a/Source/Editor/Cooker/Steps/DeployDataStep.cpp +++ b/Source/Editor/Cooker/Steps/DeployDataStep.cpp @@ -87,7 +87,7 @@ bool DeployDataStep::Perform(CookingData& data) { // Ask Flax.Build to provide .Net SDK location for the current platform String sdks; - bool failed = ScriptsBuilder::RunBuildTool(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printSDKs"), data.CacheDirectory); + bool failed = ScriptsBuilder::RunBuildTool(String::Format(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printSDKs {}"), GAME_BUILD_DOTNET_VER), data.CacheDirectory); failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks); int32 idx = sdks.Find(TEXT("DotNetSdk, "), StringSearchCase::CaseSensitive); if (idx != -1) @@ -168,7 +168,7 @@ bool DeployDataStep::Perform(CookingData& data) String sdks; const Char *platformName, *archName; data.GetBuildPlatformName(platformName, archName); - String args = String::Format(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printDotNetRuntime -platform={} -arch={}"), platformName, archName); + String args = String::Format(TEXT("-log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printDotNetRuntime -platform={} -arch={} {}"), platformName, archName, GAME_BUILD_DOTNET_VER); bool failed = ScriptsBuilder::RunBuildTool(args, data.CacheDirectory); failed |= File::ReadAllText(data.CacheDirectory / TEXT("SDKs.txt"), sdks); Array parts; @@ -269,8 +269,8 @@ bool DeployDataStep::Perform(CookingData& data) LOG(Info, "Optimizing .NET class library size to include only used assemblies"); const String logFile = data.CacheDirectory / TEXT("StripDotnetLibs.txt"); String args = String::Format( - TEXT("-log -logfile=\"{}\" -runDotNetClassLibStripping -mutex -binaries=\"{}\""), - logFile, data.DataOutputPath); + TEXT("-log -logfile=\"{}\" -runDotNetClassLibStripping -mutex -binaries=\"{}\" {}"), + logFile, data.DataOutputPath, GAME_BUILD_DOTNET_VER); for (const String& define : data.CustomDefines) { args += TEXT(" -D"); diff --git a/Source/Editor/Cooker/Steps/PrecompileAssembliesStep.cpp b/Source/Editor/Cooker/Steps/PrecompileAssembliesStep.cpp index deb8f5022..5d566efb5 100644 --- a/Source/Editor/Cooker/Steps/PrecompileAssembliesStep.cpp +++ b/Source/Editor/Cooker/Steps/PrecompileAssembliesStep.cpp @@ -67,8 +67,8 @@ bool PrecompileAssembliesStep::Perform(CookingData& data) data.GetBuildPlatformName(platform, architecture); const String logFile = data.CacheDirectory / TEXT("AOTLog.txt"); String args = String::Format( - TEXT("-log -logfile=\"{}\" -runDotNetAOT -mutex -platform={} -arch={} -configuration={} -aotMode={} -binaries=\"{}\" -intermediate=\"{}\""), - logFile, platform, architecture, configuration, ToString(aotMode), data.DataOutputPath, data.ManagedCodeOutputPath); + TEXT("-log -logfile=\"{}\" -runDotNetAOT -mutex -platform={} -arch={} -configuration={} -aotMode={} -binaries=\"{}\" -intermediate=\"{}\" {}"), + logFile, platform, architecture, configuration, ToString(aotMode), data.DataOutputPath, data.ManagedCodeOutputPath, GAME_BUILD_DOTNET_VER); if (!buildSettings.SkipUnusedDotnetLibsPackaging) args += TEXT(" -skipUnusedDotnetLibs=false"); // Run AOT on whole class library (not just used libs) for (const String& define : data.CustomDefines) From b3a18883cab18f34b0314ec184396faa426afc51 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 25 Nov 2023 21:46:22 +0100 Subject: [PATCH 30/30] Fix iOS startup --- Source/Engine/Scripting/Scripting.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Engine/Scripting/Scripting.cs b/Source/Engine/Scripting/Scripting.cs index 6b9492f68..188333ff1 100644 --- a/Source/Engine/Scripting/Scripting.cs +++ b/Source/Engine/Scripting/Scripting.cs @@ -180,6 +180,8 @@ namespace FlaxEngine private static void OnLocalizationChanged() { + // iOS uses globalization-invariant mode so ignore it +#if !PLATFORM_IOS var currentThread = Thread.CurrentThread; var language = Localization.CurrentLanguage; if (language != null) @@ -187,6 +189,7 @@ namespace FlaxEngine var culture = Localization.CurrentCulture; if (culture != null) currentThread.CurrentCulture = culture; +#endif } ///