Skip to content

Commit 040626d

Browse files
authored
Add reset options button (#17) (#18)
1 parent 5305d9d commit 040626d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Editor/MeshSimplifierOptionsDrawer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public override VisualElement CreatePropertyGUI(SerializedProperty property)
1616
var root = visualTreeAsset.CloneTree();
1717

1818
root.BindProperty(property);
19+
var resetOptionsButton = root.Q<Button>("ResetOptionsButton");
20+
resetOptionsButton.clicked += () =>
21+
{
22+
property.boxedValue = MeshSimplifierOptions.Default;
23+
property.serializedObject.ApplyModifiedProperties();
24+
};
1925
return root;
2026
}
2127
}

Editor/MeshSimplifierOptionsDrawer.uxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
<ui:Slider label="Vertex Link Min Normal Dot" high-value="1" binding-path="VertexLinkMinNormalDot" low-value="-1" />
99
<ui:FloatField label="Vertex Link Color Distance" value="0.01" binding-path="VertexLinkColorDistance" />
1010
<ui:Slider label="Vertex Link UV Distance" high-value="1.414214" binding-path="VertexLinkUvDistance" low-value="0" />
11+
<ui:Button text="Reset Options" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResetOptionsButton" enable-rich-text="false" />
1112
</ui:UXML>

0 commit comments

Comments
 (0)