diff --git a/Content/Editor/Gizmo/Material.flax b/Content/Editor/Gizmo/Material.flax index 87e7c078d..872b529e3 100644 --- a/Content/Editor/Gizmo/Material.flax +++ b/Content/Editor/Gizmo/Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ace1f3a9b078208da9a8742e2a7de74b10509abb3dcf12ddc70e4da918bbb756 -size 30756 +oid sha256:af4271107789ee629c6b5f2f0d4d2324a0a8b124043f6dd14f977514c408014b +size 31306 diff --git a/Content/Editor/Gizmo/MaterialAxisFocus.flax b/Content/Editor/Gizmo/MaterialAxisFocus.flax index 56c3f6560..a9de5e7e6 100644 --- a/Content/Editor/Gizmo/MaterialAxisFocus.flax +++ b/Content/Editor/Gizmo/MaterialAxisFocus.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b051fe079aa227c67f861220e35fab93c321d310f737ff663d9b77ef3fe98c3e -size 466 +oid sha256:db7018144f8a2774e1188b6f0ef7edfde3f8cb9c7f11f576163512c02f4c5a54 +size 661 diff --git a/Content/Editor/Gizmo/MaterialAxisLocked.flax b/Content/Editor/Gizmo/MaterialAxisLocked.flax new file mode 100644 index 000000000..be44ece86 --- /dev/null +++ b/Content/Editor/Gizmo/MaterialAxisLocked.flax @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7518765847301a4b13625fb05d542fab4fc924190a7414d39227db817a0e29cb +size 661 diff --git a/Content/Editor/Gizmo/MaterialAxisX.flax b/Content/Editor/Gizmo/MaterialAxisX.flax index 2bdb44208..9c7141673 100644 --- a/Content/Editor/Gizmo/MaterialAxisX.flax +++ b/Content/Editor/Gizmo/MaterialAxisX.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdffe8d74604845d50004b3f481e28c996a5b7945ae4e3e9e69975d23b2ef176 -size 302 +oid sha256:261382d0e9d30168f325eea14e96ae7abdd2c1fd8bad166f1b134df507e5fda9 +size 661 diff --git a/Content/Editor/Gizmo/MaterialAxisY.flax b/Content/Editor/Gizmo/MaterialAxisY.flax index b07d7b64a..6a16d14da 100644 --- a/Content/Editor/Gizmo/MaterialAxisY.flax +++ b/Content/Editor/Gizmo/MaterialAxisY.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1407e7ad2dbd54e0833488fd96ef4c3ede3b78fd970b3ff7e804d51dd04fdb2e -size 302 +oid sha256:f9160ba4200d01d7dfe6c529bb2f8893ee5106fa644921de51757947a0cb7bea +size 661 diff --git a/Content/Editor/Gizmo/MaterialAxisZ.flax b/Content/Editor/Gizmo/MaterialAxisZ.flax index e2bf44327..29c9a49d4 100644 --- a/Content/Editor/Gizmo/MaterialAxisZ.flax +++ b/Content/Editor/Gizmo/MaterialAxisZ.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f4a98b0028a9a9750f8dad737e5baf2bd061970f2f35fd10deacf47162cd992 -size 302 +oid sha256:5d129825361a89fca14f1dbad60a983cfac60d69284be66ca5e84041713e07a6 +size 661 diff --git a/Content/Editor/Gizmo/MaterialSphere.flax b/Content/Editor/Gizmo/MaterialSphere.flax index bf110acfb..1da1a3413 100644 --- a/Content/Editor/Gizmo/MaterialSphere.flax +++ b/Content/Editor/Gizmo/MaterialSphere.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf88f48c5de6b8fb8c7effbbdded9e6f115b1a3ac262d60785987c8f24107dfb -size 567 +oid sha256:55fe4f30e87ddda26928901beeef710bc5eaaf7712224bf633c674465cf3b4ac +size 661 diff --git a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs index 4166b463d..77bfff4b4 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs @@ -60,22 +60,24 @@ namespace FlaxEditor.Gizmo Platform.Fatal("Failed to load transform gizmo resources."); } - ApplyGizmoOptionsToMaterials(Editor.Instance.Options.Options); - - Editor.Instance.Options.OptionsChanged += ApplyGizmoOptionsToMaterials; + // Setup editor options + OnEditorOptionsChanged(Editor.Instance.Options.Options); + Editor.Instance.Options.OptionsChanged += OnEditorOptionsChanged; } - private void ApplyGizmoOptionsToMaterials(EditorOptions o) + private void OnEditorOptionsChanged(EditorOptions options) { - _materialAxisX.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); - _materialAxisY.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); - _materialAxisZ.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); - _materialAxisLocked.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); - - _materialAxisX.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); - _materialAxisY.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); - _materialAxisZ.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); - _materialAxisLocked.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); + float brightness = options.Visual.TransformGizmoBrightness; + _materialAxisX.SetParameterValue(_brightnessParamName, brightness); + _materialAxisY.SetParameterValue(_brightnessParamName, brightness); + _materialAxisZ.SetParameterValue(_brightnessParamName, brightness); + _materialAxisLocked.SetParameterValue(_brightnessParamName, brightness); + + float opacity = options.Visual.TransformGizmoOpacity; + _materialAxisX.SetParameterValue(_opacityParamName, opacity); + _materialAxisY.SetParameterValue(_opacityParamName, opacity); + _materialAxisZ.SetParameterValue(_opacityParamName, opacity); + _materialAxisLocked.SetParameterValue(_opacityParamName, opacity); } /// @@ -86,13 +88,13 @@ namespace FlaxEditor.Gizmo if (!_modelCube || !_modelCube.IsLoaded) return; + // Find out if any of the selected objects can not be moved bool gizmoLocked = false; - - // Find out if any of the selected objects can not be moved. if (Editor.Instance.StateMachine.IsPlayMode) { - foreach (SceneGraphNode obj in Editor.Instance.SceneEditing.Selection) + for (int i = 0; i < SelectionCount; i++) { + var obj = GetSelectedObject(i); if (obj.CanTransform == false) { gizmoLocked = true; diff --git a/Source/Editor/Options/VisualOptions.cs b/Source/Editor/Options/VisualOptions.cs index 5314cd8c1..cb5a0a89d 100644 --- a/Source/Editor/Options/VisualOptions.cs +++ b/Source/Editor/Options/VisualOptions.cs @@ -58,14 +58,14 @@ namespace FlaxEditor.Options /// [DefaultValue(1f), Range(0f, 5f)] [EditorDisplay("Transform Gizmo", "Gizmo Brightness"), EditorOrder(210)] - public float transformGizmoBrightness { get; set; } = 1f; + public float TransformGizmoBrightness { get; set; } = 1f; /// - /// Gets or set a value indicating the opactiy of the transform gizmo. + /// Gets or set a value indicating the opacity of the transform gizmo. /// [DefaultValue(1f), Range(0f, 1f)] [EditorDisplay("Transform Gizmo", "Gizmo Opacity"), EditorOrder(211)] - public float transformGizmoOpacity { get; set; } = 1f; + public float TransformGizmoOpacity { get; set; } = 1f; /// /// Gets or sets a value indicating whether enable MSAA for DebugDraw primitives rendering. Helps with pixel aliasing but reduces performance.