24 #ifndef USDSHADE_GENERATED_CONNECTABLEAPI_H
25 #define USDSHADE_GENERATED_CONNECTABLEAPI_H
30 #include "pxr/usd/usdShade/api.h"
35 #include "pxr/usd/usd/typed.h"
36 #include "pxr/usd/usdShade/input.h"
37 #include "pxr/usd/usdShade/output.h"
39 #include "pxr/usd/usdShade/types.h"
41 #include "pxr/base/vt/value.h"
48 #include "pxr/base/tf/type.h"
50 PXR_NAMESPACE_OPEN_SCOPE
128 Get(
const UsdStagePtr &stage,
const SdfPath &path);
142 static const TfType &_GetStaticTfType();
144 static bool _IsTypedSchema();
148 const TfType &_GetTfType()
const override;
249 using ConnectionModification = UsdShadeConnectionModification;
276 ConnectionModification
const mod = ConnectionModification::Replace);
283 ConnectionModification
const mod = ConnectionModification::Replace)
293 ConnectionModification
const mod = ConnectionModification::Replace)
306 UsdShadeAttributeType
const sourceType=UsdShadeAttributeType::Output,
316 UsdShadeAttributeType
const sourceType=UsdShadeAttributeType::Output,
330 UsdShadeAttributeType
const sourceType=UsdShadeAttributeType::Output,
427 std::vector<UsdShadeConnectionSourceInfo>
const &sourceInfos);
461 UsdShadeAttributeType *sourceType);
469 UsdShadeAttributeType *sourceType) {
480 UsdShadeAttributeType *sourceType) {
504 SdfPathVector *invalidSourcePaths =
nullptr);
510 SdfPathVector *invalidSourcePaths =
nullptr);
516 SdfPathVector *invalidSourcePaths =
nullptr);
525 SdfPathVector *sourcePaths);
531 SdfPathVector *sourcePaths) {
539 SdfPathVector *sourcePaths) {
679 template <
typename T>
682 static_assert(std::is_base_of<UsdTyped, T>::value,
683 "Provided type must derive UsdTyped.");
717 bool onlyAuthored=
true)
const;
746 bool onlyAuthored=
true)
const;
766 UsdShadeAttributeType
sourceType = UsdShadeAttributeType::Invalid;
775 UsdShadeAttributeType sourceType_,
778 , sourceName(sourceName_)
783 : source(input.GetPrim())
784 , sourceName(input.GetBaseName())
786 ,
typeName(input.GetAttr().GetTypeName())
789 : source(output.GetPrim())
790 , sourceName(output.GetBaseName())
792 ,
typeName(output.GetAttr().GetTypeName())
800 UsdStagePtr
const& stage,
810 return (
sourceType != UsdShadeAttributeType::Invalid) &&
814 explicit operator bool()
const {
824 return !(*
this == other);
828 PXR_NAMESPACE_CLOSE_SCOPE
static USDSHADE_API bool ConnectToSource(UsdShadeOutput const &output, UsdShadeConnectableAPI const &source, TfToken const &sourceName, UsdShadeAttributeType const sourceType=UsdShadeAttributeType::Output, SdfValueTypeName typeName=SdfValueTypeName())
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
USDSHADE_API UsdShadeOutput GetOutput(const TfToken &name) const
Return the requested output if it exists.
static USDSHADE_API bool GetRawConnectedSourcePaths(UsdShadeOutput const &output, SdfPathVector *sourcePaths)
USDSHADE_API std::vector< UsdShadeInput > GetInputs(bool onlyAuthored=true) const
Returns all inputs on the connectable prim (i.e.
static USDSHADE_API bool GetRawConnectedSourcePaths(UsdAttribute const &shadingAttr, SdfPathVector *sourcePaths)
static USDSHADE_API bool ConnectToSource(UsdShadeOutput const &output, UsdShadeConnectionSourceInfo const &source, ConnectionModification const mod=ConnectionModification::Replace)
SdfValueTypeName typeName
typeName, if specified, is the typename of the attribute to create on the source if it doesn't exist ...
UsdShadeConnectableAPI(const UsdSchemaBase &schemaObj)
Construct a UsdShadeConnectableAPI on the prim held by schemaObj .
static USDSHADE_API bool ConnectToSource(UsdShadeInput const &input, UsdShadeInput const &sourceInput)
This is a small-vector class with local storage optimization, the local storage can be specified via ...
static USDSHADE_API bool ConnectToSource(UsdAttribute const &shadingAttr, UsdShadeConnectionSourceInfo const &source, ConnectionModification const mod=ConnectionModification::Replace)
Authors a connection for a given shading attribute shadingAttr.
static USDSHADE_API bool ConnectToSource(UsdShadeInput const &input, UsdShadeOutput const &sourceOutput)
static USDSHADE_API bool ClearSources(UsdShadeInput const &input)
static USDSHADE_API bool ClearSource(UsdShadeOutput const &output)
USDSHADE_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
static USDSHADE_API bool CanConnect(const UsdShadeInput &input, const UsdShadeInput &sourceInput)
UsdAttribute GetAttr() const
Explicit UsdAttribute extractor.
Represents a value type name, i.e.
static USDSHADE_API bool DisconnectSource(UsdShadeOutput const &output, UsdAttribute const &sourceAttr=UsdAttribute())
The base class for all API schemas.
static USDSHADE_API bool ConnectToSource(UsdShadeOutput const &output, UsdShadeInput const &sourceInput)
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
USDSHADE_API UsdShadeOutput CreateOutput(const TfToken &name, const SdfValueTypeName &typeName) const
Create an output, which represents and externally computed, typed value.
static USDSHADE_API bool SetConnectedSources(UsdAttribute const &shadingAttr, std::vector< UsdShadeConnectionSourceInfo > const &sourceInfos)
Authors a list of connections for a given shading attribute shadingAttr.
static USDSHADE_API bool ConnectToSource(UsdShadeInput const &input, UsdShadeConnectionSourceInfo const &source, ConnectionModification const mod=ConnectionModification::Replace)
bool IsValid() const
Return true if this source info is valid for setting up a connection.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
static USDSHADE_API UsdShadeSourceInfoVector GetConnectedSources(UsdAttribute const &shadingAttr, SdfPathVector *invalidSourcePaths=nullptr)
Finds the valid sources of connections for the given shading attribute.
Token for efficient comparison, assignment, and hashing of known strings.
static USDSHADE_API bool CanConnect(const UsdShadeInput &input, const UsdShadeOutput &sourceOutput)
static USDSHADE_API bool GetConnectedSource(UsdShadeOutput const &output, UsdShadeConnectableAPI *source, TfToken *sourceName, UsdShadeAttributeType *sourceType)
TfToken sourceName
sourceName is the name of the shading attribute that is the target of the connection.
static bool HasConnectableAPI()
Return true if the schema type T has a connectableAPIBehavior registered, false otherwise.
static USDSHADE_API bool ClearSources(UsdShadeOutput const &output)
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 bool ConnectToSource(UsdShadeInput const &input, SdfPath const &sourcePath)
static USDSHADE_API bool ConnectToSource(UsdShadeOutput const &output, SdfPath const &sourcePath)
static USDSHADE_API bool ConnectToSource(UsdShadeInput const &input, UsdShadeConnectableAPI const &source, TfToken const &sourceName, UsdShadeAttributeType const sourceType=UsdShadeAttributeType::Output, SdfValueTypeName typeName=SdfValueTypeName())
static USDSHADE_API bool ClearSources(UsdAttribute const &shadingAttr)
Clears sources for this shading attribute in the current UsdEditTarget.
UsdShadeAttributeType sourceType
sourceType is used to indicate the type of the shading attribute that is the target of the connection...
USDSHADE_API UsdShadeInput CreateInput(const TfToken &name, const SdfValueTypeName &typeName) const
Create an input which can both have a value and be connected.
UsdShadeConnectableAPI is an API schema that provides a common interface for creating outputs and mak...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
virtual USDSHADE_API ~UsdShadeConnectableAPI()
Destructor.
std::vector< TfToken > TfTokenVector
Convenience types.
static USDSHADE_API bool IsSourceConnectionFromBaseMaterial(const UsdAttribute &shadingAttr)
Returns true if the connection to the given shading attribute's source, as returned by UsdShadeConnec...
USDSHADE_API bool _IsCompatible() const override
Returns true if the given prim is compatible with this API schema, i.e.
A path value used to locate objects in layers or scenegraphs.
static USDSHADE_API bool HasConnectedSource(const UsdShadeInput &input)
USDSHADE_API bool RequiresEncapsulation() const
Returns true if container encapsulation rules should be respected when evaluating connectibility beha...
static USDSHADE_API bool ConnectToSource(UsdShadeOutput const &output, UsdShadeOutput const &sourceOutput)
static USDSHADE_API bool ClearSource(UsdAttribute const &shadingAttr)
static USDSHADE_API bool GetConnectedSource(UsdAttribute const &shadingAttr, UsdShadeConnectableAPI *source, TfToken *sourceName, UsdShadeAttributeType *sourceType)
static USDSHADE_API bool GetConnectedSource(UsdShadeInput const &input, UsdShadeConnectableAPI *source, TfToken *sourceName, UsdShadeAttributeType *sourceType)
static USDSHADE_API bool HasConnectedSource(const UsdAttribute &shadingAttr)
Returns true if and only if the shading attribute is currently connected to at least one valid (defin...
Contains an asset path and an optional resolved path.
static USDSHADE_API bool CanConnect(const UsdShadeOutput &output, const UsdShadeOutput &sourceOutput)
UsdShadeConnectableAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdShadeConnectableAPI on UsdPrim prim .
static USDSHADE_API bool HasConnectedSource(const UsdShadeOutput &output)
static USDSHADE_API bool IsSourceConnectionFromBaseMaterial(const UsdShadeOutput &output)
bool IsEmpty() const
Returns true iff this token contains the empty string "".
static USDSHADE_API bool DisconnectSource(UsdAttribute const &shadingAttr, UsdAttribute const &sourceAttr=UsdAttribute())
Disconnect source for this shading attribute.
TfType represents a dynamic runtime type.
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDSHADE_API bool IsContainer() const
Returns true if the prim is a container.
A compact struct to represent a bundle of information about an upstream source attribute.
static USDSHADE_API bool CanConnect(const UsdShadeOutput &output, const UsdShadeInput &sourceInput)
This class encapsulates a shader or node-graph output, which is a connectable attribute representing ...
static USDSHADE_API bool DisconnectSource(UsdShadeInput const &input, UsdAttribute const &sourceAttr=UsdAttribute())
UsdShadeConnectableAPI source
source is the connectable prim that produces or contains a value for the given shading attribute...
The base class for all schema types in Usd.
USDSHADE_API std::vector< UsdShadeOutput > GetOutputs(bool onlyAuthored=true) const
Returns all outputs on the connectable prim (i.e.
USDSHADE_API UsdShadeInput GetInput(const TfToken &name) const
Return the requested input if it exists.
static USDSHADE_API bool CanConnect(const UsdShadeInput &input, const UsdAttribute &source)
Determines whether the given input can be connected to the given source attribute, which can be an input or an output.
static USDSHADE_API UsdShadeConnectableAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdShadeConnectableAPI holding the prim adhering to this schema at path on stage...
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
static USDSHADE_API bool IsSourceConnectionFromBaseMaterial(const UsdShadeInput &input)
static USDSHADE_API bool GetRawConnectedSourcePaths(UsdShadeInput const &input, SdfPathVector *sourcePaths)
UsdPrim GetPrim() const
Return this schema object's held prim.
static USDSHADE_API bool ClearSource(UsdShadeInput const &input)