diff --git a/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py b/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py index 5bd4576222..7893c311b9 100644 --- a/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py +++ b/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py @@ -4001,5 +4001,29 @@ def testRoundTripArnoldLight( self ) : self.assertIn( "__lights", root.setNames() ) self.assertEqual( root.readSet( "__lights" ), IECore.PathMatcher( [ "/light" ] ) ) + def testAlembicIndices( self ) : + + root = IECoreScene.SceneInterface.create( os.path.dirname( __file__ ) + "/data/alembicIndices.usda", IECore.IndexedIO.OpenMode.Read ) + + cube = root.child( "cube" ) + self.assertEqual( cube.attributeNames(), [] ) + self.assertFalse( cube.hasAttribute( "primvars:custom:indices" ) ) + + primitive = cube.readObject( 1.0 ) + self.assertEqual( + set( primitive.keys() ), + { "P", "N", "uv", "custom" } + ) + comparison = IECoreScene.PrimitiveVariable( + IECoreScene.PrimitiveVariable.Interpolation.FaceVarying, + IECore.Color3fVectorData( + [ imath.Color3f( 1, 0, 0 ), imath.Color3f( 0, 1, 0 ), imath.Color3f( 0, 0, 1 ), + imath.Color3f( 1, 1, 0 ), imath.Color3f( 0, 1, 1 ), imath.Color3f( 1, 1, 1 ) ] + ), + IECore.IntVectorData( [ 1, 1, 1, 1, 4, 4, 4, 4, 0, 0, 0, 0, 5, 5, 5, 5, 2, 2, 2, 2, 3, 3, 3, 3 ] ) + ) + self.assertEqual( primitive["custom"], comparison ) + self.assertEqual( primitive["custom"].indices(), comparison.indices() ) + if __name__ == "__main__": unittest.main() diff --git a/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc new file mode 100644 index 0000000000..dac2ca9e07 Binary files /dev/null and b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc differ diff --git a/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda new file mode 100644 index 0000000000..b71d112909 --- /dev/null +++ b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda @@ -0,0 +1,8 @@ +#usda 1.0 + +def Mesh "cube" ( + references = @./alembicIndices.abc@ +) +{ +} +