Skip to content

Commit

Permalink
IECoreUSD : Alembic referenced in a USD stage places the indices of a…
Browse files Browse the repository at this point in the history
…n indexed primitive variable into an attribute
  • Loading branch information
boberfly committed Apr 20, 2024
1 parent 5dedde4 commit caf70ae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4001,5 +4001,26 @@ 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 )] ) [ imath.Color3f( 1, 2, 3 ) ]
)
self.assertEqual( primitive["custom"], comparison )
self.assertEqual( primitive["custom"].indices(), comparison.indices() )

if __name__ == "__main__":
unittest.main()
Binary file not shown.
8 changes: 8 additions & 0 deletions contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#usda 1.0

def Mesh "cube" (
references = @./alembicIndices.abc@
)
{
}

0 comments on commit caf70ae

Please sign in to comment.