diff --git a/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs b/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs index f04d079b5..1249d18d2 100644 --- a/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs @@ -82,6 +82,12 @@ namespace FlaxEditor.CustomEditors.Editors /// 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); } } } diff --git a/Source/Editor/Windows/PropertiesWindow.cs b/Source/Editor/Windows/PropertiesWindow.cs index 3c2d06852..05b8c0efc 100644 --- a/Source/Editor/Windows/PropertiesWindow.cs +++ b/Source/Editor/Windows/PropertiesWindow.cs @@ -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 /// public readonly CustomEditorPresenter Presenter; + /// + /// Indication of if the scale is locked. + /// + public bool ScaleLocked = false; + /// /// Initializes a new instance of the class. /// @@ -52,5 +58,18 @@ namespace FlaxEditor.Windows var objects = Editor.SceneEditing.Selection.ConvertAll(x => x.EditableObject).Distinct(); Presenter.Select(objects); } + + /// + public override void OnLayoutSerialize(XmlWriter writer) + { + writer.WriteAttributeString("ScaleLocked", ScaleLocked.ToString()); + } + + /// + public override void OnLayoutDeserialize(XmlElement node) + { + if (bool.TryParse(node.GetAttribute("ScaleLocked"), out bool value1)) + ScaleLocked = value1; + } } }