All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_USD_SHADE_UTILS_H
25 #define PXR_USD_USD_SHADE_UTILS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/usdShade/api.h"
29 #include "pxr/usd/usdShade/types.h"
30 #include "pxr/usd/usd/attribute.h"
31 
33 #include "pxr/base/tf/token.h"
34 
35 #include <string>
36 #include <utility>
37 
38 PXR_NAMESPACE_OPEN_SCOPE
39 
40 class UsdShadeInput;
41 class UsdShadeOutput;
42 
49 public:
52  USDSHADE_API
53  static std::string GetPrefixForAttributeType(
54  UsdShadeAttributeType sourceType);
55 
58  USDSHADE_API
59  static std::pair<TfToken, UsdShadeAttributeType>
60  GetBaseNameAndType(const TfToken &fullName);
61 
64  USDSHADE_API
65  static UsdShadeAttributeType GetType(const TfToken &fullName);
66 
71  USDSHADE_API
72  static TfToken GetFullName(const TfToken &baseName,
73  const UsdShadeAttributeType type);
74 
116  USDSHADE_API
118  UsdShadeInput const &input,
119  bool shaderOutputsOnly = false);
121  USDSHADE_API
123  UsdShadeOutput const &output,
124  bool shaderOutputsOnly = false);
125 };
126 
127 PXR_NAMESPACE_CLOSE_SCOPE
128 
129 #endif
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Definition: smallVector.h:177
static USDSHADE_API UsdShadeAttributeVector GetValueProducingAttributes(UsdShadeInput const &input, bool shaderOutputsOnly=false)
Find what is connected to an Input or Output recursively.
static USDSHADE_API UsdShadeAttributeType GetType(const TfToken &fullName)
Given the full name of a shading attribute, returns its shading attribute type.
This class encapsulates a shader or node-graph input, which is a connectable attribute representing a...
Definition: input.h:48
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
This class contains a set of utility functions used when authoring and querying shading networks...
Definition: utils.h:48
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 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 std::pair< TfToken, UsdShadeAttributeType > GetBaseNameAndType(const TfToken &fullName)
Given the full name of a shading attribute, returns it&#39;s base name and shading attribute type...
This class encapsulates a shader or node-graph output, which is a connectable attribute representing ...
Definition: output.h:47
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...