This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utils.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_SHADE_UTILS_H
8#define PXR_USD_USD_SHADE_UTILS_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usdShade/api.h"
12#include "pxr/usd/usdShade/types.h"
13#include "pxr/usd/sdf/path.h"
14#include "pxr/usd/usd/attribute.h"
15
17#include "pxr/base/tf/token.h"
18
19#include <string>
20#include <utility>
21
22PXR_NAMESPACE_OPEN_SCOPE
23
24class UsdShadeInput;
25class UsdShadeOutput;
27
34public:
37 USDSHADE_API
38 static std::string GetPrefixForAttributeType(
39 UsdShadeAttributeType sourceType);
40
43 USDSHADE_API
44 static SdfPath
46
49 USDSHADE_API
50 static std::pair<TfToken, UsdShadeAttributeType>
51 GetBaseNameAndType(const TfToken &fullName);
52
55 USDSHADE_API
56 static UsdShadeAttributeType GetType(const TfToken &fullName);
57
62 USDSHADE_API
63 static TfToken GetFullName(const TfToken &baseName,
64 const UsdShadeAttributeType type);
65
107 USDSHADE_API
109 UsdShadeInput const &input,
110 bool shaderOutputsOnly = false);
112 USDSHADE_API
114 UsdShadeOutput const &output,
115 bool shaderOutputsOnly = false);
116};
117
118PXR_NAMESPACE_CLOSE_SCOPE
119
120#endif
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:157
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
This class encapsulates a shader or node-graph input, which is a connectable attribute representing a...
Definition: input.h:32
This class encapsulates a shader or node-graph output, which is a connectable attribute representing ...
Definition: output.h:31
This class contains a set of utility functions used when authoring and querying shading networks.
Definition: utils.h:33
static USDSHADE_API std::string GetPrefixForAttributeType(UsdShadeAttributeType sourceType)
Returns the namespace prefix of the USD attribute associated with the given shading attribute type.
static USDSHADE_API UsdShadeAttributeType GetType(const TfToken &fullName)
Given the full name of a shading attribute, returns its shading attribute type.
static USDSHADE_API TfToken GetFullName(const TfToken &baseName, const UsdShadeAttributeType type)
Returns the full shading attribute name given the basename and the shading attribute type.
static USDSHADE_API UsdShadeAttributeVector GetValueProducingAttributes(UsdShadeOutput const &output, bool shaderOutputsOnly=false)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static USDSHADE_API std::pair< TfToken, UsdShadeAttributeType > GetBaseNameAndType(const TfToken &fullName)
Given the full name of a shading attribute, returns it's base name and shading attribute type.
static USDSHADE_API UsdShadeAttributeVector GetValueProducingAttributes(UsdShadeInput const &input, bool shaderOutputsOnly=false)
Find what is connected to an Input or Output recursively.
static USDSHADE_API SdfPath GetConnectedSourcePath(const UsdShadeConnectionSourceInfo &srcInfo)
For a valid UsdShadeConnectionSourceInfo, return the complete path to the source property; otherwise ...
A compact struct to represent a bundle of information about an upstream source attribute.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...