Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,15 @@ void USDScene::attributesHash( double time, IECore::MurmurHash &h ) const
// Kind can not be animated so no need to update `mightBeTimeVarying`.
}

#if PXR_VERSION >= 2111
if( m_location->prim.HasAPI<pxr::UsdLuxLightAPI>() )
{
/// \todo Consider time-varying lights - see comment below
/// for materials.
haveAttributes = true;
}
#endif

auto doubleSidedAttr = pxr::UsdGeomGprim( m_location->prim ).GetDoubleSidedAttr();
if( doubleSidedAttr && doubleSidedAttr.HasAuthoredValue() )
{
Expand Down
25 changes: 25 additions & 0 deletions contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3186,5 +3186,30 @@ def assertExpected( root ) :
roundTripRoot = IECoreScene.SceneInterface.create( roundTripFileName, IECore.IndexedIO.OpenMode.Read )
assertExpected( roundTripRoot )

def testMultipleLights( self ) :

scene = IECoreScene.SceneInterface.create(
os.path.join( os.path.dirname( __file__ ), "data", "twoLights.usda" ),
IECore.IndexedIO.OpenMode.Read
)

self.assertIn( "__lights", scene.setNames() )
self.assertEqual( scene.readSet( "__lights" ), IECore.PathMatcher( [ "/Light1", "/Light2" ] ) )

hashes = {
scene.child( n ).hash( scene.HashType.AttributesHash, 0 )
for n in [ "NoLight", "Light1", "Light2" ]
}
self.assertEqual( len( hashes ), 3 )

for light, exposure in [
( "Light1", 1 ),
( "Light2", 2 ),
] :
self.assertEqual( scene.child( light ).attributeNames(), [ "light" ] )
attribute = scene.child( light ).readAttribute( "light", 0 )
self.assertIsInstance( attribute, IECoreScene.ShaderNetwork )
self.assertEqual( attribute.outputShader().parameters["exposure"], IECore.FloatData( exposure ) )

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

def Xform "NoLight" ()
{
}

def SphereLight "Light1" (
)
{
float inputs:exposure = 1
}

def SphereLight "Light2" (
)
{
float inputs:exposure = 2
}