Skip to content

Commit 67eced6

Browse files
committed
Don't show SmartLink specific options when SmartLink is disabled
1 parent 4d8dfeb commit 67eced6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Editor/MeshSimplifierOptionsDrawer.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,23 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
1717

1818
root.BindProperty(property);
1919
var resetOptionsButton = root.Q<Button>("ResetOptionsButton");
20+
21+
var enableSmartLinkToggle = root.Q<Toggle>("EnableSmartLinkToggle");
22+
var smartLinkOptionsGroup = root.Q<GroupBox>("SmartLinkOptionsGroup");
23+
2024
resetOptionsButton.clicked += () =>
2125
{
2226
property.boxedValue = MeshSimplifierOptions.Default;
2327
property.serializedObject.ApplyModifiedProperties();
2428
};
29+
30+
enableSmartLinkToggle.RegisterValueChangedCallback(changeEvent =>
31+
{
32+
smartLinkOptionsGroup.style.display = changeEvent.newValue ? DisplayStyle.Flex : DisplayStyle.None;
33+
34+
});
35+
36+
2537
return root;
2638
}
2739
}

Editor/MeshSimplifierOptionsDrawer.uxml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
<ui:Toggle label="Preserve Border Edges" binding-path="PreserveBorderEdges" />
33
<ui:Toggle label="Preserve Surface Curvature" binding-path="PreserveSurfaceCurvature" />
44
<ui:Toggle label="Use Barycentric Coordinate Interpolation" binding-path="UseBarycentricCoordinateInterpolation" />
5-
<ui:Toggle label="Enable Smart Link" binding-path="EnableSmartLink" value="true" />
65
<ui:Slider label="Min Normal Dot" high-value="1" binding-path="MinNormalDot" low-value="-1" />
7-
<ui:FloatField label="Vertex Link Distance" value="0.001" binding-path="VertexLinkDistance" />
8-
<ui:Slider label="Vertex Link Min Normal Dot" high-value="1" binding-path="VertexLinkMinNormalDot" low-value="-1" />
9-
<ui:FloatField label="Vertex Link Color Distance" value="0.01" binding-path="VertexLinkColorDistance" />
10-
<ui:Slider label="Vertex Link UV Distance" high-value="1.414214" binding-path="VertexLinkUvDistance" low-value="0" />
6+
<ui:Toggle label="Enable Smart Link" binding-path="EnableSmartLink" value="true" name="EnableSmartLinkToggle" />
7+
<ui:GroupBox text="Smart Link Options" name="SmartLinkOptionsGroup">
8+
<ui:FloatField label="Vertex Link Distance" value="0.001" binding-path="VertexLinkDistance" name="FloatField" />
9+
<ui:Slider label="Vertex Link Min Normal Dot" high-value="1" binding-path="VertexLinkMinNormalDot" low-value="-1" />
10+
<ui:FloatField label="Vertex Link Color Distance" value="0.01" binding-path="VertexLinkColorDistance" />
11+
<ui:Slider label="Vertex Link UV Distance" high-value="1.414214" binding-path="VertexLinkUvDistance" low-value="0" />
12+
</ui:GroupBox>
1113
<ui:Button text="Reset Options" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResetOptionsButton" enable-rich-text="false" />
1214
</ui:UXML>

0 commit comments

Comments
 (0)