HDK
|
#include <output.h>
Public Member Functions | |
UsdShadeOutput () | |
TfToken const & | GetFullName () const |
USDSHADE_API TfToken | GetBaseName () const |
UsdPrim | GetPrim () const |
Get the prim that the output belongs to. More... | |
USDSHADE_API SdfValueTypeName | GetTypeName () const |
USDSHADE_API bool | Set (const VtValue &value, UsdTimeCode time=UsdTimeCode::Default()) const |
template<typename T > | |
bool | Set (const T &value, UsdTimeCode time=UsdTimeCode::Default()) const |
operator bool () const | |
Configuring the Output's Type | |
USDSHADE_API bool | SetRenderType (TfToken const &renderType) const |
USDSHADE_API TfToken | GetRenderType () const |
USDSHADE_API bool | HasRenderType () const |
API to author and query an Output's sdrMetadata | |
This section provides API for authoring and querying shader registry metadata on an Output. When the owning shader prim is providing a shader definition, the authored "sdrMetadata" dictionary value provides metadata needed to populate the Output correctly in the shader registry. We expect the keys in sdrMetadata to correspond to the keys in SdrPropertyMetadata. However, this is not strictly enforced by the API. The only allowed value type in the "sdrMetadata" dictionary is a std::string since it needs to be converted into a NdrTokenMap, which Sdr will parse using the utilities available in SdrMetadataHelpers. | |
USDSHADE_API NdrTokenMap | GetSdrMetadata () const |
USDSHADE_API std::string | GetSdrMetadataByKey (const TfToken &key) const |
USDSHADE_API void | SetSdrMetadata (const NdrTokenMap &sdrMetadata) const |
USDSHADE_API void | SetSdrMetadataByKey (const TfToken &key, const std::string &value) const |
USDSHADE_API bool | HasSdrMetadata () const |
USDSHADE_API bool | HasSdrMetadataByKey (const TfToken &key) const |
USDSHADE_API void | ClearSdrMetadata () const |
USDSHADE_API void | ClearSdrMetadataByKey (const TfToken &key) const |
Connected Value API | |
USDSHADE_API UsdShadeAttributeVector | GetValueProducingAttributes (bool shaderOutputsOnly=false) const |
Find what is connected to this Output recursively. More... | |
Friends | |
class | UsdShadeConnectableAPI |
bool | operator== (const UsdShadeOutput &lhs, const UsdShadeOutput &rhs) |
bool | operator!= (const UsdShadeOutput &lhs, const UsdShadeOutput &rhs) |
UsdAttribute API | |
USDSHADE_API | UsdShadeOutput (const UsdAttribute &attr) |
const UsdAttribute & | GetAttr () const |
Explicit UsdAttribute extractor. More... | |
operator UsdAttribute () const | |
bool | IsDefined () const |
static USDSHADE_API bool | IsOutput (const UsdAttribute &attr) |
This class encapsulates a shader or node-graph output, which is a connectable attribute representing a typed, externally computed value.
|
inline |
|
explicit |
Speculative constructor that will produce a valid UsdShadeOutput when attr
already represents a shade Output, and produces an invalid UsdShadeOutput otherwise (i.e. the explicit bool conversion operator will return false).
USDSHADE_API bool UsdShadeOutput::CanConnect | ( | const UsdAttribute & | source | ) | const |
USDSHADE_API bool UsdShadeOutput::CanConnect | ( | const UsdShadeInput & | sourceInput | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
USDSHADE_API bool UsdShadeOutput::CanConnect | ( | const UsdShadeOutput & | sourceOutput | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
USDSHADE_API void UsdShadeOutput::ClearSdrMetadata | ( | ) | const |
Clears any "sdrMetadata" value authored on the Output in the current EditTarget.
USDSHADE_API void UsdShadeOutput::ClearSdrMetadataByKey | ( | const TfToken & | key | ) | const |
Clears the entry corresponding to the given key
in the "sdrMetadata" dictionary authored in the current EditTarget.
USDSHADE_API bool UsdShadeOutput::ClearSource | ( | ) | const |
USDSHADE_API bool UsdShadeOutput::ClearSources | ( | ) | const |
Clears sources for this Output in the current UsdEditTarget.
Most of the time, what you probably want is DisconnectSource() rather than this function.
USDSHADE_API bool UsdShadeOutput::ConnectToSource | ( | UsdShadeConnectionSourceInfo const & | source, |
ConnectionModification const | mod = ConnectionModification::Replace |
||
) | const |
Authors a connection for this Output
source
is a struct that describes the upstream source attribute with all the information necessary to make a connection. See the documentation for UsdShadeConnectionSourceInfo. mod
describes the operation that should be applied to the list of connections. By default the new connection will replace any existing connections, but it can add to the list of connections to represent multiple input connections.
true
if a connection was created successfully. false
if shadingAttr
or source
is invalid.USDSHADE_API bool UsdShadeOutput::ConnectToSource | ( | UsdShadeConnectableAPI const & | source, |
TfToken const & | sourceName, | ||
UsdShadeAttributeType const | sourceType = UsdShadeAttributeType::Output , |
||
SdfValueTypeName | typeName = SdfValueTypeName() |
||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
USDSHADE_API bool UsdShadeOutput::ConnectToSource | ( | SdfPath const & | sourcePath | ) | const |
Authors a connection for this Output to the source at the given path.
USDSHADE_API bool UsdShadeOutput::ConnectToSource | ( | UsdShadeInput const & | sourceInput | ) | const |
Connects this Output to the given input, sourceInput
.
USDSHADE_API bool UsdShadeOutput::ConnectToSource | ( | UsdShadeOutput const & | sourceOutput | ) | const |
Connects this Output to the given output, sourceOutput
.
USDSHADE_API bool UsdShadeOutput::DisconnectSource | ( | UsdAttribute const & | sourceAttr = UsdAttribute() | ) | const |
Disconnect source for this Output. If sourceAttr
is valid, only a connection to the specified attribute is disconnected, otherwise all connections are removed.
|
inline |
Explicit UsdAttribute extractor.
USDSHADE_API TfToken UsdShadeOutput::GetBaseName | ( | ) | const |
Returns the name of the output.
We call this the base name since it strips off the "outputs:" namespace prefix from the attribute name, and returns it.
USDSHADE_API bool UsdShadeOutput::GetConnectedSource | ( | UsdShadeConnectableAPI * | source, |
TfToken * | sourceName, | ||
UsdShadeAttributeType * | sourceType | ||
) | const |
USDSHADE_API SourceInfoVector UsdShadeOutput::GetConnectedSources | ( | SdfPathVector * | invalidSourcePaths = nullptr | ) | const |
Finds the valid sources of connections for the Output.
invalidSourcePaths
is an optional output parameter to collect the invalid source paths that have not been reported in the returned vector.
Returns a vector of UsdShadeConnectionSourceInfo
structs with information about each upsteam attribute. If the vector is empty, there have been no valid connections.
|
inline |
|
inline |
USDSHADE_API bool UsdShadeOutput::GetRawConnectedSourcePaths | ( | SdfPathVector * | sourcePaths | ) | const |
USDSHADE_API TfToken UsdShadeOutput::GetRenderType | ( | ) | const |
Return this output's specialized renderType, or an empty token if none was authored.
USDSHADE_API NdrTokenMap UsdShadeOutput::GetSdrMetadata | ( | ) | const |
Returns this Output's composed "sdrMetadata" dictionary as a NdrTokenMap.
USDSHADE_API std::string UsdShadeOutput::GetSdrMetadataByKey | ( | const TfToken & | key | ) | const |
Returns the value corresponding to key
in the composed sdrMetadata dictionary.
USDSHADE_API SdfValueTypeName UsdShadeOutput::GetTypeName | ( | ) | const |
Get the "scene description" value type name of the attribute associated with the output.
USDSHADE_API UsdShadeAttributeVector UsdShadeOutput::GetValueProducingAttributes | ( | bool | shaderOutputsOnly = false | ) | const |
Find what is connected to this Output recursively.
USDSHADE_API bool UsdShadeOutput::HasConnectedSource | ( | ) | const |
Returns true if and only if this Output is currently connected to a valid (defined) source.
USDSHADE_API bool UsdShadeOutput::HasRenderType | ( | ) | const |
Return true if a renderType has been specified for this output.
USDSHADE_API bool UsdShadeOutput::HasSdrMetadata | ( | ) | const |
Returns true if the Output has a non-empty composed "sdrMetadata" dictionary value.
USDSHADE_API bool UsdShadeOutput::HasSdrMetadataByKey | ( | const TfToken & | key | ) | const |
Returns true if there is a value corresponding to the given key
in the composed "sdrMetadata" dictionary.
|
inline |
Return true if the wrapped UsdAttribute is defined, and in addition the attribute is identified as an output.
|
static |
Test whether a given UsdAttribute represents a valid Output, which implies that creating a UsdShadeOutput from the attribute will succeed.
Success implies that attr.IsDefined()
is true.
USDSHADE_API bool UsdShadeOutput::IsSourceConnectionFromBaseMaterial | ( | ) | const |
Returns true if the connection to this Output's source, as returned by GetConnectedSource(), is authored across a specializes arc, which is used to denote a base material.
|
inlineexplicit |
Return true if this Output is valid for querying and authoring values and metadata, which is identically equivalent to IsDefined().
|
inline |
Allow UsdShadeOutput to auto-convert to UsdAttribute, so you can pass a UsdShadeOutput to any function that accepts a UsdAttribute or const-ref thereto.
USDSHADE_API bool UsdShadeOutput::Set | ( | const VtValue & | value, |
UsdTimeCode | time = UsdTimeCode::Default() |
||
) | const |
Set a value for the output.
It's unusual to be setting a value on an output since it represents an externally computed value. The Set API is provided here just for the sake of completeness and uniformity with other property schema.
|
inline |
USDSHADE_API bool UsdShadeOutput::SetConnectedSources | ( | std::vector< UsdShadeConnectionSourceInfo > const & | sourceInfos | ) | const |
Connects this Output to the given sources, sourceInfos
USDSHADE_API bool UsdShadeOutput::SetRenderType | ( | TfToken const & | renderType | ) | const |
Specify an alternative, renderer-specific type to use when emitting/translating this output, rather than translating based on its GetTypeName()
For example, we set the renderType to "struct" for outputs that are of renderman custom struct types.
USDSHADE_API void UsdShadeOutput::SetSdrMetadata | ( | const NdrTokenMap & | sdrMetadata | ) | const |
Authors the given sdrMetadata
value on this Output at the current EditTarget.
USDSHADE_API void UsdShadeOutput::SetSdrMetadataByKey | ( | const TfToken & | key, |
const std::string & | value | ||
) | const |
Sets the value corresponding to key
to the given string value
, in the Output's "sdrMetadata" dictionary at the current EditTarget.
|
friend |
Inequality comparison. Return false if lhs and rhs represent the same UsdShadeOutput, true otherwise.
|
friend |
Equality comparison. Returns true if lhs and rhs represent the same UsdShadeOutput, false otherwise.
|
friend |