Skip to content

Commit 16a16d9

Browse files
committed
IECoreUSD : Alembic referenced in a USD stage places the indices of an indexed primitive variable into an attribute
1 parent 5dedde4 commit 16a16d9

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py

+24
Original file line numberDiff line numberDiff line change
@@ -4001,5 +4001,29 @@ def testRoundTripArnoldLight( self ) :
40014001
self.assertIn( "__lights", root.setNames() )
40024002
self.assertEqual( root.readSet( "__lights" ), IECore.PathMatcher( [ "/light" ] ) )
40034003

4004+
def testAlembicIndices( self ) :
4005+
4006+
root = IECoreScene.SceneInterface.create( os.path.dirname( __file__ ) + "/data/alembicIndices.usda", IECore.IndexedIO.OpenMode.Read )
4007+
4008+
cube = root.child( "cube" )
4009+
self.assertEqual( cube.attributeNames(), [] )
4010+
self.assertFalse( cube.hasAttribute( "primvars:custom:indices" ) )
4011+
4012+
primitive = cube.readObject( 1.0 )
4013+
self.assertEqual(
4014+
set( primitive.keys() ),
4015+
{ "P", "N", "uv", "custom" }
4016+
)
4017+
comparison = IECoreScene.PrimitiveVariable(
4018+
IECoreScene.PrimitiveVariable.Interpolation.FaceVarying,
4019+
IECore.Color3fVectorData(
4020+
[ imath.Color3f( 1, 0, 0 ), imath.Color3f( 0, 1, 0 ), imath.Color3f( 0, 0, 1 ),
4021+
imath.Color3f( 1, 1, 0 ), imath.Color3f( 0, 1, 1 ), imath.Color3f( 1, 1, 1 ) ]
4022+
),
4023+
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 ] )
4024+
)
4025+
self.assertEqual( primitive["custom"], comparison )
4026+
self.assertEqual( primitive["custom"].indices(), comparison.indices() )
4027+
40044028
if __name__ == "__main__":
40054029
unittest.main()
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#usda 1.0
2+
3+
def Mesh "cube" (
4+
references = @./alembicIndices.abc@
5+
)
6+
{
7+
}
8+

0 commit comments

Comments
 (0)