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.
38  ///
39  /// \deprecated
40  /// Deprecated in favor of GetDiscoveryResults
43  const UsdShadeShader &shaderDef,
44  const std::string &sourceUri);
45 
46  /// Returns the list of SdrShaderNodeDiscoveryResult objects that must be
47  /// added to the shader registry for the given shader \p shaderDef,
48  /// assuming it is found in a shader definition file found by an Sdr
49  /// discovery plugin.
50  ///
51  /// To enable the shaderDef parser to find and parse this shader,
52  /// \p sourceUri should have the resolved path to the usd file containing
53  /// this shader prim.
56  const UsdShadeShader &shaderDef,
57  const std::string &sourceUri);
58 
59  /// Gets all input and output properties of the given \p shaderDef and
60  /// translates them into SdrShaderProperties that can be used as the
61  /// properties for an SdrShaderNode.
62  ///
63  /// \deprecated
64  /// Deprecated in favor of GetProperties
67  const UsdShadeConnectableAPI &shaderDef);
68 
69  /// Gets all input and output properties of the given \p shaderDef and
70  /// translates them into SdrShaderProperties that can be used as the
71  /// properties for an SdrShaderNode.
74  const UsdShadeConnectableAPI &shaderDef);
75 
76  /// Collects all the names of valid primvar inputs of the given \p metadata
77  /// and the given \p shaderDef and returns the string used to represent
78  /// them in SdrShaderNode metadata.
80  static std::string GetPrimvarNamesMetadataString(
81  const SdrTokenMap metadata,
82  const UsdShadeConnectableAPI &shaderDef);
83 };
84 
86 
87 #endif
std::vector< SdrShaderNodeDiscoveryResult > SdrShaderNodeDiscoveryResultVec
#define USDSHADE_API
Definition: api.h:23
static USDSHADE_API SdrShaderNodeDiscoveryResultVec GetDiscoveryResults(const UsdShadeShader &shaderDef, const std::string &sourceUri)
std::vector< NdrNodeDiscoveryResult > NdrNodeDiscoveryResultVec
std::vector< NdrPropertyUniquePtr > NdrPropertyUniquePtrVec
Definition: declare.h:58
static USDSHADE_API SdrShaderPropertyUniquePtrVec GetProperties(const UsdShadeConnectableAPI &shaderDef)
static USDSHADE_API std::string GetPrimvarNamesMetadataString(const SdrTokenMap metadata, const UsdShadeConnectableAPI &shaderDef)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static USDSHADE_API NdrPropertyUniquePtrVec GetShaderProperties(const UsdShadeConnectableAPI &shaderDef)
static USDSHADE_API NdrNodeDiscoveryResultVec GetNodeDiscoveryResults(const UsdShadeShader &shaderDef, const std::string &sourceUri)
std::unordered_map< TfToken, std::string, TfToken::HashFunctor > SdrTokenMap
Definition: declare.h:47
std::vector< SdrShaderPropertyUniquePtr > SdrShaderPropertyUniquePtrVec
Definition: declare.h:61