Skip to content

Commit

Permalink
USD AttributeAlgo : Don't treat arnold:* light primvars as attributes
Browse files Browse the repository at this point in the history
Since 0590bbf, they have been converted to light parameters instead.
  • Loading branch information
johnhaddon committed Jun 4, 2024
1 parent 45db9e4 commit 1d2bfd6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Fixes

- ShaderNetworkAlgo : Fixed crash caused by cyclic connections in `removeUnusedShaders()`.
- ShaderStateComponent : Fixed GL rendering failures caused by unsupported values for texture parameters.
- USDScene : Fixed exceptions caused by attempt to write shader parameters with unsupported value types.
- USDScene :
- Fixed exceptions caused by attempt to write shader parameters with unsupported value types.
- Fixed duplicate loading of `arnold:*` primvars on lights as attributes. These are now only loaded as parameters on the light shader.
- IECoreUSD::DataAlgo : Fixed exceptions thrown by `toUSD()` and `valueTypeName()` when passed datatypes not supported by `dispatch()`. An empty VtValue or SdfValueTypeName is now returned instead.

Build
Expand Down
13 changes: 13 additions & 0 deletions contrib/IECoreUSD/src/IECoreUSD/AttributeAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
IECORE_PUSH_DEFAULT_VISIBILITY
#include "pxr/usd/usdGeom/primvar.h"
#include "pxr/usd/usdGeom/primvarsAPI.h"

#include "pxr/usd/usdLux/lightAPI.h"
IECORE_POP_DEFAULT_VISIBILITY

using namespace IECoreUSD;
Expand Down Expand Up @@ -92,6 +94,17 @@ bool IECoreUSD::AttributeAlgo::isCortexAttribute( const pxr::UsdGeomPrimvar &pri
}
}

// Check for `arnold:*` primvars on lights. These will be loaded as
// parameters in `ShaderAlgo::readLight()`.

if(
boost::starts_with( primVar.GetPrimvarName().GetString(), "arnold:" ) &&
pxr::UsdLuxLightAPI( primVar.GetAttr().GetPrim() )
)
{
return false;
}

// Everything else should be loaded as a Cortex attribute.

return true;
Expand Down
1 change: 1 addition & 0 deletions contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4165,6 +4165,7 @@ def testArnoldSpecificLightInputs( self ) :

root = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )
self.assertEqual( root.child( "light" ).readAttribute( "light", 0 ), lightShader )
self.assertEqual( root.child( "light" ).attributeNames(), [ "light" ] )

def testTreatLightAsPointOrLine( self ) :

Expand Down

0 comments on commit 1d2bfd6

Please sign in to comment.