|
A Material provides a container into which multiple "render contexts" can add data that defines a "shading material" for a renderer. More...
#include <material.h>
Public Types | |
Helpful Types | |
typedef std::function< bool(const SdfPath &)> | PathPredicate |
A function type that takes a path and returns a bool. | |
Public Types inherited from UsdShadeNodeGraph | |
typedef std::unordered_map< UsdShadeInput, std::vector< UsdShadeInput >, UsdShadeInput::Hash > | InterfaceInputConsumersMap |
Map of interface inputs to corresponding vectors of inputs that consume their values. | |
typedef std::unordered_map< UsdShadeNodeGraph, InterfaceInputConsumersMap, NodeGraphHasher, NodeGraphEqualFn > | NodeGraphInputConsumersMap |
Map of node-graphs to their associated input-consumers map. | |
Public Member Functions | |
UsdShadeMaterial (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdShadeMaterial on UsdPrim prim . | |
UsdShadeMaterial (const UsdSchemaBase &schemaObj) | |
Construct a UsdShadeMaterial on the prim held by schemaObj . | |
virtual USDSHADE_API | ~UsdShadeMaterial () |
Destructor. | |
USDSHADE_API UsdAttribute | GetSurfaceAttr () const |
Represents the universal "surface" output terminal of a material. | |
USDSHADE_API UsdAttribute | CreateSurfaceAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
See GetSurfaceAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
USDSHADE_API UsdAttribute | GetDisplacementAttr () const |
Represents the universal "displacement" output terminal of a material. | |
USDSHADE_API UsdAttribute | CreateDisplacementAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
See GetDisplacementAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
USDSHADE_API UsdAttribute | GetVolumeAttr () const |
Represents the universal "volume" output terminal of a material. | |
USDSHADE_API UsdAttribute | CreateVolumeAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
See GetVolumeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
Standard Material Terminal Outputs | |
A UsdShadeMaterial can have any number of "terminal" outputs. These outputs are generally used to point to outputs of shader prims or NodeGraphs that describe certain properties of the material that a renderer might wish to consume. There are three standard output terminals that are supported by the core API: surface, displacement and volume. Each terminal output can further be qualified by a token-valued renderContext. When a non-empty renderContext value is specified to the API, the output is considered to have a specific or restricted renderContext. If the renderContext value is empty (i.e. equal to UsdShadeTokens->universalRenderContext), then the output is considered to be a "universal", meaning it could apply to any render contexts. Render context token values is typically driven by the rendering backend consuming the terminal output (eg, RI or glslfx). | |
USDSHADE_API UsdShadeOutput | CreateSurfaceOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Creates and returns the "surface" output on this material for the specified renderContext . | |
USDSHADE_API UsdShadeOutput | GetSurfaceOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Returns the "surface" output of this material for the specified renderContext . | |
USDSHADE_API std::vector< UsdShadeOutput > | GetSurfaceOutputs () const |
Returns the "surface" outputs of this material for all available renderContexts. | |
USDSHADE_API UsdShadeShader | ComputeSurfaceSource (const TfToken &renderContext, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
USDSHADE_API UsdShadeShader | ComputeSurfaceSource (const TfTokenVector &contextVector={UsdShadeTokens->universalRenderContext}, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
Computes the resolved "surface" output source for the given contextVector . | |
USDSHADE_API UsdShadeOutput | CreateDisplacementOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Creates and returns the "displacement" output on this material for the specified renderContext . | |
USDSHADE_API UsdShadeOutput | GetDisplacementOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Returns the "displacement" output of this material for the specified renderContext. | |
USDSHADE_API std::vector< UsdShadeOutput > | GetDisplacementOutputs () const |
Returns the "displacement" outputs of this material for all available renderContexts. | |
USDSHADE_API UsdShadeShader | ComputeDisplacementSource (const TfToken &renderContext, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
USDSHADE_API UsdShadeShader | ComputeDisplacementSource (const TfTokenVector &contextVector={UsdShadeTokens->universalRenderContext}, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
Computes the resolved "displacement" output source for the given contextVector . | |
USDSHADE_API UsdShadeOutput | CreateVolumeOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Creates and returns the "volume" output on this material for the specified renderContext . | |
USDSHADE_API UsdShadeOutput | GetVolumeOutput (const TfToken &renderContext=UsdShadeTokens->universalRenderContext) const |
Returns the "volume" output of this material for the specified renderContext. | |
USDSHADE_API std::vector< UsdShadeOutput > | GetVolumeOutputs () const |
Returns the "volume" outputs of this material for all available renderContexts. | |
USDSHADE_API UsdShadeShader | ComputeVolumeSource (const TfToken &renderContext, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
USDSHADE_API UsdShadeShader | ComputeVolumeSource (const TfTokenVector &contextVector={UsdShadeTokens->universalRenderContext}, TfToken *sourceName=nullptr, UsdShadeAttributeType *sourceType=nullptr) const |
Computes the resolved "volume" output source for the given contextVector . | |
Public Member Functions inherited from UsdShadeNodeGraph | |
UsdShadeNodeGraph (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdShadeNodeGraph on UsdPrim prim . | |
UsdShadeNodeGraph (const UsdSchemaBase &schemaObj) | |
Construct a UsdShadeNodeGraph on the prim held by schemaObj . | |
virtual USDSHADE_API | ~UsdShadeNodeGraph () |
Destructor. | |
USDSHADE_API | UsdShadeNodeGraph (const UsdShadeConnectableAPI &connectable) |
Constructor that takes a ConnectableAPI object. | |
USDSHADE_API UsdShadeConnectableAPI | ConnectableAPI () const |
Contructs and returns a UsdShadeConnectableAPI object with this node-graph. | |
USDSHADE_API UsdShadeOutput | CreateOutput (const TfToken &name, const SdfValueTypeName &typeName) const |
Create an output which can either have a value or can be connected. | |
USDSHADE_API UsdShadeOutput | GetOutput (const TfToken &name) const |
Return the requested output if it exists. | |
USDSHADE_API std::vector< UsdShadeOutput > | GetOutputs (bool onlyAuthored=true) const |
Outputs are represented by attributes in the "outputs:" namespace. | |
USDSHADE_API UsdShadeShader | ComputeOutputSource (const TfToken &outputName, TfToken *sourceName, UsdShadeAttributeType *sourceType) const |
USDSHADE_API UsdShadeInput | CreateInput (const TfToken &name, const SdfValueTypeName &typeName) const |
Create an Input which can either have a value or can be connected. | |
USDSHADE_API UsdShadeInput | GetInput (const TfToken &name) const |
Return the requested input if it exists. | |
USDSHADE_API std::vector< UsdShadeInput > | GetInputs (bool onlyAuthored=true) const |
Returns all inputs present on the node-graph. | |
USDSHADE_API std::vector< UsdShadeInput > | GetInterfaceInputs () const |
Returns all the "Interface Inputs" of the node-graph. | |
USDSHADE_API InterfaceInputConsumersMap | ComputeInterfaceInputConsumersMap (bool computeTransitiveConsumers=false) const |
Walks the namespace subtree below the node-graph and computes a map containing the list of all inputs on the node-graph and the associated vector of consumers of their values. | |
Public Member Functions inherited from UsdTyped | |
UsdTyped (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdTyped on UsdPrim prim . | |
UsdTyped (const UsdSchemaBase &schemaObj) | |
Construct a UsdTyped on the prim held by schemaObj . | |
virtual USD_API | ~UsdTyped () |
Destructor. | |
Public Member Functions inherited from UsdSchemaBase | |
bool | IsConcrete () const |
Returns whether or not this class corresponds to a concrete instantiable prim type in scene description. | |
bool | IsTyped () const |
Returns whether or not this class inherits from UsdTyped. | |
bool | IsAPISchema () const |
Returns whether this is an API schema or not. | |
bool | IsAppliedAPISchema () const |
Returns whether this is an applied API schema or not. | |
bool | IsMultipleApplyAPISchema () const |
Returns whether this is an applied API schema or not. | |
UsdSchemaKind | GetSchemaKind () const |
Returns the kind of schema this class is. | |
USD_API | UsdSchemaBase (const UsdPrim &prim=UsdPrim()) |
Construct and store prim as the held prim. | |
USD_API | UsdSchemaBase (const UsdSchemaBase &otherSchema) |
Construct and store for the same prim held by otherSchema . | |
virtual USD_API | ~UsdSchemaBase () |
Destructor. | |
UsdPrim | GetPrim () const |
Return this schema object's held prim. | |
SdfPath | GetPath () const |
Shorthand for GetPrim()->GetPath(). | |
USD_API const UsdPrimDefinition * | GetSchemaClassPrimDefinition () const |
Return the prim definition associated with this schema instance if one exists, otherwise return null. | |
USD_API | operator bool () const |
Return true if this schema object is compatible with its held prim, false otherwise. | |
Static Public Member Functions | |
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 classes. | |
static USDSHADE_API UsdShadeMaterial | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdShadeMaterial holding the prim adhering to this schema at path on stage . | |
static USDSHADE_API UsdShadeMaterial | Define (const UsdStagePtr &stage, const SdfPath &path) |
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage. | |
Static Public Member Functions inherited from UsdShadeNodeGraph | |
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 classes. | |
static USDSHADE_API UsdShadeNodeGraph | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdShadeNodeGraph holding the prim adhering to this schema at path on stage . | |
static USDSHADE_API UsdShadeNodeGraph | Define (const UsdStagePtr &stage, const SdfPath &path) |
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage. | |
Static Public Member Functions inherited from UsdTyped | |
static USD_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 classes. | |
static USD_API UsdTyped | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdTyped holding the prim adhering to this schema at path on stage . | |
Static Public Member Functions inherited from UsdSchemaBase | |
static const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Attributes | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::ConcreteTyped |
Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdShadeNodeGraph | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::ConcreteTyped |
Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdTyped | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdSchemaBase | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Compile time constant representing what kind of schema this class is. | |
Protected Member Functions | |
USDSHADE_API UsdSchemaKind | _GetSchemaKind () const override |
Returns the kind of schema this class belongs to. | |
Protected Member Functions inherited from UsdShadeNodeGraph | |
USDSHADE_API UsdSchemaKind | _GetSchemaKind () const override |
Returns the kind of schema this class belongs to. | |
Protected Member Functions inherited from UsdTyped | |
USD_API UsdSchemaKind | _GetSchemaKind () const override |
Returns the kind of schema this class belongs to. | |
USD_API bool | _IsCompatible () const override |
Subclasses may override _IsCompatible to do specific compatibility checking with the given prim, such as type compatibility or value compatibility. | |
Protected Member Functions inherited from UsdSchemaBase | |
virtual UsdSchemaKind | _GetSchemaType () const |
const TfType & | _GetType () const |
USD_API UsdAttribute | _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const |
Friends | |
class | UsdSchemaRegistry |
Authoring Material Variations | |
Each UsdShadeMaterial prim can host data for any number of render targets (such as Renderman RIS, Arnold, or glslfx). A single UsdShadeMaterial group can, however, encode variations on appearance, varying any data authored on the material and its contents. For example, we might have a logo'd baseball cap that comes in denim, nylon, and corduroy variations. We provide methods to aid in authoring such variations on individual Material prims, and also a facility for creating a "master" look variant on another prim (e.g. a model's root prim, or another common ancestor of all Material prims in a model) that will be able to modify Materials, bindings, connections and values at once. Note on variant vs "direct" opinions. For any given prim's spec in a layer, opinions expressed inside a variant of a variantSet will be /weaker/ than any opinions expressed "directly" at the location, outside of any layer. Therefore, if you intend to author a default variant that is weaker than more explicit variants, you will need to have those opinions be weaker by setting them across a reference arc such as the following: def "MyMaterial" (
add references = </MyMaterial_defaultShadingVariant>
variants = {
string materialVariant = "SomeVariant"
}
add variantSets = "materialVariant"
)
{
float strongerThanVariantOpinion
variantSet "materialVariant" = {
"SomeVariant" {
float variantOpinion
}
}
}
over "MyMaterial_defaultShadingVariant"
{
float weakerThanVariantOpinion
}
| |
USDSHADE_API std::pair< UsdStagePtr, UsdEditTarget > | GetEditContextForVariant (const TfToken &MaterialVariantName, const SdfLayerHandle &layer=SdfLayerHandle()) const |
Helper function for configuring a UsdStage's UsdEditTarget to author Material variations. | |
USDSHADE_API UsdVariantSet | GetMaterialVariant () const |
Return a UsdVariantSet object for interacting with the Material variant variantSet. | |
static USDSHADE_API bool | CreateMasterMaterialVariant (const UsdPrim &masterPrim, const std::vector< UsdPrim > &MaterialPrims, const TfToken &masterVariantSetName=TfToken()) |
Create a variantSet on masterPrim that will set the MaterialVariant on each of the given MaterialPrims. | |
BaseMaterial | |
A specialize arc describes child/parent inheritance. A Material that derives from a BaseMaterial will retain a live composition relationship to its BaseMaterial | |
USDSHADE_API UsdShadeMaterial | GetBaseMaterial () const |
Get the path to the base Material of this Material. | |
USDSHADE_API SdfPath | GetBaseMaterialPath () const |
Get the base Material of this Material. | |
USDSHADE_API void | SetBaseMaterial (const UsdShadeMaterial &baseMaterial) const |
Set the base Material of this Material. | |
USDSHADE_API void | SetBaseMaterialPath (const SdfPath &baseMaterialPath) const |
Set the path to the base Material of this Material. | |
USDSHADE_API void | ClearBaseMaterial () const |
Clear the base Material of this Material. | |
USDSHADE_API bool | HasBaseMaterial () const |
static USDSHADE_API SdfPath | FindBaseMaterialPathInPrimIndex (const PcpPrimIndex &primIndex, const PathPredicate &pathIsMaterialPredicate) |
Given a PcpPrimIndex, searches it for an arc to a parent material. | |
A Material provides a container into which multiple "render contexts" can add data that defines a "shading material" for a renderer.
Typically this consists of one or more UsdShadeOutput properties connected to outputs of nested Shader prims - though a context/client is free to add any data that is suitable. We strongly advise that all contexts adopt the convention that all properties be prefixed with a namespace that identifies the context e.g. "token outputs:ri:surface.connect = </MyselfMaterial/previewSurface.outputs:surface".
In the UsdShading model, geometry expresses a binding to a single Material or to a set of Materials partitioned by UsdGeomSubsets defined beneath the geometry; it is legal to bind a Material at the root (or other sub-prim) of a model, and then bind a different Material to individual gprims, but the meaning of inheritance and "ancestral overriding" of Material bindings is left to each render-target to determine. Since UsdGeom has no concept of shading, we provide the API for binding and unbinding geometry on the API schema UsdShadeMaterialBindingAPI.
The entire power of USD VariantSets and all the other composition operators can leveraged when encoding shading variation.
UsdShadeMaterial provides facilities for a particular way of building "Material variants" in which neither the identity of the Materials themselves nor the geometry Material-bindings need to change - instead we vary the targeted networks, interface values, and even parameter values within a single variantSet.
See Authoring Material Variations for more details.
UsdShade requires that all of the shaders that "belong" to the Material live under the Material in namespace. This supports powerful, easy reuse of Materials, because it allows us to reference a Material from one asset (the asset might be a library of Materials) into another asset: USD references compose all descendant prims of the reference target into the referencer's namespace, which means that all of the referenced Material's shader networks will come along with the Material. When referenced in this way, Materials can also be instanced, for ease of deduplication and compactness. Finally, Material encapsulation also allows us to specialize child materials from parent materials.
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdShadeTokens. So to set an attribute to the value "rightHanded", use UsdShadeTokens->rightHanded as the value.
Definition at line 95 of file material.h.
typedef std::function<bool (const SdfPath &)> PathPredicate |
A function type that takes a path and returns a bool.
Definition at line 276 of file material.h.
|
inlineexplicit |
Construct a UsdShadeMaterial on UsdPrim prim
.
Equivalent to UsdShadeMaterial::Get(prim.GetStage(), prim.GetPath()) for a valid prim
, but will not immediately throw an error for an invalid prim
Definition at line 107 of file material.h.
|
inlineexplicit |
Construct a UsdShadeMaterial on the prim held by schemaObj
.
Should be preferred over UsdShadeMaterial(schemaObj.GetPrim()), as it preserves SchemaBase state.
Definition at line 115 of file material.h.
|
virtual |
Destructor.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdTyped.
USDSHADE_API void ClearBaseMaterial | ( | ) | const |
Clear the base Material of this Material.
USDSHADE_API UsdShadeShader ComputeDisplacementSource | ( | const TfToken & | renderContext, |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
USDSHADE_API UsdShadeShader ComputeDisplacementSource | ( | const TfTokenVector & | contextVector = {UsdShadeTokens->universalRenderContext} , |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
Computes the resolved "displacement" output source for the given contextVector
.
Using the earliest renderContext in the contextVector that produces a valid Shader object.
If a "displacement" output corresponding to each of the renderContexts does not exist or is not connected to a valid source, then this checks the universal displacement output.
Returns an empty Shader object if there is no valid displacement output source for any of the renderContexts in the contextVector
. The python version of this method returns a tuple containing three elements (the source displacement shader, sourceName, sourceType).
USDSHADE_API UsdShadeShader ComputeSurfaceSource | ( | const TfToken & | renderContext, |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
USDSHADE_API UsdShadeShader ComputeSurfaceSource | ( | const TfTokenVector & | contextVector = {UsdShadeTokens->universalRenderContext} , |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
Computes the resolved "surface" output source for the given contextVector
.
Using the earliest renderContext in the contextVector that produces a valid Shader object.
If a "surface" output corresponding to each of the renderContexts does not exist or is not connected to a valid source, then this checks the universal surface output.
Returns an empty Shader object if there is no valid surface output source for any of the renderContexts in the contextVector
. The python version of this method returns a tuple containing three elements (the source surface shader, sourceName, sourceType).
USDSHADE_API UsdShadeShader ComputeVolumeSource | ( | const TfToken & | renderContext, |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
USDSHADE_API UsdShadeShader ComputeVolumeSource | ( | const TfTokenVector & | contextVector = {UsdShadeTokens->universalRenderContext} , |
TfToken * | sourceName = nullptr , |
||
UsdShadeAttributeType * | sourceType = nullptr |
||
) | const |
Computes the resolved "volume" output source for the given contextVector
.
Using the earliest renderContext in the contextVector that produces a valid Shader object.
If a "volume" output corresponding to each of the renderContexts does not exist or is not connected to a valid source, then this checks the universal volume output.
Returns an empty Shader object if there is no valid volume output output source for any of the renderContexts in the contextVector
. The python version of this method returns a tuple containing three elements (the source volume shader, sourceName, sourceType).
USDSHADE_API UsdAttribute CreateDisplacementAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetDisplacementAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author defaultValue
as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely
is true
- the default for writeSparsely
is false
.
USDSHADE_API UsdShadeOutput CreateDisplacementOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Creates and returns the "displacement" output on this material for the specified renderContext
.
If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext.
|
static |
Create a variantSet on masterPrim
that will set the MaterialVariant on each of the given MaterialPrims.
The variantSet, whose name can be specified with masterVariantSetName
and defaults to the same MaterialVariant name created on Materials by GetEditContextForVariant(), will have the same variants as the Materials, and each Master variant will set every MaterialPrims'
MaterialVariant selection to the same variant as the master. Thus, it allows all Materials to be switched with a single variant selection, on masterPrim
.
If masterPrim
is an ancestor of any given member of MaterialPrims
, then we will author variant selections directly on the MaterialPrims. However, it is often preferable to create a master MaterialVariant in a separately rooted tree from the MaterialPrims, so that it can be layered more strongly on top of the Materials. Therefore, for any MaterialPrim in a different tree than masterPrim, we will create "overs" as children of masterPrim that recreate the path to the MaterialPrim, substituting masterPrim's full path for the MaterialPrim's root path component.
Upon successful completion, the new variantSet we created on masterPrim
will have its variant selection authored to the "last" variant (determined lexicographically). It is up to the calling client to either UsdVariantSet::ClearVariantSelection() on masterPrim
, or set the selection to the desired default setting.
Return true
on success. It is an error if any of Materials
have a different set of variants for the MaterialVariant than the others.
USDSHADE_API UsdAttribute CreateSurfaceAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetSurfaceAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author defaultValue
as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely
is true
- the default for writeSparsely
is false
.
USDSHADE_API UsdShadeOutput CreateSurfaceOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Creates and returns the "surface" output on this material for the specified renderContext
.
If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext.
USDSHADE_API UsdAttribute CreateVolumeAttr | ( | VtValue const & | defaultValue = VtValue() , |
bool | writeSparsely = false |
||
) | const |
See GetVolumeAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
If specified, author defaultValue
as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely
is true
- the default for writeSparsely
is false
.
USDSHADE_API UsdShadeOutput CreateVolumeOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Creates and returns the "volume" output on this material for the specified renderContext
.
If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext.
|
static |
Attempt to ensure a UsdPrim adhering to this schema at path
is defined (according to UsdPrim::IsDefined()) on this stage.
If a prim adhering to this schema at path
is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema's prim type name for the prim at path
at the current EditTarget. Author SdfPrimSpec s with specifier
== SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.
The given path must be an absolute prim path that does not contain any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget's namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.
|
static |
Given a PcpPrimIndex, searches it for an arc to a parent material.
This is a public static function to support applications that use Pcp but not Usd. Most clients should call GetBaseMaterialPath, which uses this function when appropriate.
|
static |
Return a UsdShadeMaterial holding the prim adhering to this schema at path
on stage
.
If no prim exists at path
on stage
, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:
USDSHADE_API UsdShadeMaterial GetBaseMaterial | ( | ) | const |
Get the path to the base Material of this Material.
If there is no base Material, an empty Material is returned
USDSHADE_API SdfPath GetBaseMaterialPath | ( | ) | const |
Get the base Material of this Material.
If there is no base Material, an empty path is returned
USDSHADE_API UsdAttribute GetDisplacementAttr | ( | ) | const |
USDSHADE_API UsdShadeOutput GetDisplacementOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Returns the "displacement" output of this material for the specified renderContext.
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist.
USDSHADE_API std::vector< UsdShadeOutput > GetDisplacementOutputs | ( | ) | const |
Returns the "displacement" outputs of this material for all available renderContexts.
The returned vector will include all authored "displacement" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source.
USDSHADE_API std::pair< UsdStagePtr, UsdEditTarget > GetEditContextForVariant | ( | const TfToken & | MaterialVariantName, |
const SdfLayerHandle & | layer = SdfLayerHandle() |
||
) | const |
Helper function for configuring a UsdStage's UsdEditTarget to author Material variations.
Takes care of creating the Material variantSet and specified variant, if necessary.
Let's assume that we are authoring Materials into the Stage's current UsdEditTarget, and that we are iterating over the variations of a UsdShadeMaterial clothMaterial, and currVariant is the variant we are processing (e.g. "denim").
In C++, then, we would use the following pattern:
In python, the pattern is:
If layer
is specified, then we will use it, rather than the stage's current UsdEditTarget's layer as the destination layer for the edit context we are building. If layer
does not actually contribute to the Material prim's definition, any editing will have no effect on this Material.
Note: As just stated, using this method involves authoring a selection for the MaterialVariant in the stage's current EditTarget. When client is done authoring variations on this prim, they will likely want to either UsdVariantSet::SetVariantSelection() to the appropriate default selection, or possibly UsdVariantSet::ClearVariantSelection() on the UsdShadeMaterial::GetMaterialVariant() UsdVariantSet.
USDSHADE_API UsdVariantSet GetMaterialVariant | ( | ) | const |
Return a UsdVariantSet object for interacting with the Material variant variantSet.
|
static |
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
USDSHADE_API UsdAttribute GetSurfaceAttr | ( | ) | const |
USDSHADE_API UsdShadeOutput GetSurfaceOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Returns the "surface" output of this material for the specified renderContext
.
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist.
USDSHADE_API std::vector< UsdShadeOutput > GetSurfaceOutputs | ( | ) | const |
Returns the "surface" outputs of this material for all available renderContexts.
The returned vector will include all authored "surface" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source.
USDSHADE_API UsdAttribute GetVolumeAttr | ( | ) | const |
USDSHADE_API UsdShadeOutput GetVolumeOutput | ( | const TfToken & | renderContext = UsdShadeTokens->universalRenderContext | ) | const |
Returns the "volume" output of this material for the specified renderContext.
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist.
USDSHADE_API std::vector< UsdShadeOutput > GetVolumeOutputs | ( | ) | const |
Returns the "volume" outputs of this material for all available renderContexts.
The returned vector will include all authored "volume" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source.
USDSHADE_API void SetBaseMaterial | ( | const UsdShadeMaterial & | baseMaterial | ) | const |
Set the base Material of this Material.
An empty Material is equivalent to clearing the base Material.
USDSHADE_API void SetBaseMaterialPath | ( | const SdfPath & | baseMaterialPath | ) | const |
Set the path to the base Material of this Material.
An empty path is equivalent to clearing the base Material.
|
friend |
Definition at line 179 of file material.h.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 101 of file material.h.