Added apply across actors.

This commit is contained in:
Chandler Cox
2023-02-04 22:20:18 -06:00
parent 9c591b3c08
commit 03f299bc3b
2 changed files with 27 additions and 7 deletions

View File

@@ -82,6 +82,12 @@ namespace FlaxEditor.CustomEditors.Editors
/// <inheritdoc />
public override void Initialize(LayoutElementsContainer layout)
{
var scaleLocked = Editor.Instance.Windows.PropertiesWin.ScaleLocked;
if (scaleLocked)
{
ChangeValuesTogether = scaleLocked;
}
base.Initialize(layout);
// Override colors
@@ -106,7 +112,7 @@ namespace FlaxEditor.CustomEditors.Editors
Parent = nameLabel,
Width = 18,
Height = 18,
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Link32),
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Link32), // TODO change on scale lock
BackgroundColor = Color.White,
BorderColor = Color.Transparent,
BorderColorSelected = Color.Transparent,
@@ -119,6 +125,7 @@ namespace FlaxEditor.CustomEditors.Editors
lockButton.Clicked += () =>
{
ChangeValuesTogether = !ChangeValuesTogether;
Editor.Instance.Windows.PropertiesWin.ScaleLocked = ChangeValuesTogether;
// TODO: change image
Debug.Log(ChangeValuesTogether);
};
@@ -131,12 +138,6 @@ namespace FlaxEditor.CustomEditors.Editors
YElement.ValueBox.BorderSelectedColor = AxisColorY;
ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
Debug.Log(YElement.ValueBox.Parent);
Debug.Log(YElement.ValueBox.Parent.Parent);
Debug.Log(YElement.ValueBox.Parent.Parent.Parent);
Debug.Log(YElement.ValueBox.Parent.Parent.Parent.Parent);
Debug.Log(YElement.ValueBox.Parent.Parent.Parent.Parent.Parent);
}
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using FlaxEditor.CustomEditors;
using FlaxEngine.GUI;
@@ -21,6 +22,11 @@ namespace FlaxEditor.Windows
/// </summary>
public readonly CustomEditorPresenter Presenter;
/// <summary>
/// Indication of if the scale is locked.
/// </summary>
public bool ScaleLocked = false;
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesWindow"/> class.
/// </summary>
@@ -52,5 +58,18 @@ namespace FlaxEditor.Windows
var objects = Editor.SceneEditing.Selection.ConvertAll(x => x.EditableObject).Distinct();
Presenter.Select(objects);
}
/// <inheritdoc />
public override void OnLayoutSerialize(XmlWriter writer)
{
writer.WriteAttributeString("ScaleLocked", ScaleLocked.ToString());
}
/// <inheritdoc />
public override void OnLayoutDeserialize(XmlElement node)
{
if (bool.TryParse(node.GetAttribute("ScaleLocked"), out bool value1))
ScaleLocked = value1;
}
}
}