8#ifndef PXR_USD_SDR_SHADER_NODE_H
9#define PXR_USD_SDR_SHADER_NODE_H
14#include "pxr/usd/sdr/api.h"
19#include <unordered_map>
21PXR_NAMESPACE_OPEN_SCOPE
26#define SDR_NODE_METADATA_TOKENS \
27 ((Category, "category")) \
29 ((Departments, "departments")) \
33 ((Primvars, "primvars")) \
34 ((ImplementationName, "__SDR__implementationName"))\
35 ((Target, "__SDR__target")) \
36 ((SdrUsdEncodingVersion, "sdrUsdEncodingVersion")) \
37 ((SdrDefinitionNameFallbackPrefix, "sdrDefinitionNameFallbackPrefix"))
44#define SDR_NODE_CONTEXT_TOKENS \
45 ((Pattern, "pattern")) \
46 ((Surface, "surface")) \
47 ((Volume, "volume")) \
48 ((Displacement, "displacement")) \
50 ((DisplayFilter, "displayFilter")) \
51 ((LightFilter, "lightFilter")) \
52 ((PixelFilter, "pixelFilter")) \
53 ((SampleFilter, "sampleFilter"))
55#define SDR_NODE_ROLE_TOKENS \
56 ((Primvar, "primvar")) \
57 ((Texture, "texture")) \
75 const NdrVersion& version,
76 const std::string& name,
80 const std::string& definitionURI,
81 const std::string& implementationURI,
82 NdrPropertyUniquePtrVec&& properties,
83 const NdrTokenMap& metadata = NdrTokenMap(),
84 const std::string &sourceCode = std::string());
156 const NdrTokenVec&
GetPages()
const {
return _pages; };
175 return _primvarNamingProperties;
208 using ComplianceResults = std::unordered_map<
TfToken,
209 std::vector<NdrIdentifier>,
225 const std::vector<SdrShaderNodeConstPtr> &shaderNodes);
233 void _PostProcessProperties();
242 NdrTokenVec _primvars;
243 NdrTokenVec _primvarNamingProperties;
248 NdrTokenVec _departments;
251 SdrPropertyMap _shaderInputs;
252 SdrPropertyMap _shaderOutputs;
256 void _InitializePrimvars();
259 NdrTokenVec _ComputePages()
const;
262PXR_NAMESPACE_CLOSE_SCOPE
Represents an abstract node.
A specialized version of NdrNode which holds shading information.
SDR_API const NdrTokenVec & GetAdditionalPrimvarProperties() const
The list of string input properties whose values provide the names of additional primvars consumed by...
SDR_API const NdrTokenVec & GetPages() const
Gets the pages on which the node's properties reside (an aggregate of the unique SdrShaderProperty::G...
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.
SDR_API NdrTokenVec GetAssetIdentifierInputNames() const
Returns the list of all inputs that are tagged as asset identifier inputs.
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 const TfToken & GetCategory() const
The category assigned to this node, if any.
SDR_API NdrTokenVec 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 NdrIdentifier &identifier, const NdrVersion &version, const std::string &name, const TfToken &family, const TfToken &context, const TfToken &sourceType, const std::string &definitionURI, const std::string &implementationURI, NdrPropertyUniquePtrVec &&properties, const NdrTokenMap &metadata=NdrTokenMap(), const std::string &sourceCode=std::string())
Constructor.
SDR_API NdrTokenVec GetAllVstructNames() const
Gets all vstructs that are present in the shader.
SDR_API SdrShaderPropertyConstPtr GetShaderOutput(const TfToken &outputName) const
Get a shader output property by name.
SDR_API const NdrTokenVec & GetPrimvars() const
The list of primvars this node knows it requires / uses.
SDR_API std::string GetHelp() const
The help message assigned to this node, if any.
SDR_API const NdrTokenVec & GetDepartments() const
The departments this node is associated with, if any.
SDR_API std::string GetImplementationName() const
Returns the implementation name of this node.
SDR_API SdrShaderPropertyConstPtr GetDefaultInput() const
Returns the first shader input that is tagged as the default input.
SDR_API std::string GetRole() const
Returns the role of this node.
Token for efficient comparison, assignment, and hashing of known strings.
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.