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 ((Function, "_function")) \
31 ((SourceType, "_sourceType"))
\
32 ((ShadingSystem, "_shadingSystem"))
66 const std::string& name,
69 const std::string& definitionURI,
70 const std::string& implementationURI,
71 SdrShaderPropertyUniquePtrVec&& properties,
73 const std::string &sourceCode = std::string()
83 std::move(properties),
96 const std::string& name,
100 const std::string& definitionURI,
101 const std::string& implementationURI,
102 SdrShaderPropertyUniquePtrVec&& properties,
104 const std::string &sourceCode = std::string());
121 const std::string&
GetName()
const {
return _name; }
166 return _implementationURI;
347 return _primvarNamingProperties;
372 const SdrTokenVec&
GetPages()
const {
return _pages; }
388 using ComplianceResults = std::unordered_map<
TfToken,
389 std::vector<SdrIdentifier>,
405 const std::vector<SdrShaderNodeConstPtr> &shaderNodes);
413 void _PostProcessProperties();
450 std::string _definitionURI;
451 std::string _implementationURI;
452 SdrShaderPropertyUniquePtrVec _properties;
453 SdrTokenMap _legacyMetadata;
455 std::string _sourceCode;
457 SdrShaderPropertyMap _inputs;
458 SdrTokenVec _inputNames;
459 SdrShaderPropertyMap _outputs;
460 SdrTokenVec _outputNames;
468 SdrTokenVec _departments;
469 SdrTokenVec _openPages;
470 SdrTokenMap _pagesShownIf;
476 SdrTokenVec _primvars;
477 SdrTokenVec _primvarNamingProperties;
484 void _InitializePrimvars();
487 SdrTokenVec _ComputePages()
const;
490PXR_NAMESPACE_CLOSE_SCOPE
Represents a node that holds shading information.
SDR_API const SdrTokenMap & GetMetadata() const
All metadata that came from the parse process.
const TfToken & GetFunction() const
Gets the function that the node belongs to.
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 SdrShaderNode(const SdrIdentifier &identifier, const SdrVersion &version, const std::string &name, const TfToken &function, const TfToken &shadingSystem, const std::string &definitionURI, const std::string &implementationURI, SdrShaderPropertyUniquePtrVec &&properties, const SdrShaderNodeMetadata &metadata=SdrShaderNodeMetadata(), const std::string &sourceCode=std::string())
Constructor.
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 SdrShaderNode(const SdrIdentifier &identifier, const SdrVersion &version, const std::string &name, const TfToken &function, const TfToken &context, const TfToken &shadingSystem, const std::string &definitionURI, const std::string &implementationURI, SdrShaderPropertyUniquePtrVec &&properties, const SdrShaderNodeMetadata &metadata=SdrShaderNodeMetadata(), const std::string &sourceCode=std::string())
SDR_API TfToken GetRole() const
Returns the role of this node.
const TfToken & GetDomain() const
Gets the domain of the node.
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 node.
const TfToken & GetShadingSystem() const
Gets the shading system that this shader node originated from.
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.
const TfToken & GetSubdomain() const
Gets the subdomain of the node if the subdomain metadata item exists.
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...