HDK
|
#include <input.h>
Classes | |
struct | Hash |
Hash functor. More... | |
Public Member Functions | |
UsdShadeInput () | |
TfToken const & | GetFullName () const |
USDSHADE_API TfToken | GetBaseName () const |
USDSHADE_API SdfValueTypeName | GetTypeName () const |
UsdPrim | GetPrim () const |
Get the prim that the input belongs to. More... | |
template<typename T > | |
bool | Get (T *value, UsdTimeCode time=UsdTimeCode::Default()) const |
Convenience wrapper for the templated UsdAttribute::Get(). More... | |
USDSHADE_API bool | Get (VtValue *value, UsdTimeCode time=UsdTimeCode::Default()) const |
Convenience wrapper for VtValue version of UsdAttribute::Get(). More... | |
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 Input'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 Input's sdrMetadata | |
This section provides API for authoring and querying shader registry metadata on an Input. When the owning shader prim is providing a shader definition, the authored "sdrMetadata" dictionary value provides metadata needed to populate the Input 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 |
Connectability API | |
USDSHADE_API bool | SetConnectability (const TfToken &connectability) const |
Set the connectability of the Input. More... | |
USDSHADE_API TfToken | GetConnectability () const |
Returns the connectability of the Input. More... | |
USDSHADE_API bool | ClearConnectability () const |
Clears any authored connectability on the Input. More... | |
Connected Value API | |
USDSHADE_API UsdShadeAttributeVector | GetValueProducingAttributes (bool shaderOutputsOnly=false) const |
Find what is connected to this Input recursively. More... | |
USDSHADE_API UsdAttribute | GetValueProducingAttribute (UsdShadeAttributeType *attrType) const |
Friends | |
class | UsdShadeConnectableAPI |
bool | operator== (const UsdShadeInput &lhs, const UsdShadeInput &rhs) |
bool | operator!= (const UsdShadeInput &lhs, const UsdShadeInput &rhs) |
UsdAttribute API | |
USDSHADE_API | UsdShadeInput (const UsdAttribute &attr) |
const UsdAttribute & | GetAttr () const |
Explicit UsdAttribute extractor. More... | |
operator const UsdAttribute & () const | |
bool | IsDefined () const |
USDSHADE_API bool | SetDocumentation (const std::string &docs) const |
USDSHADE_API std::string | GetDocumentation () const |
USDSHADE_API bool | SetDisplayGroup (const std::string &displayGroup) const |
USDSHADE_API std::string | GetDisplayGroup () const |
static USDSHADE_API bool | IsInput (const UsdAttribute &attr) |
static USDSHADE_API bool | IsInterfaceInputName (const std::string &name) |
This class encapsulates a shader or node-graph input, which is a connectable attribute representing a typed value.
Determines whether this Input can be connected to the given source attribute, which can be an input or an output.
Determines whether this Input can be connected to the given source attribute, which can be an input or an output.
|
inline |
|
explicit |
Speculative constructor that will produce a valid UsdShadeInput when attr
already represents a shade Input, and produces an invalid UsdShadeInput otherwise (i.e. the explicit bool conversion operator will return false).
USDSHADE_API bool UsdShadeInput::CanConnect | ( | const UsdAttribute & | source | ) | const |
Determines whether this Input can be connected to the given source attribute, which can be an input or an output.
USDSHADE_API bool UsdShadeInput::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 UsdShadeInput::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 bool UsdShadeInput::ClearConnectability | ( | ) | const |
Clears any authored connectability on the Input.
USDSHADE_API void UsdShadeInput::ClearSdrMetadata | ( | ) | const |
Clears any "sdrMetadata" value authored on the Input in the current EditTarget.
USDSHADE_API void UsdShadeInput::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 UsdShadeInput::ClearSource | ( | ) | const |
USDSHADE_API bool UsdShadeInput::ClearSources | ( | ) | const |
Clears sources for this Input in the current UsdEditTarget.
Most of the time, what you probably want is DisconnectSource() rather than this function.
USDSHADE_API bool UsdShadeInput::ConnectToSource | ( | UsdShadeConnectionSourceInfo const & | source, |
ConnectionModification const | mod = ConnectionModification::Replace |
||
) | const |
Authors a connection for this Input
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 this input or source
is invalid.USDSHADE_API bool UsdShadeInput::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 UsdShadeInput::ConnectToSource | ( | SdfPath const & | sourcePath | ) | const |
Authors a connection for this Input to the source at the given path.
USDSHADE_API bool UsdShadeInput::ConnectToSource | ( | UsdShadeInput const & | sourceInput | ) | const |
Connects this Input to the given input, sourceInput
.
USDSHADE_API bool UsdShadeInput::ConnectToSource | ( | UsdShadeOutput const & | sourceOutput | ) | const |
Connects this Input to the given output, sourceOutput
.
USDSHADE_API bool UsdShadeInput::DisconnectSource | ( | UsdAttribute const & | sourceAttr = UsdAttribute() | ) | const |
Disconnect source for this Input. If sourceAttr
is valid, only a connection to the specified attribute is disconnected, otherwise all connections are removed.
|
inline |
Convenience wrapper for the templated UsdAttribute::Get().
USDSHADE_API bool UsdShadeInput::Get | ( | VtValue * | value, |
UsdTimeCode | time = UsdTimeCode::Default() |
||
) | const |
Convenience wrapper for VtValue version of UsdAttribute::Get().
|
inline |
Explicit UsdAttribute extractor.
USDSHADE_API TfToken UsdShadeInput::GetBaseName | ( | ) | const |
Returns the name of the input.
We call this the base name since it strips off the "inputs:" namespace prefix from the attribute name, and returns it.
USDSHADE_API TfToken UsdShadeInput::GetConnectability | ( | ) | const |
Returns the connectability of the Input.
USDSHADE_API bool UsdShadeInput::GetConnectedSource | ( | UsdShadeConnectableAPI * | source, |
TfToken * | sourceName, | ||
UsdShadeAttributeType * | sourceType | ||
) | const |
USDSHADE_API SourceInfoVector UsdShadeInput::GetConnectedSources | ( | SdfPathVector * | invalidSourcePaths = nullptr | ) | const |
Finds the valid sources of connections for the Input.
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.
USDSHADE_API std::string UsdShadeInput::GetDisplayGroup | ( | ) | const |
Get the displayGroup metadata for this Input, i.e. hint for the location and nesting of the attribute.
USDSHADE_API std::string UsdShadeInput::GetDocumentation | ( | ) | const |
Get documentation string for this Input.
|
inline |
|
inline |
USDSHADE_API bool UsdShadeInput::GetRawConnectedSourcePaths | ( | SdfPathVector * | sourcePaths | ) | const |
USDSHADE_API TfToken UsdShadeInput::GetRenderType | ( | ) | const |
Return this Input's specialized renderType, or an empty token if none was authored.
USDSHADE_API NdrTokenMap UsdShadeInput::GetSdrMetadata | ( | ) | const |
Returns this Input's composed "sdrMetadata" dictionary as a NdrTokenMap.
USDSHADE_API std::string UsdShadeInput::GetSdrMetadataByKey | ( | const TfToken & | key | ) | const |
Returns the value corresponding to key
in the composed sdrMetadata dictionary.
USDSHADE_API SdfValueTypeName UsdShadeInput::GetTypeName | ( | ) | const |
Get the "scene description" value type name of the attribute associated with the Input.
USDSHADE_API UsdAttribute UsdShadeInput::GetValueProducingAttribute | ( | UsdShadeAttributeType * | attrType | ) | const |
USDSHADE_API UsdShadeAttributeVector UsdShadeInput::GetValueProducingAttributes | ( | bool | shaderOutputsOnly = false | ) | const |
Find what is connected to this Input recursively.
USDSHADE_API bool UsdShadeInput::HasConnectedSource | ( | ) | const |
Returns true if and only if this Input is currently connected to a valid (defined) source.
USDSHADE_API bool UsdShadeInput::HasRenderType | ( | ) | const |
Return true if a renderType has been specified for this Input.
USDSHADE_API bool UsdShadeInput::HasSdrMetadata | ( | ) | const |
Returns true if the Input has a non-empty composed "sdrMetadata" dictionary value.
USDSHADE_API bool UsdShadeInput::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 input.
|
static |
Test whether a given UsdAttribute represents a valid Input, which implies that creating a UsdShadeInput from the attribute will succeed.
Success implies that attr.IsDefined()
is true.
|
static |
Test if this name has a namespace that indicates it could be an input.
USDSHADE_API bool UsdShadeInput::IsSourceConnectionFromBaseMaterial | ( | ) | const |
Returns true if the connection to this Input'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 Input is valid for querying and authoring values and metadata, which is identically equivalent to IsDefined().
|
inline |
Allow UsdShadeInput to auto-convert to UsdAttribute, so you can pass a UsdShadeInput to any function that accepts a UsdAttribute or const-ref thereto.
USDSHADE_API bool UsdShadeInput::Set | ( | const VtValue & | value, |
UsdTimeCode | time = UsdTimeCode::Default() |
||
) | const |
Set a value for the Input at time
.
|
inline |
USDSHADE_API bool UsdShadeInput::SetConnectability | ( | const TfToken & | connectability | ) | const |
Set the connectability of the Input.
In certain shading data models, there is a need to distinguish which inputs can vary over a surface from those that must be uniform. This is accomplished in UsdShade by limiting the connectability of the input. This is done by setting the "connectability" metadata on the associated attribute.
Connectability of an Input can be set to UsdShadeTokens->full or UsdShadeTokens->interfaceOnly.
The default connectability of an input is UsdShadeTokens->full.
USDSHADE_API bool UsdShadeInput::SetConnectedSources | ( | std::vector< UsdShadeConnectionSourceInfo > const & | sourceInfos | ) | const |
Connects this Input to the given sources, sourceInfos
USDSHADE_API bool UsdShadeInput::SetDisplayGroup | ( | const std::string & | displayGroup | ) | const |
Set the displayGroup metadata for this Input, i.e. hinting for the location and nesting of the attribute.
Note for an input representing a nested SdrShaderProperty, its expected to have the scope delimited by a ":".
USDSHADE_API bool UsdShadeInput::SetDocumentation | ( | const std::string & | docs | ) | const |
Set documentation string for this Input.
USDSHADE_API bool UsdShadeInput::SetRenderType | ( | TfToken const & | renderType | ) | const |
Specify an alternative, renderer-specific type to use when emitting/translating this Input, rather than translating based on its GetTypeName()
For example, we set the renderType to "struct" for Inputs that are of renderman custom struct types.
USDSHADE_API void UsdShadeInput::SetSdrMetadata | ( | const NdrTokenMap & | sdrMetadata | ) | const |
Authors the given sdrMetadata
value on this Input at the current EditTarget.
USDSHADE_API void UsdShadeInput::SetSdrMetadataByKey | ( | const TfToken & | key, |
const std::string & | value | ||
) | const |
Sets the value corresponding to key
to the given string value
, in the Input's "sdrMetadata" dictionary at the current EditTarget.
|
friend |
Inequality comparison. Return false if lhs and rhs represent the same UsdShadeInput, true otherwise.
|
friend |
Equality comparison. Returns true if lhs and rhs represent the same UsdShadeInput, false otherwise.
|
friend |