Loading...
Searching...
No Matches
registry.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
8#ifndef PXR_USD_SDR_REGISTRY_H
9#define PXR_USD_SDR_REGISTRY_H
10
17
18#include "pxr/pxr.h"
21#include "pxr/usd/sdr/api.h"
22#include "pxr/usd/sdr/declare.h"
28#include <map>
29#include <mutex>
30
31PXR_NAMESPACE_OPEN_SCOPE
32
56{
57public:
58 using DiscoveryPluginRefPtrVec = SdrDiscoveryPluginRefPtrVector;
59
61 SDR_API
63
71 SDR_API
73
78 SDR_API
80 const SdrShaderNodeDiscoveryResult& discoveryResult);
81
83
91 SDR_API
92 SdrIdentifierVec
94 SdrVersionFilter filter =
95 SdrVersionFilterDefaultOnly) const;
96
103 SDR_API
104 SdrStringVec GetShaderNodeNames(const TfToken& family = TfToken()) const;
105
127 SDR_API
128 SdrShaderNodeConstPtr GetShaderNodeByIdentifier(
129 const SdrIdentifier& identifier,
130 const SdrTokenVec& typePriority = SdrTokenVec());
131
134 SDR_API
135 SdrShaderNodeConstPtr GetShaderNodeByIdentifierAndType(
136 const SdrIdentifier& identifier,
137 const TfToken& nodeType);
138
143 SDR_API
144 SdrShaderNodeConstPtr GetShaderNodeByName(
145 const std::string& name,
146 const NdrTokenVec& typePriority,
147 NdrVersionFilter filter);
148
159 SDR_API
160 SdrShaderNodeConstPtr GetShaderNodeByName(
161 const std::string& name,
162 const SdrTokenVec& typePriority = SdrTokenVec(),
163 SdrVersionFilter filter = SdrVersionFilterDefaultOnly);
164
169 SDR_API
170 SdrShaderNodeConstPtr GetShaderNodeByNameAndType(
171 const std::string& name,
172 const TfToken& nodeType,
173 NdrVersionFilter filter);
174
183 SDR_API
184 SdrShaderNodeConstPtr GetShaderNodeByNameAndType(
185 const std::string& name,
186 const TfToken& nodeType,
187 SdrVersionFilter filter = SdrVersionFilterDefaultOnly);
188
211 SDR_API
212 SdrShaderNodeConstPtr GetShaderNodeFromAsset(
213 const SdfAssetPath &shaderAsset,
214 const SdrTokenMap &metadata=SdrTokenMap(),
215 const TfToken &subIdentifier=TfToken(),
216 const TfToken &sourceType=TfToken());
217
233 SDR_API
234 SdrShaderNodeConstPtr GetShaderNodeFromSourceCode(
235 const std::string &sourceCode,
236 const TfToken &sourceType,
237 const SdrTokenMap &metadata=SdrTokenMap());
238
242 SDR_API
243 SdrShaderNodePtrVec GetShaderNodesByIdentifier(const SdrIdentifier& identifier);
244
249 SDR_API
250 SdrShaderNodePtrVec GetShaderNodesByName(
251 const std::string& name,
252 NdrVersionFilter filter);
253
258 SDR_API
259 SdrShaderNodePtrVec GetShaderNodesByName(
260 const std::string& name,
261 SdrVersionFilter filter = SdrVersionFilterDefaultOnly);
262
268 SDR_API
269 SdrShaderNodePtrVec GetShaderNodesByFamily(
270 const TfToken& family,
271 NdrVersionFilter filter);
272
279 SDR_API
280 SdrShaderNodePtrVec GetShaderNodesByFamily(
281 const TfToken& family = TfToken(),
282 SdrVersionFilter filter = SdrVersionFilterDefaultOnly);
283
295 SDR_API
296 SdrTokenVec GetAllShaderNodeSourceTypes() const;
297
298protected:
299 // Allow TF to construct the class
300 friend class TfSingleton<SdrRegistry>;
301
302 SDR_API
303 SdrRegistry();
304
305 SDR_API
306 ~SdrRegistry();
307};
308
309PXR_NAMESPACE_CLOSE_SCOPE
310
311#endif // PXR_USD_SDR_REGISTRY_H
The registry provides access to node information.
Definition: registry.h:54
NDR_API void AddDiscoveryResult(NdrNodeDiscoveryResult &&discoveryResult)
Allows the client to explicitly set additional discovery results that would otherwise NOT be found th...
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:73
The registry provides access to shader node information.
Definition: registry.h:56
SDR_API SdrShaderNodeConstPtr GetShaderNodeByName(const std::string &name, const SdrTokenVec &typePriority=SdrTokenVec(), SdrVersionFilter filter=SdrVersionFilterDefaultOnly)
Get the shader node with the specified name.
SDR_API SdrShaderNodePtrVec GetShaderNodesByFamily(const TfToken &family=TfToken(), SdrVersionFilter filter=SdrVersionFilterDefaultOnly)
Get all shader nodes, optionally restricted to the nodes that fall under a specified family and/or th...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByIdentifierAndType(const SdrIdentifier &identifier, const TfToken &nodeType)
Get the shader node with the specified identifier and sourceType.
SDR_API SdrShaderNodeConstPtr GetShaderNodeByIdentifier(const SdrIdentifier &identifier, const SdrTokenVec &typePriority=SdrTokenVec())
Get the shader node with the specified identifier, and an optional sourceTypePriority list specifying...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByName(const std::string &name, const NdrTokenVec &typePriority, NdrVersionFilter filter)
Get the shader node with the specified name.
SDR_API SdrShaderNodePtrVec GetShaderNodesByIdentifier(const SdrIdentifier &identifier)
Get all shader nodes matching the given identifier (multiple nodes of the same identifier,...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByNameAndType(const std::string &name, const TfToken &nodeType, SdrVersionFilter filter=SdrVersionFilterDefaultOnly)
A convenience wrapper around GetShaderNodeByName().
static SDR_API SdrRegistry & GetInstance()
Get the single SdrRegistry instance.
SDR_API SdrStringVec GetShaderNodeNames(const TfToken &family=TfToken()) const
Get the names of all the shader nodes that the registry is aware of.
SDR_API SdrShaderNodePtrVec GetShaderNodesByName(const std::string &name, NdrVersionFilter filter)
Get all shader nodes matching the given name.
SDR_API void AddDiscoveryResult(const SdrShaderNodeDiscoveryResult &discoveryResult)
Copy version of the method above.
SDR_API void AddDiscoveryResult(SdrShaderNodeDiscoveryResult &&discoveryResult)
Allows the client to explicitly set additional discovery results that would otherwise NOT be found th...
SDR_API SdrShaderNodePtrVec GetShaderNodesByFamily(const TfToken &family, NdrVersionFilter filter)
Get all shader nodes, optionally restricted to the nodes that fall under a specified family and/or th...
SDR_API SdrShaderNodeConstPtr GetShaderNodeByNameAndType(const std::string &name, const TfToken &nodeType, NdrVersionFilter filter)
A convenience wrapper around GetShaderNodeByName().
SDR_API SdrTokenVec GetAllShaderNodeSourceTypes() const
Get a sorted list of all shader node source types that may be present on the nodes in the registry.
SDR_API SdrIdentifierVec GetShaderNodeIdentifiers(const TfToken &family=TfToken(), SdrVersionFilter filter=SdrVersionFilterDefaultOnly) const
Get identifiers of all the shader nodes that the registry is aware of.
SDR_API SdrShaderNodeConstPtr GetShaderNodeFromAsset(const SdfAssetPath &shaderAsset, const SdrTokenMap &metadata=SdrTokenMap(), const TfToken &subIdentifier=TfToken(), const TfToken &sourceType=TfToken())
Parses the given asset, constructs a SdrShaderNode from it and adds it to the registry.
SDR_API SdrShaderNodeConstPtr GetShaderNodeFromSourceCode(const std::string &sourceCode, const TfToken &sourceType, const SdrTokenMap &metadata=SdrTokenMap())
Parses the given sourceCode string, constructs a SdrShaderNode from it and adds it to the registry.
SDR_API SdrShaderNodePtrVec GetShaderNodesByName(const std::string &name, SdrVersionFilter filter=SdrVersionFilterDefaultOnly)
Get all shader nodes matching the given name.
Manage a single instance of an object (see.
Definition: singleton.h:105
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Manage a single instance of an object.
Represents the raw data of a node, and some other bits of metadata, that were determined via a SdrDis...
NdrVersionFilter
Enumeration used to select nodes by version.
Definition: declare.h:198
SdrVersionFilter
Enumeration used to select nodes by version.
Definition: declare.h:190