Skip to content

Commit 8a1776b

Browse files
committed
USDScene : Apply UsdShadeMaterialBindingAPI schema as necessary
This prevents warnings like the following : ``` Found material bindings on prim...but MaterialBindingAPI is not applied on the prim ``` We now run the tests with `USD_SHADE_MATERIAL_BINDING_API_CHECK=strict` so that they would fail if we didn't apply the schema, preparing us for a future USD version where `strict` becomes the default behaviour.
1 parent c73ab69 commit 8a1776b

File tree

8 files changed

+23
-6
lines changed

8 files changed

+23
-6
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
10.4.x.x (relative to 10.4.7.0)
22
========
33

4+
Fixes
5+
-----
6+
7+
- USDScene : The UsdShadeMaterialBindingAPI schema is now applied to all prims with material bindings, making the written files compatible with `USD_SHADE_MATERIAL_BINDING_API_CHECK=strict` mode.
48

59
10.4.7.0 (relative to 10.4.6.0)
610
========

SConstruct

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,6 +3121,7 @@ if doConfigure :
31213121

31223122
usdTestEnv["ENV"]["PYTHONPATH"] += os.pathsep + usdPythonPath
31233123
usdTestEnv["ENV"][testEnv["TEST_LIBRARY_PATH_ENV_VAR"]] += os.pathsep + usdLibPath
3124+
usdTestEnv["ENV"]["USD_SHADE_MATERIAL_BINDING_API_CHECK"] = "strict"
31243125

31253126
# setup pluginInfo for custom file format registration
31263127
testSdfPlugInfo = os.path.join( os.getcwd(), "plugins", "usd", "plugInfo.json" )

contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ USDScene::~USDScene()
667667
}
668668

669669
// Bind the material to this location
670-
pxr::UsdShadeMaterialBindingAPI( m_location->prim ).Bind( mat, pxr::UsdShadeTokens->fallbackStrength, purpose );
670+
pxr::UsdShadeMaterialBindingAPI::Apply( m_location->prim ).Bind(
671+
mat, pxr::UsdShadeTokens->fallbackStrength, purpose
672+
);
671673
}
672674
}
673675
catch( std::exception &e )

contrib/IECoreUSD/test/IECoreUSD/data/arnoldArrayInputs.usda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#usda 1.0
22

3-
def Sphere "sphere"
3+
def Sphere "sphere" (
4+
prepend apiSchemas = ["MaterialBindingAPI"]
5+
)
46
{
57
rel material:binding = </rampSurface>
68
}

contrib/IECoreUSD/test/IECoreUSD/data/exposedShaderInput.usda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
def "model"
44
{
55

6-
def Sphere "sphere"
6+
def Sphere "sphere" (
7+
prepend apiSchemas = ["MaterialBindingAPI"]
8+
)
79
{
810
rel material:binding = </model/materials/material1>
911
}

contrib/IECoreUSD/test/IECoreUSD/data/materialPurpose.usda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
def "model"
44
{
55

6-
def Sphere "sphere"
6+
def Sphere "sphere" (
7+
prepend apiSchemas = ["MaterialBindingAPI"]
8+
)
79
{
810
rel material:binding = </model/materials/material>
911
rel material:binding:full = </model/materials/fullMaterial>

contrib/IECoreUSD/test/IECoreUSD/data/shaderParentLoc.usda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#usda 1.0
22

3-
def Xform "shaderLocation"
3+
def Xform "shaderLocation" (
4+
prepend apiSchemas = ["MaterialBindingAPI"]
5+
)
46
{
57
rel material:binding = </shaderLocation/materials/testMat>
68

contrib/IECoreUSD/test/IECoreUSD/data/textureParameters.usda

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
def "model"
44
{
55

6-
def Sphere "sphere"
6+
def Sphere "sphere" (
7+
prepend apiSchemas = ["MaterialBindingAPI"]
8+
)
79
{
810
rel material:binding = </model/materials/textureParameterTest>
911
}

0 commit comments

Comments
 (0)