Minor improvements to new gizmo changes and add new assets

#3088
This commit is contained in:
Wojtek Figat
2024-12-16 23:41:55 +01:00
parent 4de324f2b0
commit 622de6ebcb
9 changed files with 36 additions and 31 deletions

BIN
Content/Editor/Gizmo/Material.flax (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialAxisLocked.flax (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialAxisX.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialAxisY.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialAxisZ.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Editor/Gizmo/MaterialSphere.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -60,22 +60,24 @@ namespace FlaxEditor.Gizmo
Platform.Fatal("Failed to load transform gizmo resources."); Platform.Fatal("Failed to load transform gizmo resources.");
} }
ApplyGizmoOptionsToMaterials(Editor.Instance.Options.Options); // Setup editor options
OnEditorOptionsChanged(Editor.Instance.Options.Options);
Editor.Instance.Options.OptionsChanged += ApplyGizmoOptionsToMaterials; Editor.Instance.Options.OptionsChanged += OnEditorOptionsChanged;
} }
private void ApplyGizmoOptionsToMaterials(EditorOptions o) private void OnEditorOptionsChanged(EditorOptions options)
{ {
_materialAxisX.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); float brightness = options.Visual.TransformGizmoBrightness;
_materialAxisY.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); _materialAxisX.SetParameterValue(_brightnessParamName, brightness);
_materialAxisZ.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); _materialAxisY.SetParameterValue(_brightnessParamName, brightness);
_materialAxisLocked.SetParameterValue(_brightnessParamName, o.Visual.transformGizmoBrightness); _materialAxisZ.SetParameterValue(_brightnessParamName, brightness);
_materialAxisLocked.SetParameterValue(_brightnessParamName, brightness);
_materialAxisX.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); float opacity = options.Visual.TransformGizmoOpacity;
_materialAxisY.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); _materialAxisX.SetParameterValue(_opacityParamName, opacity);
_materialAxisZ.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); _materialAxisY.SetParameterValue(_opacityParamName, opacity);
_materialAxisLocked.SetParameterValue(_opacityParamName, o.Visual.transformGizmoOpacity); _materialAxisZ.SetParameterValue(_opacityParamName, opacity);
_materialAxisLocked.SetParameterValue(_opacityParamName, opacity);
} }
/// <inheritdoc /> /// <inheritdoc />
@@ -86,13 +88,13 @@ namespace FlaxEditor.Gizmo
if (!_modelCube || !_modelCube.IsLoaded) if (!_modelCube || !_modelCube.IsLoaded)
return; return;
// Find out if any of the selected objects can not be moved
bool gizmoLocked = false; bool gizmoLocked = false;
// Find out if any of the selected objects can not be moved.
if (Editor.Instance.StateMachine.IsPlayMode) 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) if (obj.CanTransform == false)
{ {
gizmoLocked = true; gizmoLocked = true;

View File

@@ -58,14 +58,14 @@ namespace FlaxEditor.Options
/// </summary> /// </summary>
[DefaultValue(1f), Range(0f, 5f)] [DefaultValue(1f), Range(0f, 5f)]
[EditorDisplay("Transform Gizmo", "Gizmo Brightness"), EditorOrder(210)] [EditorDisplay("Transform Gizmo", "Gizmo Brightness"), EditorOrder(210)]
public float transformGizmoBrightness { get; set; } = 1f; public float TransformGizmoBrightness { get; set; } = 1f;
/// <summary> /// <summary>
/// Gets or set a value indicating the opactiy of the transform gizmo. /// Gets or set a value indicating the opacity of the transform gizmo.
/// </summary> /// </summary>
[DefaultValue(1f), Range(0f, 1f)] [DefaultValue(1f), Range(0f, 1f)]
[EditorDisplay("Transform Gizmo", "Gizmo Opacity"), EditorOrder(211)] [EditorDisplay("Transform Gizmo", "Gizmo Opacity"), EditorOrder(211)]
public float transformGizmoOpacity { get; set; } = 1f; public float TransformGizmoOpacity { get; set; } = 1f;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether enable MSAA for DebugDraw primitives rendering. Helps with pixel aliasing but reduces performance. /// Gets or sets a value indicating whether enable MSAA for DebugDraw primitives rendering. Helps with pixel aliasing but reduces performance.