Skip to content

Commit

Permalink
IECoreUSD::PointInstancerAlgo : Support inactive / invisible ids
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldresser-ie committed Oct 9, 2024
1 parent e8bc39a commit 995de90
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
10.5.x.x (relative to 10.5.9.2)
========


Improvements
------------
- USDScene : PointInstancers are now loaded with invisibleIds and inactiveIds as primitive variables.


10.5.9.2 (relative to 10.5.9.1)
Expand Down
13 changes: 13 additions & 0 deletions contrib/IECoreUSD/src/IECoreUSD/PointInstancerAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ IECore::ObjectPtr readPointInstancer( pxr::UsdGeomPointInstancer &pointInstancer
Canceller::check( canceller );
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetAngularVelocitiesAttr(), time, newPoints.get(), "angularVelocity" );

DataPtr cortexInvisIds = DataAlgo::fromUSD( pointInstancer.GetInvisibleIdsAttr(), time, true );
if( cortexInvisIds )
{
newPoints->variables["invisibleIds"] = IECoreScene::PrimitiveVariable( PrimitiveVariable::Constant, cortexInvisIds );
}

pxr::SdfInt64ListOp inactiveIdsListOp;
pointInstancer.GetPrim().GetMetadata( pxr::UsdGeomTokens->inactiveIds, &inactiveIdsListOp );
newPoints->variables["inactiveIds"] = IECoreScene::PrimitiveVariable(
PrimitiveVariable::Constant,
new IECore::Int64VectorData( inactiveIdsListOp.GetExplicitItems() )
);

// Prototype paths

pxr::SdfPathVector targets;
Expand Down
6 changes: 6 additions & 0 deletions contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3665,6 +3665,9 @@ def testPointInstancerPrimvars( self ) :
[ ( c, c, c ) for c in range( 1, 6 ) ]
)

points.DeactivateIds( [ 0, 2 ] )
points.InvisIds( [ 1, 4 ], 0 )

stage.GetRootLayer().Save()

# Check we can load the primvar via a SceneInterface.
Expand All @@ -3681,6 +3684,9 @@ def testPointInstancerPrimvars( self ) :
self.assertEqual( points["myColor"].interpolation, IECoreScene.PrimitiveVariable.Interpolation.Vertex )
self.assertEqual( points["myColor"].indices, None )

self.assertEqual( points["inactiveIds"], IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Constant, IECore.Int64VectorData( [ 0, 2 ] ) ) )
self.assertEqual( points["invisibleIds"], IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Constant, IECore.Int64VectorData( [ 1, 4 ] ) ) )

def testArnoldArrayInputs( self ) :

def assertExpectedArrayInputs( network ) :
Expand Down

0 comments on commit 995de90

Please sign in to comment.