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 SDR_REGISTRY_H
26 #define 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 
88  SDR_API
89  SdrShaderNodeConstPtr GetShaderNodeFromSourceCode(
90  const std::string &sourceCode,
91  const TfToken &sourceType,
92  const NdrTokenMap &metadata=NdrTokenMap());
93 
96  SDR_API
97  SdrShaderNodeConstPtr GetShaderNodeByURI(const std::string& uri);
98 
101  SDR_API
102  SdrShaderNodePtrVec GetShaderNodesByIdentifier(const NdrIdentifier& identifier);
103 
106  SDR_API
107  SdrShaderNodePtrVec GetShaderNodesByName(
108  const std::string& name,
109  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
110 
113  SDR_API
114  SdrShaderNodePtrVec GetShaderNodesByFamily(
115  const TfToken& family = TfToken(),
116  NdrVersionFilter filter = NdrVersionFilterDefaultOnly);
117 
118 protected:
119  // Allow TF to construct the class
120  friend class TfSingleton<SdrRegistry>;
121 
122  SdrRegistry();
123  ~SdrRegistry();
124 };
125 
126 PXR_NAMESPACE_CLOSE_SCOPE
127 
128 #endif // SDR_REGISTRY_H
SDR_API SdrShaderNodeConstPtr GetShaderNodeFromAsset(const SdfAssetPath &shaderAsset, const NdrTokenMap &metadata=NdrTokenMap())
Wrapper method for NdrRegistry::GetNodeFromAsset().
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:89
SDR_API SdrShaderNodePtrVec GetShaderNodesByIdentifier(const NdrIdentifier &identifier)
Exactly like NdrRegistry::GetNodesByIdentifier(), but returns a vector of SdrShaderNode pointers inst...
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...