7#ifndef PXR_USD_USD_SHADE_OUTPUT_H
8#define PXR_USD_USD_SHADE_OUTPUT_H
11#include "pxr/usd/usdShade/api.h"
12#include "pxr/usd/usdShade/types.h"
13#include "pxr/usd/usdShade/utils.h"
14#include "pxr/usd/usd/attribute.h"
19PXR_NAMESPACE_OPEN_SCOPE
81 return attr.Set(value, time);
151 const std::string &value)
const;
235 using ConnectionModification = UsdShadeConnectionModification;
262 ConnectionModification
const mod =
263 ConnectionModification::Replace)
const;
271 UsdShadeAttributeType
const sourceType=UsdShadeAttributeType::Output,
301 std::vector<UsdShadeConnectionSourceInfo>
const &sourceInfos)
const;
325 SdfPathVector *invalidSourcePaths =
nullptr)
const;
331 UsdShadeAttributeType *sourceType)
const;
393 bool shaderOutputsOnly =
false)
const;
399 explicit operator bool()
const {
412 return !(lhs == rhs);
429PXR_NAMESPACE_CLOSE_SCOPE
A path value used to locate objects in layers or scenegraphs.
Represents a value type name, i.e.
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Token for efficient comparison, assignment, and hashing of known strings.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
UsdPrim GetPrim() const
Return this object if it is a prim, otherwise return this object's nearest owning prim.
const TfToken & GetName() const
Return the full name of this object, i.e.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
UsdShadeConnectableAPI is an API schema that provides a common interface for creating outputs and mak...
This class encapsulates a shader or node-graph output, which is a connectable attribute representing ...
friend bool operator!=(const UsdShadeOutput &lhs, const UsdShadeOutput &rhs)
Inequality comparison.
USDSHADE_API bool CanConnect(const UsdAttribute &source) const
Determines whether this Output can be connected to the given source attribute, which can be an input ...
USDSHADE_API bool ConnectToSource(SdfPath const &sourcePath) const
Authors a connection for this Output to the source at the given path.
USDSHADE_API std::string GetSdrMetadataByKey(const TfToken &key) const
Returns the value corresponding to key in the composed sdrMetadata dictionary.
USDSHADE_API UsdShadeAttributeVector GetValueProducingAttributes(bool shaderOutputsOnly=false) const
Find what is connected to this Output recursively.
USDSHADE_API bool Set(const VtValue &value, UsdTimeCode time=UsdTimeCode::Default()) const
Set a value for the output.
USDSHADE_API bool HasRenderType() const
Return true if a renderType has been specified for this output.
USDSHADE_API bool CanConnect(const UsdShadeOutput &sourceOutput) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDSHADE_API TfToken GetRenderType() const
Return this output's specialized renderType, or an empty token if none was authored.
USDSHADE_API bool HasConnectedSource() const
Returns true if and only if this Output is currently connected to a valid (defined) source.
UsdPrim GetPrim() const
Get the prim that the output belongs to.
USDSHADE_API bool ConnectToSource(UsdShadeOutput const &sourceOutput) const
Connects this Output to the given output, sourceOutput.
USDSHADE_API bool ConnectToSource(UsdShadeConnectionSourceInfo const &source, ConnectionModification const mod=ConnectionModification::Replace) const
Authors a connection for this Output.
TfToken const & GetFullName() const
Get the name of the attribute associated with the output.
USDSHADE_API TfToken GetBaseName() const
Returns the name of the output.
USDSHADE_API bool ConnectToSource(UsdShadeConnectableAPI const &source, TfToken const &sourceName, UsdShadeAttributeType const sourceType=UsdShadeAttributeType::Output, SdfValueTypeName typeName=SdfValueTypeName()) const
const UsdAttribute & GetAttr() const
Explicit UsdAttribute extractor.
static USDSHADE_API bool IsOutput(const UsdAttribute &attr)
Test whether a given UsdAttribute represents a valid Output, which implies that creating a UsdShadeOu...
USDSHADE_API NdrTokenMap GetSdrMetadata() const
Returns this Output's composed "sdrMetadata" dictionary as a NdrTokenMap.
bool Set(const T &value, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool IsDefined() const
Return true if the wrapped UsdAttribute is defined, and in addition the attribute is identified as an...
USDSHADE_API SourceInfoVector GetConnectedSources(SdfPathVector *invalidSourcePaths=nullptr) const
Finds the valid sources of connections for the Output.
USDSHADE_API bool SetConnectedSources(std::vector< UsdShadeConnectionSourceInfo > const &sourceInfos) const
Connects this Output to the given sources, sourceInfos.
friend bool operator==(const UsdShadeOutput &lhs, const UsdShadeOutput &rhs)
Equality comparison.
USDSHADE_API void SetSdrMetadata(const NdrTokenMap &sdrMetadata) const
Authors the given sdrMetadata value on this Output at the current EditTarget.
USDSHADE_API bool IsSourceConnectionFromBaseMaterial() const
Returns true if the connection to this Output's source, as returned by GetConnectedSource(),...
USDSHADE_API UsdShadeOutput(const UsdAttribute &attr)
Speculative constructor that will produce a valid UsdShadeOutput when attr already represents a shade...
USDSHADE_API void ClearSdrMetadata() const
Clears any "sdrMetadata" value authored on the Output in the current EditTarget.
USDSHADE_API bool CanConnect(const UsdShadeInput &sourceInput) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDSHADE_API bool HasSdrMetadata() const
Returns true if the Output has a non-empty composed "sdrMetadata" dictionary value.
USDSHADE_API SdfValueTypeName GetTypeName() const
Get the "scene description" value type name of the attribute associated with the output.
USDSHADE_API bool SetRenderType(TfToken const &renderType) const
Specify an alternative, renderer-specific type to use when emitting/translating this output,...
USDSHADE_API bool HasSdrMetadataByKey(const TfToken &key) const
Returns true if there is a value corresponding to the given key in the composed "sdrMetadata" diction...
USDSHADE_API void 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" dictiona...
USDSHADE_API void ClearSdrMetadataByKey(const TfToken &key) const
Clears the entry corresponding to the given key in the "sdrMetadata" dictionary authored in the curre...
USDSHADE_API bool GetConnectedSource(UsdShadeConnectableAPI *source, TfToken *sourceName, UsdShadeAttributeType *sourceType) const
UsdShadeOutput()
Default constructor returns an invalid Output.
USDSHADE_API bool DisconnectSource(UsdAttribute const &sourceAttr=UsdAttribute()) const
Disconnect source for this Output.
USDSHADE_API bool ClearSource() const
USDSHADE_API bool ClearSources() const
Clears sources for this Output in the current UsdEditTarget.
USDSHADE_API bool ConnectToSource(UsdShadeInput const &sourceInput) const
Connects this Output to the given input, sourceInput.
USDSHADE_API bool GetRawConnectedSourcePaths(SdfPathVector *sourcePaths) const
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
A compact struct to represent a bundle of information about an upstream source attribute.
Common typedefs that are used throughout the NDR library.