8#ifndef PXR_USD_SDR_SHADER_NODE_H
9#define PXR_USD_SDR_SHADER_NODE_H
14#include "pxr/usd/sdr/api.h"
17#include "pxr/base/vt/value.h"
19#include "pxr/usd/sdr/shaderNodeMetadata.h"
22#include <unordered_map>
24PXR_NAMESPACE_OPEN_SCOPE
26#define SDR_NODE_FIELD_KEY_TOKENS \
27 ((Identifier, "_identifier")) \
29 ((Family, "_family")) \
30 ((SourceType, "_sourceType"))
55 const std::string& name,
59 const std::string& definitionURI,
60 const std::string& implementationURI,
61 SdrShaderPropertyUniquePtrVec&& properties,
63 const std::string &sourceCode = std::string());
79 const std::string&
GetName()
const {
return _name; }
126 return _implementationURI;
260 const SdrTokenVec&
GetPages()
const {
return _pages; }
291 return _primvarNamingProperties;
324 using ComplianceResults = std::unordered_map<
TfToken,
325 std::vector<SdrIdentifier>,
341 const std::vector<SdrShaderNodeConstPtr> &shaderNodes);
349 void _PostProcessProperties();
385 std::string _definitionURI;
386 std::string _implementationURI;
387 SdrShaderPropertyUniquePtrVec _properties;
388 SdrTokenMap _legacyMetadata;
390 std::string _sourceCode;
392 SdrShaderPropertyMap _inputs;
393 SdrTokenVec _inputNames;
394 SdrShaderPropertyMap _outputs;
395 SdrTokenVec _outputNames;
401 SdrTokenVec _departments;
402 SdrTokenVec _openPages;
403 SdrTokenMap _pagesShownIf;
409 SdrTokenVec _primvars;
410 SdrTokenVec _primvarNamingProperties;
417 void _InitializePrimvars();
420 SdrTokenVec _ComputePages()
const;
423PXR_NAMESPACE_CLOSE_SCOPE
Represents a node that holds shading information.
SDR_API const SdrTokenMap & GetMetadata() const
All metadata that came from the parse process.
SDR_API const SdrTokenVec & GetPrimvars() const
The list of primvars this node knows it requires / uses.
virtual SDR_API ~SdrShaderNode()
Destructor.
SDR_API SdrTokenVec GetAssetIdentifierInputNames() const
Returns the list of all inputs that are tagged as asset identifier inputs.
SDR_API const SdrTokenVec & GetAdditionalPrimvarProperties() const
The list of string input properties whose values provide the names of additional primvars consumed by...
const SdrIdentifier & GetIdentifier() const
Return the identifier of the node.
SDR_API const TfToken & GetLabel() const
The label assigned to this node, if any.
SDR_API SdrShaderPropertyConstPtr GetShaderInput(const TfToken &inputName) const
Get a shader input property by name.
const TfToken & GetFamily() const
Gets the name of the family that the node belongs to.
static SDR_API ComplianceResults CheckPropertyCompliance(const std::vector< SdrShaderNodeConstPtr > &shaderNodes)
This method checks if same named properties of shaderNodes are compatible with each other.
SDR_API SdrTokenVec GetAllVstructNames() const
Gets all vstructs that are present in the shader.
SDR_API const TfToken & GetCategory() const
The category assigned to this node, if any.
const std::string & GetName() const
Gets the name of the node.
SDR_API SdrTokenVec GetPropertyNamesForPage(const std::string &pageName) const
Gets the names of the properties on a certain page (one that was returned by GetPages()).
SDR_API TfToken GetRole() const
Returns the role of this node.
SDR_API SdrShaderNode(const SdrIdentifier &identifier, const SdrVersion &version, const std::string &name, const TfToken &family, const TfToken &context, const TfToken &sourceType, const std::string &definitionURI, const std::string &implementationURI, SdrShaderPropertyUniquePtrVec &&properties, const SdrShaderNodeMetadata &metadata=SdrShaderNodeMetadata(), const std::string &sourceCode=std::string())
Constructor.
SDR_API SdrShaderPropertyConstPtr GetShaderOutput(const TfToken &outputName) const
Get a shader output property by name.
SDR_API VtValue GetDataForKey(const TfToken &key) const
Gets an item of data from this shader node according to the requested key.
SDR_API std::string GetHelp() const
The help message assigned to this node, if any.
SDR_API const SdrTokenVec & GetPages() const
Gets the pages on which the node's properties reside (an aggregate of the unique SdrShaderProperty::G...
const TfToken & GetContext() const
Gets the context of the shader node.
SDR_API const SdrTokenVec & GetDepartments() const
The departments this node is associated with, if any.
SDR_API std::string GetImplementationName() const
Returns the implementation name of this node.
const std::string & GetResolvedImplementationURI() const
Gets the URI to the resource that provides this node's implementation.
SDR_API const SdrTokenVec & GetShaderInputNames() const
Get an ordered list of all the input names on this shader node.
SdrVersion GetShaderVersion() const
Return the version of the node.
SDR_API const SdrShaderNodeMetadata & GetMetadataObject() const
All metadata that came from the parse process.
SDR_API const SdrTokenMap & GetPagesShownIf() const
Gets the shownIf expressions associated with each page.
SDR_API const SdrTokenVec & GetOpenPages() const
Gets the pages which should be opened or expanded by default.
const std::string & GetSourceCode() const
Returns the source code for this node.
SDR_API SdrShaderPropertyConstPtr GetDefaultInput() const
Returns the first shader input that is tagged as the default input.
const TfToken & GetSourceType() const
Gets the type of source that this shader node originated from.
SDR_API bool IsValid() const
Whether or not this node is valid.
SDR_API const SdrTokenVec & GetShaderOutputNames() const
Get an ordered list of all the output names on this shader node.
SDR_API std::string GetInfoString() const
Gets a string with basic information about this node.
const std::string & GetResolvedDefinitionURI() const
Gets the URI to the resource that provided this node's definition.
Token for efficient comparison, assignment, and hashing of known strings.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Functor to use for hash maps from tokens to other things.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...