HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shader.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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 #ifndef USDSHADE_GENERATED_SHADER_H
25 #define USDSHADE_GENERATED_SHADER_H
26 
27 /// \file usdShade/shader.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdShade/api.h"
31 #include "pxr/usd/usd/typed.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
35 
36 #include "pxr/usd/usdShade/input.h"
38 #include "pxr/usd/ndr/declare.h"
39 #include "pxr/usd/sdr/shaderNode.h"
40 
41 #include "pxr/base/vt/value.h"
42 
43 #include "pxr/base/gf/vec3d.h"
44 #include "pxr/base/gf/vec3f.h"
45 #include "pxr/base/gf/matrix4d.h"
46 
47 #include "pxr/base/tf/token.h"
48 #include "pxr/base/tf/type.h"
49 
51 
52 class SdfAssetPath;
53 
54 // -------------------------------------------------------------------------- //
55 // SHADER //
56 // -------------------------------------------------------------------------- //
57 
58 /// \class UsdShadeShader
59 ///
60 /// Base class for all USD shaders. Shaders are the building blocks
61 /// of shading networks. While UsdShadeShader objects are not target specific,
62 /// each renderer or application target may derive its own renderer-specific
63 /// shader object types from this base, if needed.
64 ///
65 /// Objects of this class generally represent a single shading object, whether
66 /// it exists in the target renderer or not. For example, a texture, a fractal,
67 /// or a mix node.
68 ///
69 /// The main property of this class is the info:id token, which uniquely
70 /// identifies the type of this node. The id resolution into a renderable
71 /// shader target is deferred to the consuming application.
72 ///
73 /// The purpose of representing them in Usd is two-fold:
74 /// \li To represent, via "connections" the topology of the shading network
75 /// that must be reconstructed in the renderer. Facilities for authoring and
76 /// manipulating connections are encapsulated in the Has-A schema
77 /// UsdShadeConnectableAPI.
78 /// \li To present a (partial or full) interface of typed input parameters
79 /// whose values can be set and overridden in Usd, to be provided later at
80 /// render-time as parameter values to the actual render shader objects. Shader
81 /// input parameters are encapsulated in the property schema UsdShadeInput.
82 ///
83 ///
84 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
85 /// that are text/tokens, the actual token is published and defined in \ref UsdShadeTokens.
86 /// So to set an attribute to the value "rightHanded", use UsdShadeTokens->rightHanded
87 /// as the value.
88 ///
89 class UsdShadeShader : public UsdTyped
90 {
91 public:
92  /// Compile time constant representing what kind of schema this class is.
93  ///
94  /// \sa UsdSchemaType
96 
97  /// Construct a UsdShadeShader on UsdPrim \p prim .
98  /// Equivalent to UsdShadeShader::Get(prim.GetStage(), prim.GetPath())
99  /// for a \em valid \p prim, but will not immediately throw an error for
100  /// an invalid \p prim
101  explicit UsdShadeShader(const UsdPrim& prim=UsdPrim())
102  : UsdTyped(prim)
103  {
104  }
105 
106  /// Construct a UsdShadeShader on the prim held by \p schemaObj .
107  /// Should be preferred over UsdShadeShader(schemaObj.GetPrim()),
108  /// as it preserves SchemaBase state.
109  explicit UsdShadeShader(const UsdSchemaBase& schemaObj)
110  : UsdTyped(schemaObj)
111  {
112  }
113 
114  /// Destructor.
116  virtual ~UsdShadeShader();
117 
118  /// Return a vector of names of all pre-declared attributes for this schema
119  /// class and all its ancestor classes. Does not include attributes that
120  /// may be authored by custom/extended methods of the schemas involved.
122  static const TfTokenVector &
123  GetSchemaAttributeNames(bool includeInherited=true);
124 
125  /// Return a UsdShadeShader holding the prim adhering to this
126  /// schema at \p path on \p stage. If no prim exists at \p path on
127  /// \p stage, or if the prim at that path does not adhere to this schema,
128  /// return an invalid schema object. This is shorthand for the following:
129  ///
130  /// \code
131  /// UsdShadeShader(stage->GetPrimAtPath(path));
132  /// \endcode
133  ///
135  static UsdShadeShader
136  Get(const UsdStagePtr &stage, const SdfPath &path);
137 
138  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
139  /// is defined (according to UsdPrim::IsDefined()) on this stage.
140  ///
141  /// If a prim adhering to this schema at \p path is already defined on this
142  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
143  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
144  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
145  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
146  /// current EditTarget for any nonexistent, or existing but not \a Defined
147  /// ancestors.
148  ///
149  /// The given \a path must be an absolute prim path that does not contain
150  /// any variant selections.
151  ///
152  /// If it is impossible to author any of the necessary PrimSpecs, (for
153  /// example, in case \a path cannot map to the current UsdEditTarget's
154  /// namespace) issue an error and return an invalid \a UsdPrim.
155  ///
156  /// Note that this method may return a defined prim whose typeName does not
157  /// specify this schema class, in case a stronger typeName opinion overrides
158  /// the opinion at the current EditTarget.
159  ///
161  static UsdShadeShader
162  Define(const UsdStagePtr &stage, const SdfPath &path);
163 
164 protected:
165  /// Returns the type of schema this class belongs to.
166  ///
167  /// \sa UsdSchemaType
169  UsdSchemaType _GetSchemaType() const override;
170 
171 private:
172  // needs to invoke _GetStaticTfType.
173  friend class UsdSchemaRegistry;
175  static const TfType &_GetStaticTfType();
176 
177  static bool _IsTypedSchema();
178 
179  // override SchemaBase virtuals.
181  const TfType &_GetTfType() const override;
182 
183 public:
184  // --------------------------------------------------------------------- //
185  // IMPLEMENTATIONSOURCE
186  // --------------------------------------------------------------------- //
187  /// Specifies the attribute that should be consulted to get the
188  /// shader's implementation or its source code.
189  ///
190  /// * If set to "id", the "info:id" attribute's value is used to
191  /// determine the shader source from the shader registry.
192  /// * If set to "sourceAsset", the resolved value of the "info:sourceAsset"
193  /// attribute corresponding to the desired implementation (or source-type)
194  /// is used to locate the shader source. A source asset file may also
195  /// specify multiple shader definitions, so there is an optional attribute
196  /// "info:sourceAsset:subIdentifier" whose value should be used to indicate
197  /// a particular shader definition from a source asset file.
198  /// * If set to "sourceCode", the value of "info:sourceCode" attribute
199  /// corresponding to the desired implementation (or source type) is used as
200  /// the shader source.
201  ///
202  ///
203  /// | ||
204  /// | -- | -- |
205  /// | Declaration | `uniform token info:implementationSource = "id"` |
206  /// | C++ Type | TfToken |
207  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
208  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
209  /// | \ref UsdShadeTokens "Allowed Values" | id, sourceAsset, sourceCode |
212 
213  /// See GetImplementationSourceAttr(), and also
214  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
215  /// If specified, author \p defaultValue as the attribute's default,
216  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
217  /// the default for \p writeSparsely is \c false.
219  UsdAttribute CreateImplementationSourceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
220 
221 public:
222  // --------------------------------------------------------------------- //
223  // ID
224  // --------------------------------------------------------------------- //
225  /// The id is an identifier for the type or purpose of the
226  /// shader. E.g.: Texture or FractalFloat.
227  /// The use of this id will depend on the render target: some will turn it
228  /// into an actual shader path, some will use it to generate shader source
229  /// code dynamically.
230  ///
231  /// \sa SetShaderId()
232  ///
233  ///
234  /// | ||
235  /// | -- | -- |
236  /// | Declaration | `uniform token info:id` |
237  /// | C++ Type | TfToken |
238  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
239  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
241  UsdAttribute GetIdAttr() const;
242 
243  /// See GetIdAttr(), and also
244  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
245  /// If specified, author \p defaultValue as the attribute's default,
246  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
247  /// the default for \p writeSparsely is \c false.
249  UsdAttribute CreateIdAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
250 
251 public:
252  // ===================================================================== //
253  // Feel free to add custom code below this line, it will be preserved by
254  // the code generator.
255  //
256  // Just remember to:
257  // - Close the class declaration with };
258  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
259  // - Close the include guard with #endif
260  // ===================================================================== //
261  // --(BEGIN CUSTOM CODE)--
262 
263  /// Constructor that takes a ConnectableAPI object.
264  /// Allow implicit (auto) conversion of UsdShadeShader to
265  /// UsdShadeConnectableAPI, so that a shader can be passed into any function
266  /// that accepts a ConnectableAPI.
268  UsdShadeShader(const UsdShadeConnectableAPI &connectable);
269 
270  /// Contructs and returns a UsdShadeConnectableAPI object with this shader.
271  ///
272  /// Note that most tasks can be accomplished without explicitly constructing
273  /// a UsdShadeConnectable API, since connection-related API such as
274  /// UsdShadeConnectableAPI::ConnectToSource() are static methods, and
275  /// UsdShadeShader will auto-convert to a UsdShadeConnectableAPI when
276  /// passed to functions that want to act generically on a connectable
277  /// UsdShadeConnectableAPI object.
280 
281  // -------------------------------------------------------------------------
282  /// \name Outputs API
283  ///
284  /// Outputs represent a typed attribute on a shader or node-graph whose value
285  /// is computed externally.
286  ///
287  /// When they exist on a node-graph, they are connectable and are typically
288  /// connected to the output of a shader within the node-graph.
289  ///
290  /// @{
291 
292  /// Create an output which can either have a value or can be connected.
293  /// The attribute representing the output is created in the "outputs:"
294  /// namespace. Outputs on a shader cannot be connected, as their
295  /// value is assumed to be computed externally.
296  ///
299  const SdfValueTypeName& typeName);
300 
301  /// Return the requested output if it exists.
302  ///
304  UsdShadeOutput GetOutput(const TfToken &name) const;
305 
306  /// Outputs are represented by attributes in the "outputs:" namespace.
307  ///
309  std::vector<UsdShadeOutput> GetOutputs() const;
310 
311  /// @}
312 
313  // -------------------------------------------------------------------------
314 
315  /// \name Inputs API
316  ///
317  /// Inputs are connectable attribute with a typed value.
318  ///
319  /// On shaders, the shader parameters are encoded as inputs. On node-graphs,
320  /// interface attributes are represented as inputs.
321  ///
322  /// @{
323 
324  /// Create an input which can either have a value or can be connected.
325  /// The attribute representing the input is created in the "inputs:"
326  /// namespace. Inputs on both shaders and node-graphs are connectable.
327  ///
330  const SdfValueTypeName& typeName);
331 
332  /// Return the requested input if it exists.
333  ///
335  UsdShadeInput GetInput(const TfToken &name) const;
336 
337  /// Inputs are represented by attributes in the "inputs:" namespace.
338  ///
340  std::vector<UsdShadeInput> GetInputs() const;
341 
342  /// @}
343 
344  // -------------------------------------------------------------------------
345 
346  /// \anchor UsdShadeShader_ImplementationSource
347  /// \name Shader Source API
348  ///
349  /// This section provides API for identifying the source of a shader's
350  /// implementation.
351  ///
352  /// @{
353 
354  /// Reads the value of info:implementationSource attribute and returns a
355  /// token identifying the attribute that must be consulted to identify the
356  /// shader's source program.
357  ///
358  /// This returns
359  /// * <b>id</b>, to indicate that the "info:id" attribute must be
360  /// consulted.
361  /// * <b>sourceAsset</b> to indicate that the asset-valued
362  /// "info:{sourceType}:sourceAsset" attribute associated with the desired
363  /// <b>sourceType</b> should be consulted to locate the asset with the
364  /// shader's source.
365  /// * <b>sourceCode</b> to indicate that the string-valued
366  /// "info:{sourceType}:sourceCode" attribute associated with the desired
367  /// <b>sourceType</b> should be read to get shader's source.
368  ///
369  /// This issues a warning and returns <b>id</b> if the
370  /// <i>info:implementationSource</i> attribute has an invalid value.
371  ///
372  /// <i>{sourceType}</i> above is a place holder for a token that identifies
373  /// the type of shader source or its implementation. For example: osl,
374  /// glslfx, riCpp etc. This allows a shader to specify different sourceAsset
375  /// (or sourceCode) values for different sourceTypes. The sourceType tokens
376  /// usually correspond to the sourceType value of the NdrParserPlugin that's
377  /// used to parse the shader source (\ref NdrParserPlugin::SourceType).
378  ///
379  /// When sourceType is empty, the corresponding sourceAsset or sourceCode is
380  /// considered to be "universal" (or fallback), which is represented by the
381  /// empty-valued token UsdShadeTokens->universalSourceType. When the
382  /// sourceAsset (or sourceCode) corresponding to a specific, requested
383  /// sourceType is unavailable, the universal sourceAsset (or sourceCode) is
384  /// returned by GetSourceAsset (and GetSourceCode} API, if present.
385  ///
386  /// \sa GetShaderId()
387  /// \sa GetSourceAsset()
388  /// \sa GetSourceCode()
391 
392  /// Sets the shader's ID value. This also sets the
393  /// <i>info:implementationSource</i> attribute on the shader to
394  /// <b>UsdShadeTokens->id</b>, if the existing value is different.
396  bool SetShaderId(const TfToken &id) const;
397 
398  /// Fetches the shader's ID value from the <i>info:id</i> attribute, if the
399  /// shader's <i>info:implementationSource</i> is <b>id</b>.
400  ///
401  /// Returns <b>true</b> if the shader's implementation source is <b>id</b>
402  /// and the value was fetched properly into \p id. Returns false otherwise.
403  ///
404  /// \sa GetImplementationSource()
406  bool GetShaderId(TfToken *id) const;
407 
408  /// Sets the shader's source-asset path value to \p sourceAsset for the
409  /// given source type, \p sourceType.
410  ///
411  /// This also sets the <i>info:implementationSource</i> attribute on the
412  /// shader to <b>UsdShadeTokens->sourceAsset</b>.
414  bool SetSourceAsset(
415  const SdfAssetPath &sourceAsset,
416  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
417 
418  /// Fetches the shader's source asset value for the specified
419  /// \p sourceType value from the <b>info:<i>sourceType:</i>sourceAsset</b>
420  /// attribute, if the shader's <i>info:implementationSource</i> is
421  /// <b>sourceAsset</b>.
422  ///
423  /// If the <i>sourceAsset</i> attribute corresponding to the requested
424  /// <i>sourceType</i> isn't present on the shader, then the <i>universal</i>
425  /// <i>fallback</i> sourceAsset attribute, i.e. <i>info:sourceAsset</i> is
426  /// consulted, if present, to get the source asset path.
427  ///
428  /// Returns <b>true</b> if the shader's implementation source is
429  /// <b>sourceAsset</b> and the source asset path value was fetched
430  /// successfully into \p sourceAsset. Returns false otherwise.
431  ///
432  /// \sa GetImplementationSource()
434  bool GetSourceAsset(
435  SdfAssetPath *sourceAsset,
436  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
437 
438  /// Set a sub-identifier to be used with a source asset of the given source
439  /// type. This sets the <b>info:<i>sourceType:</i>sourceAsset:subIdentifier
440  /// </b>.
441  ///
442  /// This also sets the <i>info:implementationSource</i> attribute on the
443  /// shader to <b>UsdShadeTokens->sourceAsset</b>
446  const TfToken &subIdentifier,
447  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
448 
449  /// Fetches the shader's sub-identifier for the source asset with the
450  /// specified \p sourceType value from the <b>info:<i>sourceType:</i>
451  /// sourceAsset:subIdentifier</b> attribute, if the shader's <i>info:
452  /// implementationSource</i> is <b>sourceAsset</b>.
453  ///
454  /// If the <i>subIdentifier</i> attribute corresponding to the requested
455  /// <i>sourceType</i> isn't present on the shader, then the <i>universal</i>
456  /// <i>fallback</i> sub-identifier attribute, i.e. <i>info:sourceAsset:
457  /// subIdentifier</i> is consulted, if present, to get the sub-identifier
458  /// name.
459  ///
460  /// Returns <b>true</b> if the shader's implementation source is
461  /// <b>sourceAsset</b> and the sub-identifier for the given source type was
462  /// fetched successfully into \p subIdentifier. Returns false otherwise.
465  TfToken *subIdentifier,
466  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
467 
468  /// Sets the shader's source-code value to \p sourceCode for the given
469  /// source type, \p sourceType.
470  ///
471  /// This also sets the <i>info:implementationSource</i> attribute on the
472  /// shader to <b>UsdShadeTokens->sourceCode</b>.
473  USDSHADE_API
474  bool SetSourceCode(
475  const std::string &sourceCode,
476  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
477 
478  /// Fetches the shader's source code for the specified \p sourceType value
479  /// by reading the <b>info:<i>sourceType:</i>sourceCode</b> attribute, if
480  /// the shader's <i>info:implementationSource</i> is <b>sourceCode</b>.
481  ///
482  /// If the <i>sourceCode</i> attribute corresponding to the
483  /// requested <i>sourceType</i> isn't present on the shader, then the
484  /// <i>universal</i> or <i>fallback</i> sourceCode attribute (i.e.
485  /// <i>info:sourceCode</i>) is consulted, if present, to get the source
486  /// code.
487  ///
488  /// Returns <b>true</b> if the shader's implementation source is
489  /// <b>sourceCode</b> and the source code string was fetched successfully
490  /// into \p sourceCode. Returns false otherwise.
491  ///
492  /// \sa GetImplementationSource()
494  bool GetSourceCode(
495  std::string *sourceCode,
496  const TfToken &sourceType=UsdShadeTokens->universalSourceType) const;
497 
498  /// @}
499 
500  // -------------------------------------------------------------------------
501 
502  /// \anchor UsdShadeShader_SdrMetadata_API
503  /// \name Shader Sdr Metadata API
504  ///
505  /// This section provides API for authoring and querying shader registry
506  /// metadata. When the shader's implementationSource is <b>sourceAsset</b>
507  /// or <b>sourceCode</b>, the authored "sdrMetadata" dictionary value
508  /// provides additional metadata needed to process the shader source
509  /// correctly. It is used in combination with the sourceAsset or sourceCode
510  /// value to fetch the appropriate node from the shader registry.
511  ///
512  /// We expect the keys in sdrMetadata to correspond to the keys
513  /// in \ref SdrNodeMetadata. However, this is not strictly enforced in the
514  /// API. The only allowed value type in the "sdrMetadata" dictionary is a
515  /// std::string since it needs to be converted into a NdrTokenMap, which Sdr
516  /// will parse using the utilities available in \ref SdrMetadataHelpers.
517  ///
518  /// @{
519 
520  /// Returns this shader's composed "sdrMetadata" dictionary as a
521  /// NdrTokenMap.
523  NdrTokenMap GetSdrMetadata() const;
524 
525  /// Returns the value corresponding to \p key in the composed
526  /// <b>sdrMetadata</b> dictionary.
528  std::string GetSdrMetadataByKey(const TfToken &key) const;
529 
530  /// Authors the given \p sdrMetadata on this shader at the current
531  /// EditTarget.
533  void SetSdrMetadata(const NdrTokenMap &sdrMetadata) const;
534 
535  /// Sets the value corresponding to \p key to the given string \p value, in
536  /// the shader's "sdrMetadata" dictionary at the current EditTarget.
538  void SetSdrMetadataByKey(
539  const TfToken &key,
540  const std::string &value) const;
541 
542  /// Returns true if the shader has a non-empty composed "sdrMetadata"
543  /// dictionary value.
545  bool HasSdrMetadata() const;
546 
547  /// Returns true if there is a value corresponding to the given \p key in
548  /// the composed "sdrMetadata" dictionary.
550  bool HasSdrMetadataByKey(const TfToken &key) const;
551 
552  /// Clears any "sdrMetadata" value authored on the shader in the current
553  /// EditTarget.
555  void ClearSdrMetadata() const;
556 
557  /// Clears the entry corresponding to the given \p key in the
558  /// "sdrMetadata" dictionary authored in the current EditTarget.
560  void ClearSdrMetadataByKey(const TfToken &key) const;
561 
562  /// @}
563 
564  /// This method attempts to ensure that there is a ShaderNode in the shader
565  /// registry (i.e. \ref SdrRegistry) representing this shader for the
566  /// given \p sourceType. It may return a null pointer if none could be
567  /// found or created.
570  const;
571 
572 };
573 
575 
576 #endif
#define USDSHADE_API
Definition: api.h:40
static USDSHADE_API UsdShadeShader Get(const UsdStagePtr &stage, const SdfPath &path)
GLuint const GLchar * name
Definition: glew.h:1814
USDSHADE_API std::vector< UsdShadeOutput > GetOutputs() const
USDSHADE_API SdrShaderNodeConstPtr GetShaderNodeForSourceType(const TfToken &sourceType) const
USDSHADE_API TfStaticData< UsdShadeTokensType > UsdShadeTokens
static USDSHADE_API UsdShadeShader Define(const UsdStagePtr &stage, const SdfPath &path)
USDSHADE_API bool HasSdrMetadataByKey(const TfToken &key) const
USDSHADE_API TfToken GetImplementationSource() const
USDSHADE_API void ClearSdrMetadataByKey(const TfToken &key) const
SdrShaderNode const * SdrShaderNodeConstPtr
Definition: declare.h:44
Represents a concrete typed schema.
virtual USDSHADE_API ~UsdShadeShader()
Destructor.
USDSHADE_API NdrTokenMap GetSdrMetadata() const
USDSHADE_API UsdShadeOutput GetOutput(const TfToken &name) const
USDSHADE_API void ClearSdrMetadata() const
USDSHADE_API bool SetShaderId(const TfToken &id) const
USDSHADE_API bool GetSourceAsset(SdfAssetPath *sourceAsset, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
USDSHADE_API UsdShadeOutput CreateOutput(const TfToken &name, const SdfValueTypeName &typeName)
Definition: token.h:87
static USDSHADE_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDSHADE_API UsdAttribute GetIdAttr() const
USDSHADE_API bool GetShaderId(TfToken *id) const
USDSHADE_API bool SetSourceAsset(const SdfAssetPath &sourceAsset, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
USDSHADE_API UsdAttribute GetImplementationSourceAttr() const
UsdSchemaType
Definition: common.h:127
USDSHADE_API UsdAttribute CreateImplementationSourceAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:132
Definition: typed.h:47
USDSHADE_API std::string GetSdrMetadataByKey(const TfToken &key) const
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
Definition: path.h:288
USDSHADE_API void SetSdrMetadata(const NdrTokenMap &sdrMetadata) const
USDSHADE_API bool GetSourceAssetSubIdentifier(TfToken *subIdentifier, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
USDSHADE_API std::vector< UsdShadeInput > GetInputs() const
USDSHADE_API bool GetSourceCode(std::string *sourceCode, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
GLsizei const GLchar *const * path
Definition: glew.h:6461
USDSHADE_API UsdAttribute CreateIdAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
GLsizei const GLchar *const * string
Definition: glew.h:1844
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
USDSHADE_API void SetSdrMetadataByKey(const TfToken &key, const std::string &value) const
USDSHADE_API bool SetSourceCode(const std::string &sourceCode, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
UsdShadeShader(const UsdSchemaBase &schemaObj)
Definition: shader.h:109
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
USDSHADE_API UsdShadeInput CreateInput(const TfToken &name, const SdfValueTypeName &typeName)
std::unordered_map< TfToken, std::string, TfToken::HashFunctor > NdrTokenMap
Definition: declare.h:61
UsdShadeShader(const UsdPrim &prim=UsdPrim())
Definition: shader.h:101
USDSHADE_API bool SetSourceAssetSubIdentifier(const TfToken &subIdentifier, const TfToken &sourceType=UsdShadeTokens->universalSourceType) const
USDSHADE_API bool HasSdrMetadata() const
GLsizei const GLfloat * value
Definition: glew.h:1849
USDSHADE_API UsdShadeConnectableAPI ConnectableAPI() const
Definition: value.h:174
USDSHADE_API UsdShadeInput GetInput(const TfToken &name) const
USDSHADE_API UsdSchemaType _GetSchemaType() const override
static const UsdSchemaType schemaType
Definition: shader.h:95