Skip to content

Commit fde4cd8

Browse files
alex-vazquez-unity3dEvergreen
authored andcommitted
Color Checker tool - Fix Is Metallic Toggle display when the inspector window width is small.
1 parent 11dfa53 commit fde4cd8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Packages/com.unity.render-pipelines.high-definition/Editor/Tools/ColorCheckerToolEditor.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public override VisualElement CreateInspectorGUI()
7272
//Prepare metallic toggles for material mode
7373
for(int i=0; i<12;i++)
7474
{
75-
Toggle metallicToggle = new Toggle() { name ="metallic" + i, label = "is Metallic", tabIndex = i};
75+
Toggle metallicToggle = new Toggle() { name ="metallic" + i, label = "Metallic", tabIndex = i};
76+
metallicToggle.Q<Label>().style.minWidth = 60;
7677
metallicToggle.bindingPath="isMetalBools.Array.data["+i+"]";
7778
metallicToggle.style.display = UnityEngine.UIElements.DisplayStyle.None;//hidden in UI until used
7879
root.Add(metallicToggle);
@@ -94,6 +95,7 @@ public override VisualElement CreateInspectorGUI()
9495
self.UpdateMaterial();
9596
};
9697

98+
9799
onChange(self, root); // Initialize
98100
return root;
99101
}
@@ -127,12 +129,19 @@ void CreateColorFields(ColorCheckerTool target, VisualElement root, Color32[] co
127129
//Creates the Rows Containers
128130
for (int i = 0; i < rows; i++)
129131
{
130-
VisualElement newRow = new VisualElement() { name = "colorfieldsRow" + i };
131-
newRow.style.flexDirection = UnityEngine.UIElements.FlexDirection.Row;
132-
newRow.style.alignItems = UnityEngine.UIElements.Align.FlexStart;
133-
newRow.style.justifyContent = UnityEngine.UIElements.Justify.SpaceAround;
134-
newRow.style.alignSelf = UnityEngine.UIElements.Align.Stretch;
135-
newRow.style.maxHeight = 22;
132+
VisualElement newRow = new()
133+
{
134+
name = "colorfieldsRow" + i,
135+
style =
136+
{
137+
flexDirection = UnityEngine.UIElements.FlexDirection.Row,
138+
alignItems = UnityEngine.UIElements.Align.FlexStart,
139+
justifyContent = UnityEngine.UIElements.Justify.SpaceAround,
140+
alignSelf = UnityEngine.UIElements.Align.Stretch,
141+
maxHeight = 22,
142+
flexWrap = Wrap.Wrap
143+
}
144+
};
136145
colorfieldsRoot.Add(newRow);
137146
}
138147

0 commit comments

Comments
 (0)