From 9a6f8669563f555d86ea4441b32d962d7ea0d346 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 29 Apr 2024 18:24:01 -0500 Subject: [PATCH] Move control transform to be under general group in layout. --- .../Dedicated/UIControlEditor.cs | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs index 27be8e538..282a3103b 100644 --- a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs @@ -458,12 +458,36 @@ namespace FlaxEditor.CustomEditors.Dedicated { if (layout.Children[i] is GroupElement group && group.Panel.HeaderText == "Transform") { - VerticalPanelElement mainHor = VerticalPanelWithoutMargin(group); - CreateTransformElements(mainHor, ValuesTypes); - group.ContainerControl.ChangeChildIndex(mainHor.Control, 0); + layout.Children.Remove(group); break; } } + + // Setup transform + if (Presenter is LayoutElementsContainer l) + { + var group = l.Group("Transform"); + VerticalPanelElement mainHor = VerticalPanelWithoutMargin(group); + CreateTransformElements(mainHor, ValuesTypes); + + ScriptMemberInfo scaleInfo = ValuesTypes[0].GetProperty("Scale"); + ItemInfo scaleItem = new ItemInfo(scaleInfo); + group.Property("Scale", scaleItem.GetValues(Values)); + + ScriptMemberInfo pivotInfo = ValuesTypes[0].GetProperty("Pivot"); + ItemInfo pivotItem = new ItemInfo(pivotInfo); + group.Property("Pivot", pivotItem.GetValues(Values)); + + ScriptMemberInfo shearInfo = ValuesTypes[0].GetProperty("Shear"); + ItemInfo shearItem = new ItemInfo(shearInfo); + group.Property("Shear", shearItem.GetValues(Values)); + + ScriptMemberInfo rotationInfo = ValuesTypes[0].GetProperty("Rotation"); + ItemInfo rotationItem = new ItemInfo(rotationInfo); + group.Property("Rotation", rotationItem.GetValues(Values)); + + Presenter.ContainerControl.ChangeChildIndex(group.Control, 1); + } } private void CreateTransformElements(LayoutElementsContainer main, ScriptType[] valueTypes)