From 77c6daf2403dbca78762b305c1c7081560c581d4 Mon Sep 17 00:00:00 2001 From: Cristhofer Marques Date: Tue, 11 Oct 2022 13:30:49 -0300 Subject: [PATCH 1/4] fix the wrong additional layer in the matrix --- Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs index e6e2338d8..0f6996cc4 100644 --- a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs @@ -24,7 +24,7 @@ namespace FlaxEditor.CustomEditors.Dedicated public override void Initialize(LayoutElementsContainer layout) { string[] layerNames = LayersAndTagsSettings.GetCurrentLayers(); - int layersCount = Math.Max(4, layerNames.Length); + int layersCount = layerNames.Length; _checkBoxes = new List(); _layersCount = layersCount; From 187e56c6bab980d44439c2b35549e8f99cab4582 Mon Sep 17 00:00:00 2001 From: Cristhofer Marques Date: Tue, 11 Oct 2022 13:34:46 -0300 Subject: [PATCH 2/4] typo fix in graphics settings --- Source/Engine/Core/Config/GraphicsSettings.h | 2 +- Source/Engine/Renderer/ProbesRenderer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Core/Config/GraphicsSettings.h b/Source/Engine/Core/Config/GraphicsSettings.h index 891061bf5..5cb2c923c 100644 --- a/Source/Engine/Core/Config/GraphicsSettings.h +++ b/Source/Engine/Core/Config/GraphicsSettings.h @@ -73,7 +73,7 @@ public: /// If checked, Environment Probes will use HDR texture format. Improves quality in very bright scenes at cost of higher memory usage. /// API_FIELD(Attributes = "EditorOrder(1502), EditorDisplay(\"Quality\")") - bool UeeHDRProbes = false; + bool UseHDRProbes = false; /// /// If checked, enables Global SDF rendering. This can be used in materials, shaders, and particles. diff --git a/Source/Engine/Renderer/ProbesRenderer.cpp b/Source/Engine/Renderer/ProbesRenderer.cpp index 51791edd3..c1c273de8 100644 --- a/Source/Engine/Renderer/ProbesRenderer.cpp +++ b/Source/Engine/Renderer/ProbesRenderer.cpp @@ -204,7 +204,7 @@ int32 ProbesRenderer::Entry::GetResolution() const PixelFormat ProbesRenderer::Entry::GetFormat() const { - return GraphicsSettings::Get()->UeeHDRProbes ? PixelFormat::R11G11B10_Float : PixelFormat::R8G8B8A8_UNorm; + return GraphicsSettings::Get()->UseHDRProbes ? PixelFormat::R11G11B10_Float : PixelFormat::R8G8B8A8_UNorm; } int32 ProbesRenderer::GetBakeQueueSize() From 607afeee5009140fd30f7222fc6ca77c1cfb8672 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 12 Oct 2022 20:38:59 +0200 Subject: [PATCH 3/4] Add proper deserialization of old values pre-renaming #767 --- Source/Engine/Core/Config/GraphicsSettings.h | 15 +++++++++++++++ Source/Engine/Platform/SettingsBase.cs | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Core/Config/GraphicsSettings.h b/Source/Engine/Core/Config/GraphicsSettings.h index 5cb2c923c..8099e8437 100644 --- a/Source/Engine/Core/Config/GraphicsSettings.h +++ b/Source/Engine/Core/Config/GraphicsSettings.h @@ -119,6 +119,21 @@ public: API_FIELD(Attributes="EditorOrder(10000), EditorDisplay(\"Post Process Settings\", EditorDisplayAttribute.InlineStyle)") PostProcessSettings PostProcessSettings; +private: + /// + /// Renamed UeeHDRProbes into UseHDRProbes + /// [Deprecated on 12.10.2022, expires on 12.10.2024] + /// + API_PROPERTY(Attributes="Serialize, Obsolete, NoUndo") bool GetUeeHDRProbes() const + { + return UseHDRProbes; + } + + API_PROPERTY(Attributes="Serialize, Obsolete, NoUndo") void SetUeeHDRProbes(bool value) + { + UseHDRProbes = value; + } + public: /// /// Gets the instance of the settings asset (default value if missing). Object returned by this method is always loaded with valid data to use. diff --git a/Source/Engine/Platform/SettingsBase.cs b/Source/Engine/Platform/SettingsBase.cs index 505195819..ab25592a5 100644 --- a/Source/Engine/Platform/SettingsBase.cs +++ b/Source/Engine/Platform/SettingsBase.cs @@ -1,5 +1,8 @@ // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. +using System; +using FlaxEngine; + namespace FlaxEditor.Content.Settings { /// @@ -11,13 +14,24 @@ namespace FlaxEditor.Content.Settings partial class GraphicsSettings { + /// + /// Renamed UeeHDRProbes into UseHDRProbes + /// [Deprecated on 12.10.2022, expires on 12.10.2024] + /// + [Serialize, Obsolete, NoUndo] + private bool UeeHDRProbes + { + get => UseHDRProbes; + set => UseHDRProbes = value; + } + /// /// Initializes a new instance of the . /// public GraphicsSettings() { // Initialize PostFx settings with default options (C# structs don't support it) - PostProcessSettings = FlaxEngine.PostProcessSettings.Default; + PostProcessSettings = PostProcessSettings.Default; } } } From 3c9d9cd8d6d64a9717e02ddc285fc21839cf1d58 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 12 Oct 2022 20:39:40 +0200 Subject: [PATCH 4/4] Add support for deserialization of deprecated properties in scripting types --- .../Bindings/BindingsGenerator.CSharp.cs | 4 +--- .../Bindings/BindingsGenerator.Cpp.cs | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs index eaafcc615..ac22fb16a 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.CSharp.cs @@ -919,10 +919,8 @@ namespace Flax.Build.Bindings // Properties foreach (var propertyInfo in classInfo.Properties) { - if (propertyInfo.IsHidden) + if (propertyInfo.IsHidden || !useUnmanaged) continue; - if (!useUnmanaged) - throw new NotImplementedException("TODO: support properties inside non-static and non-scripting API class types."); contents.AppendLine(); GenerateCSharpComment(contents, indent, propertyInfo.Comment, true); diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index dc5190f36..921043e1d 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -1440,6 +1440,11 @@ namespace Flax.Build.Bindings continue; if (GenerateCppAutoSerializationSkip(buildData, typeInfo, propertyInfo, propertyInfo.Type)) continue; + CppAutoSerializeProperties.Add(propertyInfo); + + // Skip writing deprecated properties (read-only deserialization to allow reading old data) + if (propertyInfo.HasAttribute("Obsolete")) + continue; contents.Append(" {"); contents.Append(" const auto"); @@ -1456,7 +1461,6 @@ namespace Flax.Build.Bindings contents.Append($"stream.JKEY(\"{propertyInfo.Name}\"); Serialization::Serialize(stream, value, nullptr);"); contents.Append(" }"); contents.Append('}').AppendLine(); - CppAutoSerializeProperties.Add(propertyInfo); } } else if (structureInfo != null) @@ -1488,14 +1492,14 @@ namespace Flax.Build.Bindings foreach (var propertyInfo in CppAutoSerializeProperties) { - contents.Append(" {"); - contents.Append($" const auto e = SERIALIZE_FIND_MEMBER(stream, \"{propertyInfo.Name}\");"); - contents.Append(" if (e != stream.MemberEnd()) {"); - contents.Append($" auto p = {propertyInfo.Getter.Name}();"); - contents.Append(" Serialization::Deserialize(e->value, p, modifier);"); - contents.Append($" {propertyInfo.Setter.Name}(p);"); - contents.Append(" }"); - contents.Append('}').AppendLine(); + contents.AppendLine(" {"); + contents.AppendLine($" const auto e = SERIALIZE_FIND_MEMBER(stream, \"{propertyInfo.Name}\");"); + contents.AppendLine(" if (e != stream.MemberEnd()) {"); + contents.AppendLine($" auto p = {propertyInfo.Getter.Name}();"); + contents.AppendLine(" Serialization::Deserialize(e->value, p, modifier);"); + contents.AppendLine($" {propertyInfo.Setter.Name}(p);"); + contents.AppendLine(" }"); + contents.AppendLine(" }"); } contents.Append('}').AppendLine();