ModelTranslator: uvpm_mode_label——UVPM4 排布生效的 UV 模式标注

This commit is contained in:
ud18010
2026-07-20 12:20:58 +08:00
parent b0c1aeac55
commit 4e948ffc50
2 changed files with 16 additions and 0 deletions
+5
View File
@@ -33,6 +33,11 @@ def uv_gate_ok(flipped, overlap):
return flipped <= UV_FLIP_TOL and (overlap or 0.0) <= UV_OVERLAP_TOL return flipped <= UV_FLIP_TOL and (overlap or 0.0) <= UV_OVERLAP_TOL
def uvpm_mode_label(base, applied):
"""UV 模式标注:UVPackmaster 排布生效时加 +uvpm 后缀。"""
return base + "+uvpm" if applied else base
def count_islands(n_faces, adjacent_pairs): def count_islands(n_faces, adjacent_pairs):
"""union-find 数 UV 岛:n_faces 个面,adjacent_pairs 为 UV 连续的面索引对。""" """union-find 数 UV 岛:n_faces 个面,adjacent_pairs 为 UV 连续的面索引对。"""
parent = list(range(n_faces)) parent = list(range(n_faces))
@@ -92,5 +92,16 @@ class TestUvGateOk(unittest.TestCase):
self.assertTrue(bd.uv_gate_ok(0.01, None)) self.assertTrue(bd.uv_gate_ok(0.01, None))
class TestUvpmModeLabel(unittest.TestCase):
def test_applied_appends_suffix(self):
self.assertEqual(bd.uvpm_mode_label("seam", True), "seam+uvpm")
self.assertEqual(bd.uvpm_mode_label("smart", True), "smart+uvpm")
self.assertEqual(bd.uvpm_mode_label("smart_fallback", True), "smart_fallback+uvpm")
def test_not_applied_keeps_base(self):
self.assertEqual(bd.uvpm_mode_label("seam", False), "seam")
self.assertEqual(bd.uvpm_mode_label("smart_fallback", False), "smart_fallback")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()