Fix #132465: Align Alembic/USD crease values with that of OpenSubdiv

In order to better interop with the broader Alembic/USD ecosystem, align
the crease values we export with what we believe is expected by native
OpenSubdiv, a 0-10 range.

On import we will translate the native OpenSubdiv range back into
Blender's 0-1 range.

To account for SubD assets produced by Blender before this change, a
compat check is put in place for both Alembic and USD to use the old
methodology when encountering such files. The compat check makes use
of the Blender version we place inside the format's metadata fields. Old
assets loaded into a new Blender will look ok. New assets loaded into an
old Blender would need to be reworked.

Pull Request: https://projects.blender.org/blender/blender/pulls/132582
This commit is contained in:
Jesse Yurkovich
2025-02-03 04:38:58 +01:00
committed by Jesse Yurkovich
parent a647bb2533
commit 3c9a71b46f
13 changed files with 96 additions and 34 deletions

View File

@@ -784,7 +784,7 @@ class USDExportTest(AbstractUSDTest):
self.assertEqual(len(usd_vert_sharpness), 7)
# A 1.0 crease is INFINITE (10) in USD
self.assertAlmostEqual(min(usd_vert_sharpness), 0.1, 5)
self.assertEqual(len([sharp for sharp in usd_vert_sharpness if sharp < 1]), 6)
self.assertEqual(len([sharp for sharp in usd_vert_sharpness if sharp < 10]), 6)
self.assertEqual(len([sharp for sharp in usd_vert_sharpness if sharp == 10]), 1)
mesh = UsdGeom.Mesh(stage.GetPrimAtPath("/root/crease_edge/crease_edge"))
@@ -799,7 +799,7 @@ class USDExportTest(AbstractUSDTest):
self.assertEqual(len(usd_crease_sharpness), 10)
# A 1.0 crease is INFINITE (10) in USD
self.assertAlmostEqual(min(usd_crease_sharpness), 0.1, 5)
self.assertEqual(len([sharp for sharp in usd_crease_sharpness if sharp < 1]), 9)
self.assertEqual(len([sharp for sharp in usd_crease_sharpness if sharp < 10]), 9)
self.assertEqual(len([sharp for sharp in usd_crease_sharpness if sharp == 10]), 1)
def test_export_mesh_triangulate(self):