All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
registry.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 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 
25 #ifndef PXR_USD_SDR_REGISTRY_H
26 #define PXR_USD_SDR_REGISTRY_H
27 
29 
30 #include "pxr/pxr.h"
31 #include "pxr/usd/sdr/api.h"
32 #include "pxr/usd/ndr/registry.h"
33 #include "pxr/usd/sdr/declare.h"
34 #include "pxr/usd/sdr/shaderNode.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
42 class SdrRegistry : public NdrRegistry
43 {
44 public:
46  SDR_API
47  static SdrRegistry& GetInstance();
48 
51  SDR_API
52  SdrShaderNodeConstPtr GetShaderNodeByIdentifier(
53  const NdrIdentifier& identifier,
54  const NdrTokenVec& typePriority = NdrTokenVec());
55 
58  SDR_API
59  SdrShaderNodeConstPtr GetShaderNodeByIdentifierAndType(
60  const NdrIdentifier& identifier,
61  const TfToken& nodeType);
62 
65  SDR_API
66  SdrShaderNodeConstPtr GetShaderNodeByName(
67  const std::string& name,
68  const NdrTokenVec& typePriority = NdrTokenVec(),
69  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
70 
73  SDR_API
74  SdrShaderNodeConstPtr GetShaderNodeByNameAndType(
75  const std::string& name,
76  const TfToken& nodeType,
77  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
78 
81  SDR_API
82  SdrShaderNodeConstPtr GetShaderNodeFromAsset(
83  const SdfAssetPath &shaderAsset,
84  const NdrTokenMap &metadata=NdrTokenMap(),
85  const TfToken &subIdentifier=TfToken(),
86  const TfToken &sourceType=TfToken());
87 
90  SDR_API
91  SdrShaderNodeConstPtr GetShaderNodeFromSourceCode(
92  const std::string &sourceCode,
93  const TfToken &sourceType,
94  const NdrTokenMap &metadata=NdrTokenMap());
95 
98  SDR_API
99  SdrShaderNodeConstPtr GetShaderNodeByURI(const std::string& uri);
100 
103  SDR_API
104  SdrShaderNodePtrVec GetShaderNodesByIdentifier(const NdrIdentifier& identifier);
105 
108  SDR_API
109  SdrShaderNodePtrVec GetShaderNodesByName(
110  const std::string& name,
111  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
112 
115  SDR_API
116  SdrShaderNodePtrVec GetShaderNodesByFamily(
117  const TfToken& family = TfToken(),
118  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
119 
120 protected:
121  // Allow TF to construct the class
122  friend class TfSingleton<SdrRegistry>;
123 
124  SdrRegistry();
125  ~SdrRegistry();
126 };
127 
128 PXR_NAMESPACE_CLOSE_SCOPE
129 
130 #endif // PXR_USD_SDR_REGISTRY_H
SDR_API SdrShaderNodePtrVec GetShaderNodesByFamily(const TfToken &family=TfToken(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Exactly like NdrRegistry::GetNodesByFamily(), but returns a vector of SdrShaderNode pointers instead ...
Manage a single instance of an object (see.
Definition: singleton.h:122
SDR_API SdrShaderNodeConstPtr GetShaderNodeFromSourceCode(const std::string &sourceCode, const TfToken &sourceType, const NdrTokenMap &metadata=NdrTokenMap())
Wrapper method for NdrRegistry::GetNodeFromSourceCode().
SDR_API SdrShaderNodeConstPtr GetShaderNodeByURI(const std::string &uri)
Exactly like NdrRegistry::GetNodeByURI(), but returns a SdrShaderNode pointer instead of a NdrNode po...
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
SDR_API SdrShaderNodePtrVec GetShaderNodesByIdentifier(const NdrIdentifier &identifier)
Exactly like NdrRegistry::GetNodesByIdentifier(), but returns a vector of SdrShaderNode pointers inst...
SDR_API SdrShaderNodeConstPtr GetShaderNodeFromAsset(const SdfAssetPath &shaderAsset, const NdrTokenMap &metadata=NdrTokenMap(), const TfToken &subIdentifier=TfToken(), const TfToken &sourceType=TfToken())
Wrapper method for NdrRegistry::GetNodeFromAsset().
static SDR_API SdrRegistry & GetInstance()
Get the single SdrRegistry instance.
SDR_API SdrShaderNodePtrVec GetShaderNodesByName(const std::string &name, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Exactly like NdrRegistry::GetNodesByName(), but returns a vector of SdrShaderNode pointers instead of...
NdrVersionFilter
Enumeration used to select nodes by version.
Definition: declare.h:203
The registry provides access to node information.
Definition: registry.h:63
SDR_API SdrShaderNodeConstPtr GetShaderNodeByNameAndType(const std::string &name, const TfToken &nodeType, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Exactly like NdrRegistry::GetNodeByNameAndType(), but returns a SdrShaderNode pointer instead of a Nd...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByIdentifier(const NdrIdentifier &identifier, const NdrTokenVec &typePriority=NdrTokenVec())
Exactly like NdrRegistry::GetNodeByIdentifier(), but returns a SdrShaderNode pointer instead of a Ndr...
The shading-specialized version of NdrRegistry.
Definition: registry.h:42
Contains an asset path and an optional resolved path.
Definition: assetPath.h:43
SDR_API SdrShaderNodeConstPtr GetShaderNodeByIdentifierAndType(const NdrIdentifier &identifier, const TfToken &nodeType)
Exactly like NdrRegistry::GetNodeByIdentifierAndType(), but returns a SdrShaderNode pointer instead o...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByName(const std::string &name, const NdrTokenVec &typePriority=NdrTokenVec(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Exactly like NdrRegistry::GetNodeByName(), but returns a SdrShaderNode pointer instead of a NdrNode p...