-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update UsdShadeMaterialBinding::ComputeBoundMaterial
- Previous if the target material on the material binding relationship was "unloaded/deactivated" that is not found on the stage, then the ComputeBoundMaterial logic used to not consider this as the winning binding even though all rules were satisfied for the binding to be a winning binding. - In the new and more correct approach, instead of checking on the validity of the Material prim on the stage, it checks if the target path for the binding being considered is a valid path (non-empty path). This makes sure the boundMaterial and the winning binding relationship remains the same irrespective of the load/unload (active/deactivated) state of the target prim on the material binding relationship. If the prim at target path exists on stage but is not a UsdShadeMaterial, ComputeBoundMaterial returns an invalid UsdShadeMaterial but with still with the bindingRel targeting the prim. - Adds static UsdShadeMaterialBinding::GetResolvedTargetPathFromBindingRel This can help client get to the path of the target of the winning binding relationship specially when no valid Material Prim exists at the target path of the bindingRel returned by ComputeMaterialBound. - Adds a helper static UsdShadeMaterialBinding::CollectionBinding::IsCollectionBindingRel To check if the bindingRel returned by ComputeBoundMaterial a relationship idenitifying a collection or not. (Internal change: 2248004)
- Loading branch information
1 parent
6246934
commit 1618739
Showing
7 changed files
with
325 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
pxr/usd/usdShade/testenv/testUsdShadeMaterialBinding/testDeactivatedMaterialBindings.usda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#usda 1.0 | ||
|
||
def Xform "Geometry" ( | ||
prepend apiSchemas = ["MaterialBindingAPI"] | ||
) | ||
{ | ||
rel material:binding = </Looks/GlobalMat1> | ||
|
||
def Xform "InnerScope" | ||
{ | ||
def Sphere "gprim" ( | ||
prepend apiSchemas = ["MaterialBindingAPI"] | ||
) | ||
{ | ||
rel material:binding = </Looks/DeactivatedLooks1/GlobalMat1> | ||
} | ||
} | ||
} | ||
|
||
def Scope "Collections" ( | ||
prepend apiSchemas = ["CollectionAPI:Set1", "CollectionAPI:Set2", "MaterialBindingAPI"] | ||
) | ||
{ | ||
uniform token collection:Set1:expansionRule = "expandPrims" | ||
rel collection:Set1:includes = [ | ||
</Collections/s1>, | ||
</Collections/c1>, | ||
] | ||
|
||
uniform token collection:Set2:expansionRule = "expandPrims" | ||
rel collection:Set2:includes = [ | ||
</Collections/s2>, | ||
</Collections/Cubes>, | ||
] | ||
rel collection:Set2:excludes = </Collections/Cubes/c2e> | ||
|
||
rel material:binding:collection:bindSet2 = [ | ||
</Collections.collection:Set2>, | ||
</OverPrims/GlobalMat1> | ||
] | ||
|
||
rel material:binding:collection:bindSet1 = [ | ||
</Collections.collection:Set1>, | ||
</Looks/DeactivatedLooks2/GlobalMat1> | ||
] | ||
|
||
rel material:binding = </Looks/GlobalMat1> | ||
|
||
def Sphere "s1" | ||
{ | ||
} | ||
|
||
def Cube "c1" | ||
{ | ||
} | ||
|
||
def Sphere "s2" | ||
{ | ||
} | ||
|
||
def Xform "Cubes" | ||
{ | ||
def Cube "c2" | ||
{ | ||
} | ||
|
||
def Cube "c2e" | ||
{ | ||
} | ||
} | ||
} | ||
|
||
def Scope "OverPrims" | ||
{ | ||
over "GlobalMat1" | ||
{ | ||
|
||
} | ||
} | ||
|
||
def Scope "Looks" | ||
{ | ||
def Material "GlobalMat1" ( | ||
) | ||
{ | ||
} | ||
|
||
def Scope "DeactivatedLooks1" ( | ||
active = false | ||
) | ||
{ | ||
def Material "GlobalMat1" ( | ||
) | ||
{ | ||
} | ||
} | ||
def Scope "DeactivatedLooks2" ( | ||
active = false | ||
) | ||
{ | ||
def Material "GlobalMat1" ( | ||
) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.