HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shaderNodeDiscoveryResult.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 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_NODE_DISCOVERY_RESULT_H
9 #define PXR_USD_SDR_NODE_DISCOVERY_RESULT_H
10 
11 /// \file sdr/shaderNodeDiscoveryResult.h
12 
13 #include "pxr/usd/sdr/declare.h"
14 
16 
17 /// Represents the raw data of a node, and some other bits of metadata, that
18 /// were determined via a `SdrDiscoveryPlugin`.
20  /// Constructor.
23  const SdrVersion& version,
24  const std::string& name,
25  const TfToken& function,
26  const TfToken& discoveryType,
27  const TfToken& shadingSystem,
28  const std::string& uri,
29  const std::string& resolvedUri,
30  const std::string &sourceCode=std::string(),
32  const std::string& blindData=std::string(),
34  ) : identifier(identifier),
35  version(version),
36  name(name),
39  discoveryType(discoveryType),
40  shadingSystem(shadingSystem),
41  sourceType(this->shadingSystem),
42  uri(uri),
43  resolvedUri(resolvedUri),
48  { }
49 
50  /// The following methods will removed in favor of implicitly defined
51  /// methods once `sourceType` is fully removed from Sdr. The sourceType
52  /// reference to shadingSystem in this class causes this group of formerly
53  /// implicit methods to be deleted.
54  /// {@
56  : identifier(std::move(other.identifier)),
57  version(std::move(other.version)),
58  name(std::move(other.name)),
59  function(std::move(other.function)),
61  discoveryType(std::move(other.discoveryType)),
62  shadingSystem(std::move(other.shadingSystem)),
63  sourceType(this->shadingSystem),
64  uri(std::move(other.uri)),
65  resolvedUri(std::move(other.resolvedUri)),
66  sourceCode(std::move(other.sourceCode)),
67  metadata(std::move(other.metadata)),
68  blindData(std::move(other.blindData)),
69  subIdentifier(std::move(other.subIdentifier))
70  { }
71 
73  : identifier(other.identifier),
74  version(other.version),
75  name(other.name),
76  function(other.function),
78  discoveryType(other.discoveryType),
79  shadingSystem(other.shadingSystem),
80  sourceType(this->shadingSystem),
81  uri(other.uri),
82  resolvedUri(other.resolvedUri),
83  sourceCode(other.sourceCode),
84  metadata(other.metadata),
85  blindData(other.blindData),
87  { }
88 
91  {
92  this->identifier = std::move(other.identifier);
93  this->version = std::move(other.version);
94  this->name = std::move(other.name);
95  this->function = std::move(other.function);
96  this->family = this->function;
97  this->discoveryType = std::move(other.discoveryType);
98  this->shadingSystem = std::move(other.shadingSystem);
99  this->sourceType = this->shadingSystem;
100  this->uri = std::move(other.uri);
101  this->resolvedUri = std::move(other.resolvedUri);
102  this->sourceCode = std::move(other.sourceCode);
103  this->metadata = std::move(other.metadata);
104  this->blindData = std::move(other.blindData);
105  this->subIdentifier = std::move(other.subIdentifier);
106  return *this;
107  }
108 
110  const SdrShaderNodeDiscoveryResult& other)
111  {
112  SdrShaderNodeDiscoveryResult copy(other);
113  *this = std::move(copy);
114  return *this;
115  }
116  /// @}
117 
118  /// The node's identifier.
119  ///
120  /// How the node is identified. In many cases this will be the
121  /// name of the file or resource that this node originated from.
122  /// E.g. "mix_float_2_1". The identifier must be unique for a
123  /// given sourceType.
125 
126  /// The node's version. This may or may not be embedded in the
127  /// identifier, it's up to implementations. E.g a node with
128  /// identifier "mix_float_2_1" might have version 2.1.
130 
131  /// The node's name.
132  ///
133  /// A version independent identifier for the node type. This will
134  /// often embed type parameterization but should not embed the
135  /// version. E.g a node with identifier "mix_float_2_1" might have
136  /// name "mix_float".
137  std::string name;
138 
139  /// The node's function.
140  ///
141  /// A node's function specifies a generic grouping of nodes.
142  /// E.g a node with identifier "mix_float_2_1" might have function "mix".
143  TfToken function;
144 
145  /// The node's family.
146  ///
147  /// \deprecated
148  /// Deprecated in favor of `function`.
150 
151  /// The node's discovery type.
152  ///
153  /// The type could be the file extension, or some other type of metadata
154  /// that can signify a type prior to parsing. See the documentation for
155  /// `SdrParserPlugin` and `SdrParserPlugin::DiscoveryTypes` for more
156  /// information on how this value is used.
158 
159  /// The node's shading system.
160  ///
161  /// This type is unique to the parsing plugin and indicates what shading
162  /// language and standard should be used to interpret this discovery
163  /// result.
164  /// \sa SdrShaderNode::GetShadingSystem
166 
167  /// The node's source type.
168  ///
169  /// \deprecated
170  /// Deprecated in favor of `shadingSystem`
172 
173  /// The node's origin.
174  ///
175  /// This may be a filesystem path, a URL pointing to a resource in the
176  /// cloud, or some other type of resource identifier.
177  std::string uri;
178 
179  /// The node's fully-resolved URI.
180  ///
181  /// For example, this might be an absolute path when the original URI was
182  /// a relative path. In most cases, this is the path that `Ar`'s
183  /// `Resolve()` returns. In any case, this path should be locally
184  /// accessible.
185  std::string resolvedUri;
186 
187  /// The node's entire source code.
188  ///
189  /// The source code is parsed (if non-empty) by parser plugins when the
190  /// resolvedUri value is empty.
191  std::string sourceCode;
192 
193  /// The node's metadata collected during the discovery process.
194  ///
195  /// Additional metadata may be present in the node's source, in the asset
196  /// pointed to by resolvedUri or in sourceCode (if resolvedUri is empty).
197  /// In general, parsers should override this data with metadata from the
198  /// shader source.
200 
201  /// An optional detail for the parser plugin. The parser plugin
202  /// defines the meaning of this data so the discovery plugin must
203  /// be written to match.
204  std::string blindData;
205 
206  /// The subIdentifier is associated with a particular asset and refers to a
207  /// specific definition within the asset. The asset is the one referred to
208  /// by `SdrRegistry::GetNodeFromAsset()`. The subIdentifier is not needed
209  /// for all cases where the node definition is not associated with an asset.
210  /// Even if the node definition is associated with an asset, the
211  /// subIdentifier is only needed if the asset specifies multiple definitions
212  /// rather than a single definition.
214 };
215 
216 typedef std::vector<SdrShaderNodeDiscoveryResult> SdrShaderNodeDiscoveryResultVec;
217 
219 
220 #endif // PXR_USD_SDR_NODE_DISCOVERY_RESULT_H
std::vector< SdrShaderNodeDiscoveryResult > SdrShaderNodeDiscoveryResultVec
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
SdrShaderNodeDiscoveryResult(const SdrIdentifier &identifier, const SdrVersion &version, const std::string &name, const TfToken &function, const TfToken &discoveryType, const TfToken &shadingSystem, const std::string &uri, const std::string &resolvedUri, const std::string &sourceCode=std::string(), const SdrTokenMap &metadata=SdrTokenMap(), const std::string &blindData=std::string(), const TfToken &subIdentifier=TfToken())
Constructor.
**But if you need a or simply need to know when the task has note that the like this
Definition: thread.h:626
SdrVersion.
Definition: declare.h:67
Definition: token.h:70
SdrShaderNodeDiscoveryResult(SdrShaderNodeDiscoveryResult &&other)
SdrShaderNodeDiscoveryResult & operator=(SdrShaderNodeDiscoveryResult &&other)
GLuint const GLchar * name
Definition: glcorearb.h:786
SdrShaderNodeDiscoveryResult & operator=(const SdrShaderNodeDiscoveryResult &other)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
SdrShaderNodeDiscoveryResult(const SdrShaderNodeDiscoveryResult &other)
std::unordered_map< TfToken, std::string, TfToken::HashFunctor > SdrTokenMap
Definition: declare.h:41