HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shaderDefUtils.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 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_SHADER_DEF_UTILS_H
8 #define PXR_USD_USD_SHADE_SHADER_DEF_UTILS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/usdShade/api.h"
13 
16 
17 #include <string>
18 
20 
21 class UsdShadeShader;
22 
23 /// \class UsdShadeShaderDefUtils
24 ///
25 /// This class contains a set of utility functions used for populating the
26 /// shader registry with shaders definitions specified using UsdShade schemas.
27 ///
29 public:
30  /// Returns the list of SdrShaderNodeDiscoveryResult objects that must be
31  /// added to the shader registry for the given shader \p shaderDef,
32  /// assuming it is found in a shader definition file found by an Sdr
33  /// discovery plugin.
34  ///
35  /// To enable the shaderDef parser to find and parse this shader,
36  /// \p sourceUri should have the resolved path to the usd file containing
37  /// this shader prim.
40  const UsdShadeShader &shaderDef,
41  const std::string &sourceUri);
42 
43  /// Gets all input and output properties of the given \p shaderDef and
44  /// translates them into SdrShaderProperties that can be used as the
45  /// properties for an SdrShaderNode.
48  const UsdShadeConnectableAPI &shaderDef);
49 
50  /// Collects all the names of valid primvar inputs of the given \p metadata
51  /// and the given \p shaderDef and returns the string used to represent
52  /// them in SdrShaderNode metadata.
54  static std::string GetPrimvarNamesMetadataString(
55  const SdrTokenMap metadata,
56  const UsdShadeConnectableAPI &shaderDef);
57 };
58 
60 
61 #endif
std::vector< SdrShaderNodeDiscoveryResult > SdrShaderNodeDiscoveryResultVec
#define USDSHADE_API
Definition: api.h:23
static USDSHADE_API SdrShaderNodeDiscoveryResultVec GetDiscoveryResults(const UsdShadeShader &shaderDef, const std::string &sourceUri)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static USDSHADE_API SdrShaderPropertyUniquePtrVec GetProperties(const UsdShadeConnectableAPI &shaderDef)
static USDSHADE_API std::string GetPrimvarNamesMetadataString(const SdrTokenMap metadata, const UsdShadeConnectableAPI &shaderDef)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::unordered_map< TfToken, std::string, TfToken::HashFunctor > SdrTokenMap
Definition: declare.h:41
std::vector< SdrShaderPropertyUniquePtr > SdrShaderPropertyUniquePtrVec
Definition: declare.h:55