Skip to content

Commit

Permalink
Wrapper : Put IECoreUSD plugin in PXR_PLUGINPATH_NAME
Browse files Browse the repository at this point in the history
This will be necessary to pick up the custom metadata registered by ImageEngine/cortex#1188. And that in turn is needed to allow constant primitive variables to round-trip properly in future.
  • Loading branch information
johnhaddon committed Nov 12, 2021
1 parent 04a36f6 commit 053be08
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/gaffer
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ prependToPath "$GAFFER_ROOT/glsl" IECOREGL_SHADER_INCLUDE_PATHS
prependToPath "$GAFFER_ROOT/fonts" IECORE_FONT_PATHS
prependToPath "$HOME/gaffer/ops:$GAFFER_ROOT/ops" IECORE_OP_PATHS

prependToPath "$GAFFER_ROOT/resources/IECoreUSD" PXR_PLUGINPATH_NAME

prependToPath "$HOME/gaffer/opPresets:$GAFFER_ROOT/opPresets" IECORE_OP_PRESET_PATHS
prependToPath "$HOME/gaffer/procedurals:$GAFFER_ROOT/procedurals" IECORE_PROCEDURAL_PATHS
prependToPath "$HOME/gaffer/proceduralPresets:$GAFFER_ROOT/proceduralPresets" IECORE_PROCEDURAL_PRESET_PATHS
Expand Down
26 changes: 26 additions & 0 deletions python/GafferSceneTest/SceneWriterTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,5 +347,31 @@ def testFileNameWithFrameDependency( self ) :
self.assertEqual( plane.numObjectSamples(), 1 )
self.assertEqual( plane.objectSampleTime( 0 ), context.getTime() )

def testUSDConstantPrimitiveVariables( self ) :

plane = GafferScene.Plane()

planeFilter = GafferScene.PathFilter()
planeFilter["paths"].setValue( IECore.StringVectorData( [ "/plane" ] ) )

primitiveVariables = GafferScene.PrimitiveVariables()
primitiveVariables["in"].setInput( plane["out"] )
primitiveVariables["filter"].setInput( planeFilter["out"] )
primitiveVariables["primitiveVariables"].addChild( Gaffer.NameValuePlug( "test", 10 ) )

self.assertEqual( primitiveVariables["out"].object( "/plane" )["test"].data.value, 10 )
self.assertEqual( primitiveVariables["out"].attributes( "/plane" ), IECore.CompoundObject() )

sceneWriter = GafferScene.SceneWriter()
sceneWriter["in"].setInput( primitiveVariables["out"] )
sceneWriter["fileName"].setValue( os.path.join( self.temporaryDirectory(), "test.usda" ) )
sceneWriter["task"].execute()

sceneReader = GafferScene.SceneReader()
sceneReader["fileName"].setInput( sceneWriter["fileName"] )

self.assertEqual( sceneReader["out"].object( "/plane" )["test"].data.value, 10 )
self.assertEqual( sceneReader["out"].attributes( "/plane" ), IECore.CompoundObject() )

if __name__ == "__main__":
unittest.main()

0 comments on commit 053be08

Please sign in to comment.