24 #ifndef USDSHADE_GENERATED_MATERIALBINDINGAPI_H 25 #define USDSHADE_GENERATED_MATERIALBINDINGAPI_H 30 #include "pxr/usd/usdShade/api.h" 39 #include <tbb/concurrent_unordered_map.h> 41 #include "pxr/base/vt/value.h" 48 #include "pxr/base/tf/type.h" 50 PXR_NAMESPACE_OPEN_SCOPE
198 Get(
const UsdStagePtr &stage,
const SdfPath &path);
251 static const TfType &_GetStaticTfType();
253 static bool _IsTypedSchema();
257 const TfType &_GetTfType()
const override;
330 return _materialPath;
341 return _materialPurpose;
406 return _collectionPath;
411 return _materialPath;
431 using CollectionBindingVector = std::vector<CollectionBinding>;
498 const TfToken &bindingStrength);
622 const TfToken &materialPurpose)
const;
639 const TfToken &materialPurpose)
const;
695 tbb::concurrent_unordered_map<
SdfPath,
696 std::unique_ptr<UsdCollectionAPI::MembershipQuery>, SdfPath::Hash>;
715 CollectionBindingVector restrictedPurposeCollBindings;
718 CollectionBindingVector allPurposeCollBindings;
729 std::unique_ptr<BindingsAtPrim>, SdfPath::Hash>;
833 const std::vector<UsdPrim> &prims,
835 std::vector<UsdRelationship> *bindingRels=
nullptr);
909 const VtIntArray &indices,
954 const TfToken &materialPurpose)
const;
958 const TfToken &materialPurpose)
const;
963 CollectionBindingVector _GetCollectionBindings(
967 PXR_NAMESPACE_CLOSE_SCOPE
USDSHADE_API bool RemovePrimFromBindingCollection(const UsdPrim &prim, const TfToken &bindingName, const TfToken &materialPurpose) const
Removes the specified prim from the collection targeted by the binding relationship corresponding to ...
const TfToken & GetMaterialPurpose() const
Returns the purpose of the direct binding.
USDSHADE_API std::vector< UsdGeomSubset > GetMaterialBindSubsets()
Returns all the existing GeomSubsets with familyName=UsdShadeTokens->materialBind below this prim.
static USDSHADE_API bool SetMaterialBindingStrength(const UsdRelationship &bindingRel, const TfToken &bindingStrength)
Sets the 'bindMaterialAs' token-valued metadata on the given binding relationship.
static USDSHADE_API TfTokenVector GetMaterialPurposes()
Returns a vector of the possible values for the 'material purpose'.
This struct is used to represent a collection-based material binding, which contains two objects - a ...
tbb::concurrent_unordered_map< SdfPath, std::unique_ptr< UsdCollectionAPI::MembershipQuery >, SdfPath::Hash > CollectionQueryCache
An unordered list of collection paths mapped to the associated collection's MembershipQuery object.
const SdfPath & GetMaterialPath() const
Returns the path to the material that is bound to by this binding.
static USDSHADE_API std::vector< UsdShadeMaterial > ComputeBoundMaterials(const std::vector< UsdPrim > &prims, const TfToken &materialPurpose=UsdShadeTokens->allPurpose, std::vector< UsdRelationship > *bindingRels=nullptr)
Static API for efficiently and concurrently computing the resolved material bindings for a vector of ...
static USDSHADE_API TfToken GetMaterialBindingStrength(const UsdRelationship &bindingRel)
Resolves the 'bindMaterialAs' token-valued metadata on the given binding relationship and returns it.
The base class for all API schemas.
const SdfPath & GetCollectionPath() const
Returns the path to the collection that is bound by this binding.
USDSHADE_API UsdCollectionAPI GetCollection() const
Constructs and returns the CollectionAPI object for the collection that is bound by this collection-b...
USDSHADE_API bool Bind(const UsdShadeMaterial &material, const TfToken &bindingStrength=UsdShadeTokens->fallbackStrength, const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Authors a direct binding to the given material on this prim.
tbb::concurrent_unordered_map< SdfPath, std::unique_ptr< BindingsAtPrim >, SdfPath::Hash > BindingsCache
An unordered list of prim-paths mapped to the corresponding set of bindings at the associated prim.
USDSHADE_API UsdRelationship GetCollectionBindingRel(const TfToken &bindingName, const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Returns the collection-based material-binding relationship with the given bindingName and materialPur...
DirectBinding()
Default constructor initializes a DirectBinding object with invalid material and bindingRel data memb...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
UsdShadeMaterialBindingAPI is an API schema that provides an interface for binding materials to prims...
USDSHADE_API DirectBinding GetDirectBinding(const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Computes and returns the direct binding for the given material purpose on this prim.
const UsdRelationship & GetBindingRel() const
Returns the binding-relationship that represents this direct binding.
USDSHADE_API std::vector< UsdRelationship > GetCollectionBindingRels(const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Returns the list of collection-based material binding relationships on this prim for the given materi...
Token for efficient comparison, assignment, and hashing of known strings.
bool IsValid() const
Returns true if the CollectionBinding points to a non-empty material path and collection.
This is a general purpose API schema, used to describe a collection of heterogeneous objects within t...
USDGEOM_API TfStaticData< UsdGeomTokensType > UsdGeomTokens
A global variable with static, efficient TfTokens for use in all public USD API.
static USDSHADE_API UsdShadeMaterialBindingAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdShadeMaterialBindingAPI holding the prim adhering to this schema at path on stage.
USDSHADE_API bool UnbindAllBindings() const
Unbinds all direct and collection-based bindings on this prim.
USDSHADE_API bool SetMaterialBindSubsetsFamilyType(const TfToken &familyType)
Author the familyType of the "materialBind" family of GeomSubsets on this prim.
USDSHADE_API UsdShadeMaterial GetMaterial() const
Constructs and returns the material object that this collection-based binding binds to.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
bool IsBound() const
Returns true if there is a material bound.
static USDSHADE_API UsdShadeMaterialBindingAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
std::vector< TfToken > TfTokenVector
Convenience types.
USDSHADE_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
A path value used to locate objects in layers or scenegraphs.
USDSHADE_API CollectionBindingVector GetCollectionBindings(const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Returns all the collection-based bindings on this prim for the given material purpose.
USDSHADE_API TfStaticData< UsdShadeTokensType > UsdShadeTokens
A global variable with static, efficient TfTokens for use in all public USD API.
std::unique_ptr< DirectBinding > DirectBindingPtr
Alias for a unique_ptr to a DirectBinding object.
USDSHADE_API UsdRelationship GetDirectBindingRel(const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Returns the direct material-binding relationship on this prim for the given material purpose.
static USDSHADE_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
CollectionBinding()
Default constructor initializes a CollectionBinding object with invalid collection,...
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
virtual USDSHADE_API ~UsdShadeMaterialBindingAPI()
Destructor.
Contains an asset path and an optional resolved path.
Encodes a subset of a piece of geometry (i.e.
USDSHADE_API UsdShadeMaterial ComputeBoundMaterial(BindingsCache *bindingsCache, CollectionQueryCache *collectionQueryCache, const TfToken &materialPurpose=UsdShadeTokens->allPurpose, UsdRelationship *bindingRel=nullptr) const
Computes the resolved bound material for this prim, for the given material purpose.
static USDSHADE_API bool IsCollectionBindingRel(const UsdRelationship &bindingRel)
Checks if the bindingRel identifies a collection.
UsdShadeMaterialBindingAPI(const UsdSchemaBase &schemaObj)
Construct a UsdShadeMaterialBindingAPI on the prim held by schemaObj .
USDSHADE_API UsdShadeMaterial GetMaterial() const
Gets the material object that this direct binding binds to.
USDSHADE_API bool AddPrimToBindingCollection(const UsdPrim &prim, const TfToken &bindingName, const TfToken &materialPurpose) const
Adds the specified prim to the collection targeted by the binding relationship corresponding to given...
friend struct BindingsAtPrim
BindingsAtPrim needs to invoke private _GetCollectionBindings().
TfType represents a dynamic runtime type.
Singleton registry that provides access to schema type information and the prim definitions for regis...
A Material provides a container into which multiple "render targets" can add data that defines a "sha...
UsdShadeMaterialBindingAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdShadeMaterialBindingAPI on UsdPrim prim .
The base class for all schema types in Usd.
USDSHADE_API UsdGeomSubset CreateMaterialBindSubset(const TfToken &subsetName, const VtIntArray &indices, const TfToken &elementType=UsdGeomTokens->face)
Creates a GeomSubset named subsetName with element type, elementType and familyName materialBind belo...
USDSHADE_API bool UnbindDirectBinding(const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Unbinds the direct binding for the given material purpose (materialPurpose) on this prim.
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
USDSHADE_API bool UnbindCollectionBinding(const TfToken &bindingName, const TfToken &materialPurpose=UsdShadeTokens->allPurpose) const
Unbinds the collection-based binding with the given bindingName, for the given materialPurpose on thi...
static USDSHADE_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
static USDSHADE_API const SdfPath GetResolvedTargetPathFromBindingRel(const UsdRelationship &bindingRel)
returns the path of the resolved target identified by bindingRel.
const UsdRelationship & GetBindingRel() const
Returns the binding-relationship that represents this collection- based binding.
const SdfPath & GetMaterialPath() const
Returns the path to the material that is bound to by this direct binding.
USDSHADE_API TfToken GetMaterialBindSubsetsFamilyType()
Returns the familyType of the family of "materialBind" GeomSubsets on this prim.
static USDSHADE_API bool CanContainPropertyName(const TfToken &name)
Test whether a given name contains the "material:binding:" prefix.
This class represents a direct material binding.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...