diff --git a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp index 1f006b6ae..687535b9b 100644 --- a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp +++ b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp @@ -35,6 +35,7 @@ #include "Engine/Engine/Base/GameBase.h" #include "Engine/Engine/Globals.h" #include "Engine/Tools/TextureTool/TextureTool.h" +#include "Engine/Scripting/Enums.h" #if PLATFORM_TOOLS_WINDOWS #include "Engine/Platform/Windows/WindowsPlatformSettings.h" #endif @@ -656,7 +657,7 @@ bool ProcessTextureBase(CookAssetsStep::AssetCookData& data) // Convert texture data to the target format if (TextureTool::Convert(textureDataTmp1, *textureData, targetFormat)) { - LOG(Error, "Failed to convert texture {0} from format {1} to {2}", asset->ToString(), (int32)format, (int32)targetFormat); + LOG(Error, "Failed to convert texture {0} from format {1} to {2}", asset->ToString(), ScriptingEnum::ToString(format), ScriptingEnum::ToString(targetFormat)); return true; } textureData = &textureDataTmp1; diff --git a/Source/Editor/Options/GeneralOptions.cs b/Source/Editor/Options/GeneralOptions.cs index e97278aa0..63822a7ca 100644 --- a/Source/Editor/Options/GeneralOptions.cs +++ b/Source/Editor/Options/GeneralOptions.cs @@ -106,6 +106,13 @@ namespace FlaxEditor.Options [DefaultValue(60.0f), Limit(0, 666)] [EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")] public float EditorFPS { get; set; } = 60.0f; + + /// + /// Gets or sets The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS. + /// + [DefaultValue(15.0f), Limit(0, 666)] + [EditorDisplay("General", "Editor FPS When Not Focused"), EditorOrder(111), Tooltip("The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS.")] + public float EditorFPSWhenNotFocused { get; set; } = 15.0f; /// /// Gets or sets the sequence of actions to perform when using Build Scenes button. Can be used to configure this as button (eg. compile code or just update navmesh). diff --git a/Source/Editor/States/EditorState.cs b/Source/Editor/States/EditorState.cs index b900e3cca..ac644f5e1 100644 --- a/Source/Editor/States/EditorState.cs +++ b/Source/Editor/States/EditorState.cs @@ -93,12 +93,13 @@ namespace FlaxEditor.States /// public virtual void UpdateFPS() { - var editorFps = Editor.Options.Options.General.EditorFPS; + var generalOptions = Editor.Options.Options.General; + var editorFps = generalOptions.EditorFPS; if (!Platform.HasFocus) { // Drop performance if app has no focus - Time.DrawFPS = 15; - Time.UpdateFPS = 15; + Time.DrawFPS = generalOptions.EditorFPSWhenNotFocused; + Time.UpdateFPS = generalOptions.EditorFPSWhenNotFocused; } else if (editorFps < 1) { diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index 8372ac9cf..8d55db8aa 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -127,12 +127,34 @@ namespace FlaxEditor.Surface.ContextMenu _parameterSetNodeArchetype = info.ParameterSetNodeArchetype ?? Archetypes.Parameters.Nodes[3]; // Context menu dimensions - Size = new Float2(320, 220); + Size = new Float2(320, 248); + + var headerPanel = new Panel(ScrollBars.None) + { + Parent = this, + Height = 20, + Width = Width - 4, + X = 2, + Y = 1, + BackgroundColor = Style.Current.BackgroundNormal, + }; + + // Title bar + var titleLabel = new Label + { + Width = Width - 8, + Height = 20, + X = 4, + Parent = headerPanel, + Text = "Select Node", + HorizontalAlignment = TextAlignment.Center, + Font = new FontReference(Style.Current.FontLarge.Asset, 10), + }; // Search box - _searchBox = new SearchBox(false, 1, 1) + _searchBox = new SearchBox(false, 2, 22) { - Width = Width - 3, + Width = Width - 4, Parent = this }; _searchBox.TextChanged += OnSearchFilterChanged; @@ -549,6 +571,8 @@ namespace FlaxEditor.Surface.ContextMenu }; var group = CreateGroup(groupArchetype); + group.ArrowImageOpened = new SpriteBrush(Style.Current.ArrowDown); + group.ArrowImageClosed = new SpriteBrush(Style.Current.ArrowRight); group.Close(false); archetypeIndex = 0; for (int i = 0; i < parameters.Count; i++) diff --git a/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs b/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs index 28014f897..446840f2c 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCMGroup.cs @@ -46,6 +46,11 @@ namespace FlaxEditor.Surface.ContextMenu ContextMenu = cm; Archetypes.Add(archetype); Name = archetype.Name; + EnableDropDownIcon = true; + HeaderColor = Style.Current.Background; + ArrowImageOpened = new SpriteBrush(Style.Current.ArrowDown); + ArrowImageClosed = new SpriteBrush(Style.Current.ArrowRight); + CloseAnimationTime = 0; } /// diff --git a/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs b/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs index e066de380..b68d529a1 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCMItem.cs @@ -87,6 +87,11 @@ namespace FlaxEditor.Surface.ContextMenu SortScore += 5; } + private void GetTextRectangle(out Rectangle textRect) + { + textRect = new Rectangle(22, 0, Width - 24, Height); + } + private bool CanConnectTo(Box startBox, NodeArchetype nodeArchetype) { if (startBox == null) @@ -123,6 +128,7 @@ namespace FlaxEditor.Surface.ContextMenu } else { + GetTextRectangle(out var textRect); if (QueryFilterHelper.Match(filterText, _archetype.Title, out var ranges)) { // Update highlights @@ -136,7 +142,7 @@ namespace FlaxEditor.Surface.ContextMenu { var start = font.GetCharPosition(_archetype.Title, ranges[i].StartIndex); var end = font.GetCharPosition(_archetype.Title, ranges[i].EndIndex); - _highlights.Add(new Rectangle(start.X + 2, 0, end.X - start.X, Height)); + _highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height)); if (ranges[i].StartIndex <= 0) { @@ -158,7 +164,7 @@ namespace FlaxEditor.Surface.ContextMenu var font = style.FontSmall; var start = font.GetCharPosition(_archetype.Title, 0); var end = font.GetCharPosition(_archetype.Title, _archetype.Title.Length - 1); - _highlights.Add(new Rectangle(start.X + 2, 0, end.X - start.X, Height)); + _highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height)); _isFullMatch = true; Visible = true; } @@ -173,7 +179,7 @@ namespace FlaxEditor.Surface.ContextMenu var font = style.FontSmall; var start = font.GetCharPosition(_archetype.Title, 0); var end = font.GetCharPosition(_archetype.Title, _archetype.Title.Length - 1); - _highlights.Add(new Rectangle(start.X + 2, 0, end.X - start.X, Height)); + _highlights.Add(new Rectangle(start.X + textRect.X, 0, end.X - start.X, Height)); Visible = true; Data = data; @@ -192,7 +198,7 @@ namespace FlaxEditor.Surface.ContextMenu { var style = Style.Current; var rect = new Rectangle(Float2.Zero, Size); - var textRect = new Rectangle(2, 0, rect.Width - 4, rect.Height); + GetTextRectangle(out var textRect); var showScoreHit = SortScore > 0.1f; // Overlay diff --git a/Source/Editor/Windows/ContentWindow.Navigation.cs b/Source/Editor/Windows/ContentWindow.Navigation.cs index 69104d6c8..ad690c2d0 100644 --- a/Source/Editor/Windows/ContentWindow.Navigation.cs +++ b/Source/Editor/Windows/ContentWindow.Navigation.cs @@ -69,7 +69,6 @@ namespace FlaxEditor.Windows // Update UI UpdateUI(); - _view.SelectFirstItem(); } } diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index c1476b095..9535e8d3e 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -942,6 +942,17 @@ namespace FlaxEditor.Windows return true; } + if (button == MouseButton.Left) + { + // Find control that is under the mouse + var c = GetChildAtRecursive(location); + if (c is ContentView) + { + _view.ClearSelection(); + return true; + } + } + return base.OnMouseUp(location, button); } diff --git a/Source/Engine/Core/Math/Vector2.h b/Source/Engine/Core/Math/Vector2.h index 2f7a143c4..cff32539d 100644 --- a/Source/Engine/Core/Math/Vector2.h +++ b/Source/Engine/Core/Math/Vector2.h @@ -228,8 +228,9 @@ public: /// Vector2Base GetNormalized() const { - const T rcp = 1.0f / Length(); - return Vector2Base(X * rcp, Y * rcp); + Vector2Base result(X, Y); + result.Normalize(); + return result; } public: diff --git a/Source/Engine/Core/Math/Vector3.h b/Source/Engine/Core/Math/Vector3.h index 18daa8934..f2547f47d 100644 --- a/Source/Engine/Core/Math/Vector3.h +++ b/Source/Engine/Core/Math/Vector3.h @@ -254,8 +254,9 @@ public: /// Vector3Base GetNormalized() const { - const T rcp = 1.0f / Length(); - return Vector3Base(X * rcp, Y * rcp, Z * rcp); + Vector3Base result(X, Y, Z); + result.Normalize(); + return result; } public: diff --git a/Source/Engine/Graphics/GPUBuffer.cpp b/Source/Engine/Graphics/GPUBuffer.cpp index 6aaa939b3..6e400bbdd 100644 --- a/Source/Engine/Graphics/GPUBuffer.cpp +++ b/Source/Engine/Graphics/GPUBuffer.cpp @@ -12,6 +12,7 @@ #include "Engine/Debug/Exceptions/InvalidOperationException.h" #include "Engine/Debug/Exceptions/ArgumentNullException.h" #include "Engine/Debug/Exceptions/ArgumentOutOfRangeException.h" +#include "Engine/Scripting/Enums.h" #include "Engine/Threading/ThreadPoolTask.h" #include "Engine/Threading/Threading.h" @@ -107,7 +108,7 @@ String GPUBufferDescription::ToString() const Size, Stride, flags, - (int32)Format, + ScriptingEnum::ToString(Format), (int32)Usage); } diff --git a/Source/Engine/Graphics/Materials/MaterialParams.cpp b/Source/Engine/Graphics/Materials/MaterialParams.cpp index 0788a59ab..c9adfa730 100644 --- a/Source/Engine/Graphics/Materials/MaterialParams.cpp +++ b/Source/Engine/Graphics/Materials/MaterialParams.cpp @@ -273,7 +273,7 @@ void MaterialParameter::SetValue(const Variant& value) } if (invalidType) { - LOG(Error, "Invalid material parameter value type {0} to set (param type: {1})", value.Type, ScriptingEnum::ToString(_type)); + LOG(Error, "Invalid material parameter value type {0} to set (param type: {1})", value.Type, ScriptingEnum::ToString(_type)); } } @@ -530,7 +530,7 @@ bool MaterialParameter::operator==(const MaterialParameter& other) const String MaterialParameter::ToString() const { - return String::Format(TEXT("\'{0}\' ({1}:{2}:{3})"), _name, ScriptingEnum::ToString(_type), _paramId, _isPublic); + return String::Format(TEXT("\'{0}\' ({1}:{2}:{3})"), _name, ScriptingEnum::ToString(_type), _paramId, _isPublic); } MaterialParameter* MaterialParams::Get(const Guid& id) diff --git a/Source/Engine/Graphics/Textures/GPUTexture.cpp b/Source/Engine/Graphics/Textures/GPUTexture.cpp index 921941304..ccdf4be95 100644 --- a/Source/Engine/Graphics/Textures/GPUTexture.cpp +++ b/Source/Engine/Graphics/Textures/GPUTexture.cpp @@ -15,6 +15,7 @@ #include "Engine/Graphics/GPULimits.h" #include "Engine/Threading/ThreadPoolTask.h" #include "Engine/Graphics/GPUDevice.h" +#include "Engine/Scripting/Enums.h" namespace { @@ -187,7 +188,7 @@ String GPUTextureDescription::ToString() const ArraySize, ::ToString(Dimensions), MipLevels, - (int32)Format, + ScriptingEnum::ToString(Format), ::ToString(MultiSampleLevel), flags, (int32)Usage); diff --git a/Source/Engine/Graphics/Textures/StreamingTexture.cpp b/Source/Engine/Graphics/Textures/StreamingTexture.cpp index 8e19b9f39..4793d340e 100644 --- a/Source/Engine/Graphics/Textures/StreamingTexture.cpp +++ b/Source/Engine/Graphics/Textures/StreamingTexture.cpp @@ -9,6 +9,7 @@ #include "Engine/Graphics/GPUDevice.h" #include "Engine/Graphics/RenderTools.h" #include "Engine/Graphics/Async/Tasks/GPUUploadTextureMipTask.h" +#include "Engine/Scripting/Enums.h" TextureHeader_Deprecated::TextureHeader_Deprecated() { @@ -354,7 +355,7 @@ protected: // Ensure that texture has been allocated before this task and has proper format if (!texture->IsAllocated() || texture->Format() != _streamingTexture->GetHeader()->Format) { - LOG(Error, "Cannot stream texture {0} (streaming format: {1})", texture->ToString(), (int32)_streamingTexture->GetHeader()->Format); + LOG(Error, "Cannot stream texture {0} (streaming format: {1})", texture->ToString(), ScriptingEnum::ToString(_streamingTexture->GetHeader()->Format)); return Result::Failed; } diff --git a/Source/Engine/Graphics/Textures/TextureBase.cpp b/Source/Engine/Graphics/Textures/TextureBase.cpp index ab249ec76..36720a318 100644 --- a/Source/Engine/Graphics/Textures/TextureBase.cpp +++ b/Source/Engine/Graphics/Textures/TextureBase.cpp @@ -11,6 +11,7 @@ #include "Engine/Debug/Exceptions/InvalidOperationException.h" #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Content/Factories/BinaryAssetFactory.h" +#include "Engine/Scripting/Enums.h" #include "Engine/Tools/TextureTool/TextureTool.h" #include "Engine/Threading/Threading.h" @@ -85,7 +86,7 @@ bool TextureMipData::GetPixels(Array& pixels, int32 width, int32 height case PixelFormat::B8G8R8X8_UNorm: case PixelFormat::B8G8R8X8_UNorm_sRGB: if (srcRowSize == dstRowSize) - Platform::MemoryCopy(dst, src, size); + Platform::MemoryCopy(dst, src, RowPitch * Lines); else { for (uint32 row = 0; row < Lines; row++) @@ -112,7 +113,7 @@ bool TextureMipData::GetPixels(Array& pixels, int32 width, int32 height } return false; } - LOG(Error, "Unsupported texture data format {0}.", (int32)format); + LOG(Error, "Unsupported texture data format {0}.", ScriptingEnum::ToString(format)); return true; } } @@ -134,7 +135,7 @@ bool TextureMipData::GetPixels(Array& pixels, int32 width, int32 height, case PixelFormat::R32G32B32A32_Typeless: case PixelFormat::R32G32B32A32_Float: if (srcRowSize == dstRowSize) - Platform::MemoryCopy(dst, src, size); + Platform::MemoryCopy(dst, src, RowPitch * Lines); else { for (uint32 row = 0; row < Lines; row++) @@ -161,7 +162,7 @@ bool TextureMipData::GetPixels(Array& pixels, int32 width, int32 height, } return false; } - LOG(Error, "Unsupported texture data format {0}.", (int32)format); + LOG(Error, "Unsupported texture data format {0}.", ScriptingEnum::ToString(format)); return true; } } @@ -453,7 +454,7 @@ bool TextureBase::SetPixels(const Span& pixels, int32 mipIndex, int32 a } if (error) { - LOG(Error, "Unsupported texture data format {0}.", (int32)format); + LOG(Error, "Unsupported texture data format {0}.", ScriptingEnum::ToString(format)); return true; } @@ -531,7 +532,7 @@ bool TextureBase::SetPixels(const Span& pixels, int32 mipIndex, int32 arr } if (error) { - LOG(Error, "Unsupported texture data format {0}.", (int32)format); + LOG(Error, "Unsupported texture data format {0}.", ScriptingEnum::ToString(format)); return true; } @@ -844,7 +845,7 @@ bool TextureBase::InitData::GenerateMip(int32 mipIndex, bool linear) break; } default: - LOG(Error, "Unsupported texture data format {0}.", (int32)Format); + LOG(Error, "Unsupported texture data format {0}.", ScriptingEnum::ToString(Format)); return true; } } diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp index 85e151ee0..0fb5add24 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp @@ -34,6 +34,7 @@ #include "Engine/Utilities/StringConverter.h" #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Threading/Threading.h" +#include "Engine/Scripting/Enums.h" #if !USE_EDITOR && (PLATFORM_WINDOWS || PLATFORM_LINUX) #include "Engine/Core/Config/PlatformSettings.h" @@ -1385,7 +1386,7 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format, #if !BUILD_RELEASE if (format != remap) { - LOG(Warning, "Unsupported Vulkan format {0}. Remapping to {1}", (int32)format, (int32)remap); + LOG(Warning, "Unsupported Vulkan format {0}. Remapping to {1}", ScriptingEnum::ToString(format), ScriptingEnum::ToString(remap)); format = GetClosestSupportedPixelFormat(remap, flags, optimalTiling); } #endif diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUSwapChainVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUSwapChainVulkan.cpp index 977ba4863..f3d4cfd4d 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUSwapChainVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUSwapChainVulkan.cpp @@ -10,6 +10,7 @@ #include "CmdBufferVulkan.h" #include "Engine/Core/Log.h" #include "Engine/Graphics/GPULimits.h" +#include "Engine/Scripting/Enums.h" void BackBufferVulkan::Setup(GPUSwapChainVulkan* window, VkImage backbuffer, PixelFormat format, VkExtent3D extent) { @@ -231,13 +232,13 @@ bool GPUSwapChainVulkan::CreateSwapChain(int32 width, int32 height) if (!found) { - LOG(Warning, "Requested pixel format {0} not supported by this swapchain. Falling back to supported swapchain formats...", (uint32)resultFormat); + LOG(Warning, "Requested pixel format {0} not supported by this swapchain. Falling back to supported swapchain formats...", ScriptingEnum::ToString(resultFormat)); resultFormat = PixelFormat::Unknown; } } else { - LOG(Warning, "Requested pixel format {0} is not supported by this Vulkan implementation", (uint32)resultFormat); + LOG(Warning, "Requested pixel format {0} is not supported by this Vulkan implementation", ScriptingEnum::ToString(resultFormat)); resultFormat = PixelFormat::Unknown; } } diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUTextureVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUTextureVulkan.cpp index 9cd33aaf6..e754573a8 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUTextureVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUTextureVulkan.cpp @@ -9,6 +9,7 @@ #include "Engine/Core/Log.h" #include "Engine/Graphics/PixelFormatExtensions.h" #include "Engine/Graphics/Textures/TextureData.h" +#include "Engine/Scripting/Enums.h" void GPUTextureViewVulkan::Init(GPUDeviceVulkan* device, ResourceOwnerVulkan* owner, VkImage image, int32 totalMipLevels, PixelFormat format, MSAALevel msaa, VkExtent3D extent, VkImageViewType viewType, int32 mipLevels, int32 firstMipIndex, int32 arraySize, int32 firstArraySlice, bool readOnlyDepth) { @@ -241,7 +242,7 @@ bool GPUTextureVulkan::OnInit() _desc.Format = _device->GetClosestSupportedPixelFormat(format, _desc.Flags, optimalTiling); if (_desc.Format == PixelFormat::Unknown) { - LOG(Error, "Unsupported texture format {0}.", (int32)format); + LOG(Error, "Unsupported texture format {0}.", ScriptingEnum::ToString(format)); return true; } diff --git a/Source/Engine/Threading/TaskGraph.cpp b/Source/Engine/Threading/TaskGraph.cpp index 26a611a8a..92c8f1bc6 100644 --- a/Source/Engine/Threading/TaskGraph.cpp +++ b/Source/Engine/Threading/TaskGraph.cpp @@ -18,11 +18,31 @@ TaskGraphSystem::TaskGraphSystem(const SpawnParams& params) { } +TaskGraphSystem::~TaskGraphSystem() +{ + // Cleanup any outstanding dependencies + for (auto* e : _reverseDependencies) + e->_dependencies.Remove(this); +} + void TaskGraphSystem::AddDependency(TaskGraphSystem* system) { + CHECK(system); + if (_dependencies.Contains(system)) + return; + system->_reverseDependencies.Add(this); _dependencies.Add(system); } +void TaskGraphSystem::RemoveDependency(TaskGraphSystem* system) +{ + CHECK(system); + if (!_dependencies.Contains(system)) + return; + system->_reverseDependencies.Remove(this); + _dependencies.Remove(system); +} + void TaskGraphSystem::PreExecute(TaskGraph* graph) { } diff --git a/Source/Engine/Threading/TaskGraph.h b/Source/Engine/Threading/TaskGraph.h index f6c130f4d..96e7f440e 100644 --- a/Source/Engine/Threading/TaskGraph.h +++ b/Source/Engine/Threading/TaskGraph.h @@ -16,6 +16,7 @@ DECLARE_SCRIPTING_TYPE(TaskGraphSystem); friend TaskGraph; private: Array> _dependencies; + Array> _reverseDependencies; public: /// @@ -24,12 +25,20 @@ public: API_FIELD() int32 Order = 0; public: + ~TaskGraphSystem(); + /// /// Adds the dependency on the system execution. Before this system can be executed the given dependant system has to be executed first. /// /// The system to depend on. API_FUNCTION() void AddDependency(TaskGraphSystem* system); + /// + /// Removes the dependency on the system execution. + /// + /// The system to not depend on anymore. + API_FUNCTION() void RemoveDependency(TaskGraphSystem* system); + /// /// Called before executing any systems of the graph. Can be used to initialize data (synchronous). /// diff --git a/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp b/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp index 86bdd49e1..9fd7f554b 100644 --- a/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp +++ b/Source/Engine/Tools/TextureTool/TextureTool.stb.cpp @@ -263,6 +263,7 @@ bool TextureTool::ExportTextureStb(ImageType type, const StringView& path, const if (ptr) { file->WriteBytes(ptr, ptrSize); + STBIW_FREE(ptr); result = 0; } else diff --git a/Source/Engine/UI/GUI/Panels/ScrollBar.cs b/Source/Engine/UI/GUI/Panels/ScrollBar.cs index d91a88adf..a51a1df40 100644 --- a/Source/Engine/UI/GUI/Panels/ScrollBar.cs +++ b/Source/Engine/UI/GUI/Panels/ScrollBar.cs @@ -19,11 +19,11 @@ namespace FlaxEngine.GUI /// /// The default minimum opacity. /// - public const float DefaultMinimumOpacity = 0.7f; + public const float DefaultMinimumOpacity = 0.75f; // Scrolling - private float _clickChange = 20, _scrollChange = 75; + private float _clickChange = 20, _scrollChange = 100; private float _minimum, _maximum = 100; private float _value, _targetValue; private readonly Orientation _orientation; @@ -51,17 +51,17 @@ namespace FlaxEngine.GUI /// /// Gets or sets the thumb box thickness. /// - public float ThumbThickness { get; set; } = 6; + public float ThumbThickness { get; set; } = 8; /// /// Gets or sets the track line thickness. /// - public float TrackThickness { get; set; } = 1; + public float TrackThickness { get; set; } = 2.0f; /// /// Gets or sets the value smoothing scale (0 to not use it). /// - public float SmoothingScale { get; set; } = 1; + public float SmoothingScale { get; set; } = 0.6f; /// /// Gets a value indicating whether use scroll value smoothing. @@ -246,7 +246,7 @@ namespace FlaxEngine.GUI var height = Height; float trackSize = TrackSize; float range = _maximum - _minimum; - _thumbSize = Mathf.Min(trackSize, Mathf.Max(trackSize / range * 10.0f, 30.0f)); + _thumbSize = Mathf.Min(trackSize - 10, Mathf.Max(trackSize / range * 100.0f, 50.0f)); float pixelRange = trackSize - _thumbSize; float percentage = (_value - _minimum) / range; float thumbPosition = (int)(percentage * pixelRange);