From 7fcb0a1da7c50e108806ac46e993994c34dc7464 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:46:47 -0400 Subject: [PATCH 1/2] change terrain brush size with scroll --- Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs | 8 ++++++++ Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs | 4 ++-- Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs | 8 ++++++++ Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs | 4 ++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs b/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs index c16bdd7e6..dd837fe00 100644 --- a/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs +++ b/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs @@ -150,6 +150,14 @@ namespace FlaxEditor.Tools.Terrain return; } + // Increase or decrease brush size with scroll + if (Input.GetKey(KeyboardKeys.Shift)) + { + var currentBrush = Mode.CurrentBrush; + currentBrush.Size += dt * currentBrush.Size * Input.Mouse.ScrollDelta * 5f; + Mode.CurrentBrush = currentBrush; + } + // Check if no terrain is selected var terrain = SelectedTerrain; if (!terrain) diff --git a/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs b/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs index 1d1bf87ca..a68b90ce8 100644 --- a/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs +++ b/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs @@ -139,9 +139,9 @@ namespace FlaxEditor.Tools.Terrain } /// - /// Gets the current brush. + /// Gets or set the current brush. /// - public Brush CurrentBrush => _brushes[(int)_brushType]; + public Brush CurrentBrush { get => _brushes[(int)_brushType]; set => _brushes[(int)_brushType] = value; } /// /// Gets the circle brush instance. diff --git a/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs b/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs index 96270a740..837c86dcb 100644 --- a/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs +++ b/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs @@ -158,6 +158,14 @@ namespace FlaxEditor.Tools.Terrain return; } + // Increase or decrease brush size with scroll + if (Input.GetKey(KeyboardKeys.Shift)) + { + var currentBrush = Mode.CurrentBrush; + currentBrush.Size += dt * currentBrush.Size * Input.Mouse.ScrollDelta * 5f; + Mode.CurrentBrush = currentBrush; + } + // Check if selected terrain was changed during painting if (terrain != _paintTerrain && IsPainting) { diff --git a/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs b/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs index 4b19cfbde..b99ac135f 100644 --- a/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs +++ b/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs @@ -158,9 +158,9 @@ namespace FlaxEditor.Tools.Terrain } /// - /// Gets the current brush. + /// Gets or set the current brush. /// - public Brush CurrentBrush => _brushes[(int)_brushType]; + public Brush CurrentBrush { get => _brushes[(int)_brushType]; set => _brushes[(int)_brushType] = value; } /// /// Gets the circle brush instance. From e97ec74bf8035da4d09ad505b3e8d44981853643 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:37:04 -0400 Subject: [PATCH 2/2] clean code --- Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs | 4 +--- Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs | 4 ++-- Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs | 4 +--- Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs b/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs index dd837fe00..c9a521734 100644 --- a/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs +++ b/Source/Editor/Tools/Terrain/PaintTerrainGizmo.cs @@ -153,9 +153,7 @@ namespace FlaxEditor.Tools.Terrain // Increase or decrease brush size with scroll if (Input.GetKey(KeyboardKeys.Shift)) { - var currentBrush = Mode.CurrentBrush; - currentBrush.Size += dt * currentBrush.Size * Input.Mouse.ScrollDelta * 5f; - Mode.CurrentBrush = currentBrush; + Mode.CurrentBrush.Size += dt * Mode.CurrentBrush.Size * Input.Mouse.ScrollDelta * 5f; } // Check if no terrain is selected diff --git a/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs b/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs index a68b90ce8..1d1bf87ca 100644 --- a/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs +++ b/Source/Editor/Tools/Terrain/PaintTerrainGizmoMode.cs @@ -139,9 +139,9 @@ namespace FlaxEditor.Tools.Terrain } /// - /// Gets or set the current brush. + /// Gets the current brush. /// - public Brush CurrentBrush { get => _brushes[(int)_brushType]; set => _brushes[(int)_brushType] = value; } + public Brush CurrentBrush => _brushes[(int)_brushType]; /// /// Gets the circle brush instance. diff --git a/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs b/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs index 837c86dcb..fef8bbf09 100644 --- a/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs +++ b/Source/Editor/Tools/Terrain/SculptTerrainGizmo.cs @@ -161,9 +161,7 @@ namespace FlaxEditor.Tools.Terrain // Increase or decrease brush size with scroll if (Input.GetKey(KeyboardKeys.Shift)) { - var currentBrush = Mode.CurrentBrush; - currentBrush.Size += dt * currentBrush.Size * Input.Mouse.ScrollDelta * 5f; - Mode.CurrentBrush = currentBrush; + Mode.CurrentBrush.Size += dt * Mode.CurrentBrush.Size * Input.Mouse.ScrollDelta * 5f; } // Check if selected terrain was changed during painting diff --git a/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs b/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs index b99ac135f..4b19cfbde 100644 --- a/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs +++ b/Source/Editor/Tools/Terrain/SculptTerrainGizmoMode.cs @@ -158,9 +158,9 @@ namespace FlaxEditor.Tools.Terrain } /// - /// Gets or set the current brush. + /// Gets the current brush. /// - public Brush CurrentBrush { get => _brushes[(int)_brushType]; set => _brushes[(int)_brushType] = value; } + public Brush CurrentBrush => _brushes[(int)_brushType]; /// /// Gets the circle brush instance.