Refactor Cutout Tool to Use World Space Edge Length
- Replaced the Mesh Detail parameter with a new Edge Length property to define cutout sampling in physical units. - Introduced Minimum Relative Edge Length preference to control effective spacing based on the bounding box of the cutout content. - Updated tests to validate the new edge length functionality and ensure consistent behavior across different resolutions and canvas sizes. - Removed deprecated parameters and adjusted related properties to align with the new edge length implementation. - Enhanced geometry sampling logic to utilize effective world spacing for both standard and fine outline modes.
This commit is contained in:
@@ -178,7 +178,7 @@ class AddonRegistrationTest(BlenderTestCase):
|
||||
drawn_settings,
|
||||
[
|
||||
"cutout_gesture",
|
||||
"cutout_mesh_detail",
|
||||
"cutout_edge_length",
|
||||
"cutout_fine_outline",
|
||||
"cutout_alpha_threshold",
|
||||
"cutout_generate_normal",
|
||||
@@ -226,7 +226,7 @@ class AddonRegistrationTest(BlenderTestCase):
|
||||
"radius",
|
||||
},
|
||||
)
|
||||
self.assertEqual(settings["cutout_mesh_detail"]["default"], "LOW")
|
||||
self.assertEqual(settings["cutout_edge_length"]["default"], 0.1)
|
||||
self.assertFalse(settings["cutout_fine_outline"]["default"])
|
||||
self.assertFalse(cutout_module.CutoutSelectionToShape.__annotations__["fine_outline"]["default"])
|
||||
self.assertEqual(settings["cutout_alpha_threshold"]["default"], 0.9)
|
||||
@@ -235,18 +235,10 @@ class AddonRegistrationTest(BlenderTestCase):
|
||||
self.assertEqual(settings["cutout_alpha_threshold"]["soft_min"], 0.1)
|
||||
self.assertEqual(settings["cutout_alpha_threshold"]["soft_max"], 0.9)
|
||||
self.assertEqual(settings["cutout_alpha_threshold"]["subtype"], "FACTOR")
|
||||
self.assertEqual(
|
||||
[item[:2] for item in settings["cutout_mesh_detail"]["items"]],
|
||||
[
|
||||
("LOW", "Low"),
|
||||
("MEDIUM", "Medium"),
|
||||
("HIGH", "High"),
|
||||
("ULTRA", "Ultra"),
|
||||
],
|
||||
)
|
||||
self.assertEqual(settings["cutout_edge_length"]["unit"], "LENGTH")
|
||||
self.assertFalse(settings["cutout_generate_normal"]["default"])
|
||||
self.assertEqual(
|
||||
settings["cutout_mesh_detail"]["name"], "Mesh Detail"
|
||||
settings["cutout_edge_length"]["name"], "Edge Length"
|
||||
)
|
||||
self.assertEqual(
|
||||
settings["cutout_generate_normal"]["name"],
|
||||
@@ -287,7 +279,7 @@ class AddonRegistrationTest(BlenderTestCase):
|
||||
|
||||
settings = self.anyimage.properties.AnyImageSettings.__annotations__
|
||||
self.assertEqual(set(settings), {
|
||||
"cutout_gesture", "cutout_alpha_threshold", "cutout_mesh_detail", "cutout_fine_outline",
|
||||
"cutout_gesture", "cutout_alpha_threshold", "cutout_edge_length", "cutout_fine_outline",
|
||||
"cutout_generate_normal", "mask_gesture",
|
||||
"mask_mode", "mask_radius",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user