Skip to content

Commit

Permalink
merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
glabute committed May 31, 2024
1 parent e94aece commit 5524ac0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
50 changes: 2 additions & 48 deletions com.unity.cinemachine/Editor/Utility/InspectorUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -548,52 +548,6 @@ public FoldoutWithOverlay(Foldout foldout, VisualElement overlay, Label overlayL
}
}

/// <summary>
/// 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.
/// </summary>
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);
}
}

/// <summary>
/// A row containing a property field. Suitable for adding widgets nest to the property field.
/// </summary>
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)
Expand Down

0 comments on commit 5524ac0

Please sign in to comment.