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

View File

@@ -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);
}
/// <inheritdoc />
@@ -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;

View File

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