diff --git a/com.unity.cinemachine/Editor/Editors/CinemachineSplineRollEditor.cs b/com.unity.cinemachine/Editor/Editors/CinemachineSplineRollEditor.cs index 76f897214..60931aa5e 100644 --- a/com.unity.cinemachine/Editor/Editors/CinemachineSplineRollEditor.cs +++ b/com.unity.cinemachine/Editor/Editors/CinemachineSplineRollEditor.cs @@ -196,7 +196,7 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property) InspectorUtility.AddDelayedFriendlyPropertyDragger(label, indexProp, indexField, false); ux.Add(new VisualElement { pickingMode = PickingMode.Ignore, style = { width = 12 }}); // pass-through for selecting row in list - ux.Add(new InspectorUtility.CompactPropertyField(valueProp.FindPropertyRelative(() => def.Value))); + ux.Add(new InspectorUtility.CompactPropertyField(valueProp.FindPropertyRelative(() => def.Value)) { style = { flexGrow = 1 }}); return ux; } } diff --git a/com.unity.cinemachine/Editor/Utility/InspectorUtility.cs b/com.unity.cinemachine/Editor/Utility/InspectorUtility.cs index a5535bbda..7f941995a 100644 --- a/com.unity.cinemachine/Editor/Utility/InspectorUtility.cs +++ b/com.unity.cinemachine/Editor/Utility/InspectorUtility.cs @@ -450,7 +450,7 @@ public static LabeledRow PropertyRow( var row = new LabeledRow(label ?? property.displayName, property.tooltip); propertyField = row.Contents.AddChild(new PropertyField(property, "") { style = { flexGrow = 1, flexBasis = SingleLineHeight * 5 }}); - AddDelayedFriendlyPropertyDragger(row.Label, property, propertyField); + AddDelayedFriendlyPropertyDragger(row.Label, property, propertyField, true); return row; } @@ -474,7 +474,7 @@ public CompactPropertyField(SerializedProperty property, string label, float min Field = AddChild(this, new PropertyField(property, "") { style = { flexGrow = 1, flexBasis = 10 } }); Field.style.marginLeft = Field.style.marginLeft.value.value - 1; if (Label != null) - AddDelayedFriendlyPropertyDragger(Label, property, Field); + AddDelayedFriendlyPropertyDragger(Label, property, Field, true); } } @@ -548,52 +548,6 @@ public FoldoutWithOverlay(Foldout foldout, VisualElement overlay, Label overlayL } } - /// - /// A property field with a minimally-sized label that does not respect inspector sizing. - /// Suitable for embedding in a row within the right-hand side of the inspector. - /// - public class CompactPropertyField : VisualElement - { - public Label Label; - public PropertyField Field; - - public CompactPropertyField(SerializedProperty property) : this(property, property.displayName) {} - - public CompactPropertyField(SerializedProperty property, string label, float minLabelWidth = 0) - { - style.flexDirection = FlexDirection.Row; - style.flexGrow = 1; - if (!string.IsNullOrEmpty(label)) - Label = AddChild(this, new Label(label) - { tooltip = property?.tooltip, style = { alignSelf = Align.Center, minWidth = minLabelWidth }}); - Field = AddChild(this, new PropertyField(property, "") { style = { flexGrow = 1, flexBasis = 20 } }); - if (Label != null) - AddDelayedFriendlyPropertyDragger(Label, property, Field, true); - } - } - - /// - /// A row containing a property field. Suitable for adding widgets nest to the property field. - /// - public static LabeledRow PropertyRow( - SerializedProperty property, out PropertyField propertyField, string label = null) - { - var row = new LabeledRow(label ?? property.displayName, property.tooltip); - var field = propertyField = row.Contents.AddChild(new PropertyField(property, "") - { style = { flexGrow = 1, flexBasis = SingleLineHeight * 5 }}); - AddDelayedFriendlyPropertyDragger(row.Label, property, propertyField, true); - - // Kill any left margin that gets inserted into the property field - field.OnInitialGeometry(() => - { - var children = field.Children().GetEnumerator(); - if (children.MoveNext()) - children.Current.style.marginLeft = 0; - children.Dispose(); - }); - return row; - } - public static VisualElement HelpBoxWithButton( string message, HelpBoxMessageType messageType, string buttonText, Action onClicked, ContextualMenuManipulator contextMenu = null)