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/sdf/path.h"
31 #include "pxr/usd/usd/attribute.h"
32 
34 #include "pxr/base/tf/token.h"
35 
36 #include <string>
37 #include <utility>
38 
39 PXR_NAMESPACE_OPEN_SCOPE
40 
41 class UsdShadeInput;
42 class UsdShadeOutput;
44 
51 public:
54  USDSHADE_API
55  static std::string GetPrefixForAttributeType(
56  UsdShadeAttributeType sourceType);
57 
60  USDSHADE_API
61  static SdfPath
63 
66  USDSHADE_API
67  static std::pair<TfToken, UsdShadeAttributeType>
68  GetBaseNameAndType(const TfToken &fullName);
69 
72  USDSHADE_API
73  static UsdShadeAttributeType GetType(const TfToken &fullName);
74 
79  USDSHADE_API
80  static TfToken GetFullName(const TfToken &baseName,
81  const UsdShadeAttributeType type);
82 
124  USDSHADE_API
126  UsdShadeInput const &input,
127  bool shaderOutputsOnly = false);
129  USDSHADE_API
131  UsdShadeOutput const &output,
132  bool shaderOutputsOnly = false);
133 };
134 
135 PXR_NAMESPACE_CLOSE_SCOPE
136 
137 #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 SdfPath GetConnectedSourcePath(const UsdShadeConnectionSourceInfo &srcInfo)
For a valid UsdShadeConnectionSourceInfo, return the complete path to the source property; otherwise ...
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:50
static USDSHADE_API std::string GetPrefixForAttributeType(UsdShadeAttributeType sourceType)
Returns the namespace prefix of the USD attribute associated with the given shading attribute type.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
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's base name and shading attribute type.
A compact struct to represent a bundle of information about an upstream source attribute.
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...