diff --git a/Content/Editor/Gizmo/MaterialAxisLocked.flax b/Content/Editor/Gizmo/MaterialAxisLocked.flax
deleted file mode 100644
index be44ece86..000000000
--- a/Content/Editor/Gizmo/MaterialAxisLocked.flax
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7518765847301a4b13625fb05d542fab4fc924190a7414d39227db817a0e29cb
-size 661
diff --git a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs
index 8523b9378..03c18268d 100644
--- a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs
+++ b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs
@@ -1,9 +1,7 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using FlaxEditor.Options;
-using FlaxEditor.SceneGraph;
using FlaxEngine;
-using System;
namespace FlaxEditor.Gizmo
{
@@ -24,8 +22,8 @@ namespace FlaxEditor.Gizmo
private MaterialBase _materialSphere;
// Material Parameter Names
- const String _brightnessParamName = "Brightness";
- const String _opacityParamName = "Opacity";
+ private const string _brightnessParamName = "Brightness";
+ private const string _opacityParamName = "Opacity";
///
/// Used for example when the selection can't be moved because one actor is static.
@@ -82,7 +80,9 @@ namespace FlaxEditor.Gizmo
{
_isDisabled = ShouldGizmoBeLocked();
- float brightness = _isDisabled ? options.Visual.TransformGizmoBrighnessDisabled : options.Visual.TransformGizmoBrightness;
+ float brightness = _isDisabled ? options.Visual.TransformGizmoBrightnessDisabled : options.Visual.TransformGizmoBrightness;
+ if (Mathf.NearEqual(brightness, (float)_materialAxisX.GetParameterValue(_brightnessParamName)))
+ return;
_materialAxisX.SetParameterValue(_brightnessParamName, brightness);
_materialAxisY.SetParameterValue(_brightnessParamName, brightness);
_materialAxisZ.SetParameterValue(_brightnessParamName, brightness);
@@ -91,10 +91,10 @@ namespace FlaxEditor.Gizmo
private bool ShouldGizmoBeLocked()
{
bool gizmoLocked = false;
-
- if (Editor.Instance.StateMachine.IsPlayMode)
+ if (Editor.Instance.StateMachine.IsPlayMode && Owner is Viewport.EditorGizmoViewport)
{
- foreach (SceneGraphNode obj in Editor.Instance.SceneEditing.Selection)
+ // Block editing static scene objects in main view during play mode
+ foreach (var obj in Editor.Instance.SceneEditing.Selection)
{
if (obj.CanTransform == false)
{
@@ -103,7 +103,6 @@ namespace FlaxEditor.Gizmo
}
}
}
-
return gizmoLocked;
}
diff --git a/Source/Editor/Options/VisualOptions.cs b/Source/Editor/Options/VisualOptions.cs
index 45a1f1b13..e0f0982f4 100644
--- a/Source/Editor/Options/VisualOptions.cs
+++ b/Source/Editor/Options/VisualOptions.cs
@@ -86,7 +86,7 @@ namespace FlaxEditor.Options
///
[DefaultValue(0.25f), Range(0f, 5f)]
[EditorDisplay("Transform Gizmo", "Disabled Gizmo Brightness"), EditorOrder(212)]
- public float TransformGizmoBrighnessDisabled { get; set; } = 0.25f;
+ public float TransformGizmoBrightnessDisabled { get; set; } = 0.25f;
///
/// Gets or sets a value indicating whether enable MSAA for DebugDraw primitives rendering. Helps with pixel aliasing but reduces performance.