HDK
|
#include <shaderNode.h>
Public Types | |
using | ComplianceResults = std::unordered_map< TfToken, std::vector< SdrIdentifier >, TfToken::HashFunctor > |
Public Member Functions | |
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()) |
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 SdrTokenMap &metadata=SdrTokenMap(), const std::string &sourceCode=std::string()) |
Constructor. More... | |
SdrVersion | GetShaderVersion () const |
Return the version of the node. More... | |
Inputs and Outputs | |
An input or output is also generically referred to as a "property". | |
SDR_API const SdrTokenVec & | GetShaderInputNames () const |
Get an ordered list of all the input names on this shader node. More... | |
SDR_API const SdrTokenVec & | GetShaderOutputNames () const |
Get an ordered list of all the output names on this shader node. More... | |
SDR_API SdrShaderPropertyConstPtr | GetShaderInput (const TfToken &inputName) const |
SDR_API SdrShaderPropertyConstPtr | GetShaderOutput (const TfToken &outputName) const |
SDR_API SdrTokenVec | GetAssetIdentifierInputNames () const |
SDR_API SdrShaderPropertyConstPtr | GetDefaultInput () const |
Metadata | |
The metadata returned here is a direct result of what the parser plugin is able to determine about the node. See the documentation for a specific parser plugin to get help on what the parser is looking for to populate these values. | |
SDR_API const TfToken & | GetLabel () const |
SDR_API const TfToken & | GetCategory () const |
SDR_API std::string | GetRole () const |
SDR_API std::string | GetHelp () const |
The help message assigned to this node, if any. More... | |
SDR_API const SdrTokenVec & | GetDepartments () const |
The departments this node is associated with, if any. More... | |
SDR_API const SdrTokenVec & | GetPages () const |
SDR_API const SdrTokenVec & | GetPrimvars () const |
SDR_API const SdrTokenVec & | GetAdditionalPrimvarProperties () const |
SDR_API std::string | GetImplementationName () const |
Aggregate Information | |
SDR_API SdrTokenVec | GetPropertyNamesForPage (const std::string &pageName) const |
SDR_API SdrTokenVec | GetAllVstructNames () const |
Gets all vstructs that are present in the shader. More... | |
![]() | |
NDR_API | NdrNode (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. More... | |
virtual NDR_API | ~NdrNode () |
Destructor. More... | |
const NdrIdentifier & | GetIdentifier () const |
Return the identifier of the node. More... | |
NdrVersion | GetVersion () const |
const std::string & | GetName () const |
Gets the name of the node. More... | |
const TfToken & | GetFamily () const |
const TfToken & | GetContext () const |
const TfToken & | GetSourceType () const |
const std::string & | GetResolvedDefinitionURI () const |
const std::string & | GetResolvedImplementationURI () const |
const std::string & | GetSourceCode () const |
virtual NDR_API bool | IsValid () const |
virtual NDR_API std::string | GetInfoString () const |
NDR_API const NdrTokenVec & | GetInputNames () const |
NDR_API const NdrTokenVec & | GetOutputNames () const |
NDR_API NdrPropertyConstPtr | GetInput (const TfToken &inputName) const |
NDR_API NdrPropertyConstPtr | GetOutput (const TfToken &outputName) const |
NDR_API const NdrTokenMap & | GetMetadata () const |
Static Public Member Functions | |
static SDR_API ComplianceResults | CheckPropertyCompliance (const std::vector< SdrShaderNodeConstPtr > &shaderNodes) |
Protected Attributes | |
SdrTokenVec | _primvars |
SdrTokenVec | _primvarNamingProperties |
TfToken | _label |
TfToken | _category |
SdrTokenVec | _departments |
SdrTokenVec | _pages |
SdrPropertyMap | _shaderInputs |
SdrPropertyMap | _shaderOutputs |
![]() | |
bool | _isValid |
NdrIdentifier | _identifier |
NdrVersion | _version |
std::string | _name |
TfToken | _family |
TfToken | _context |
TfToken | _sourceType |
std::string | _definitionURI |
std::string | _implementationURI |
NdrPropertyUniquePtrVec | _properties |
NdrTokenMap | _metadata |
std::string | _sourceCode |
NdrPropertyPtrMap | _inputs |
NdrTokenVec | _inputNames |
NdrPropertyPtrMap | _outputs |
NdrTokenVec | _outputNames |
Additional Inherited Members | |
![]() | |
NdrNode & | operator= (const NdrNode &)=delete |
Represents a node that holds shading information. Describes information like the name of the node, what its inputs and outputs are, and any associated metadata.
Definition at line 77 of file shaderNode.h.
using SdrShaderNode::ComplianceResults = std::unordered_map<TfToken, std::vector<SdrIdentifier>, TfToken::HashFunctor> |
Definition at line 249 of file shaderNode.h.
SDR_API SdrShaderNode::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.
SdrVersion
and SdrShaderPropertyUniquePtrVec
instead of Ndr analogues SDR_API SdrShaderNode::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 SdrTokenMap & | metadata = SdrTokenMap() , |
||
const std::string & | sourceCode = std::string() |
||
) |
Constructor.
|
static |
This method checks if same named properties of shaderNodes
are compatible with each other.
Checks if the same name properties have matching types and default values. In order to determine if same name properties from different shader nodes are compliant, we assume that the first shaderNode in the list providing this property is authoritative, and other nodes differing wrt this property are non-compliant. A map of property names and their respective shaderNodes are stored in the map. An empty map returned represents no compliance issues.
|
inline |
The list of string input properties whose values provide the names of additional primvars consumed by this node. For example, this may return a token named varname
. This indicates that the client should query the value of a (presumed to be string-valued) input attribute named varname from its scene description to determine the name of a primvar the node will consume. See GetPrimvars()
for additional information.
Definition at line 213 of file shaderNode.h.
SDR_API SdrTokenVec SdrShaderNode::GetAllVstructNames | ( | ) | const |
Gets all vstructs that are present in the shader.
SDR_API SdrTokenVec SdrShaderNode::GetAssetIdentifierInputNames | ( | ) | const |
Returns the list of all inputs that are tagged as asset identifier inputs.
The category assigned to this node, if any. Distinct from the family returned from GetFamily()
.
Definition at line 170 of file shaderNode.h.
SDR_API SdrShaderPropertyConstPtr SdrShaderNode::GetDefaultInput | ( | ) | const |
Returns the first shader input that is tagged as the default input. A default input and its value can be used to acquire a fallback value for a node when the node is considered 'disabled' or otherwise incapable of producing an output value.
|
inline |
The departments this node is associated with, if any.
Definition at line 187 of file shaderNode.h.
SDR_API std::string SdrShaderNode::GetHelp | ( | ) | const |
The help message assigned to this node, if any.
SDR_API std::string SdrShaderNode::GetImplementationName | ( | ) | const |
Returns the implementation name of this node. The name of the node is how to refer to the node in shader networks. The label is how to present this node to users. The implementation name is the name of the function (or something) this node represents in the implementation. Any client using the implementation must call this method to get the correct name; using getName()
is not correct.
The label assigned to this node, if any. Distinct from the name returned from GetName()
. In the context of a UI, the label value might be used as the display name for the node instead of the name.
Definition at line 165 of file shaderNode.h.
|
inline |
Gets the pages on which the node's properties reside (an aggregate of the unique SdrShaderProperty::GetPage()
values for all of the node's properties). Nodes themselves do not reside on pages. In an example scenario, properties might be divided into two pages, 'Simple' and 'Advanced'.
Definition at line 195 of file shaderNode.h.
|
inline |
The list of primvars this node knows it requires / uses. For example, a shader node may require the 'normals' primvar to function correctly. Additional, user specified primvars may have been authored on the node. These can be queried via GetAdditionalPrimvarProperties()
. Together, GetPrimvars()
and GetAdditionalPrimvarProperties()
, provide the complete list of primvar requirements for the node.
Definition at line 204 of file shaderNode.h.
SDR_API SdrTokenVec SdrShaderNode::GetPropertyNamesForPage | ( | const std::string & | pageName | ) | const |
Gets the names of the properties on a certain page (one that was returned by GetPages()
). To get properties that are not assigned to a page, an empty string can be used for pageName
.
SDR_API std::string SdrShaderNode::GetRole | ( | ) | const |
Returns the role of this node. This is used to annotate the role that the shader node plays inside a shader network. We can tag certain shaders to indicate their role within a shading network. We currently tag primvar reading nodes, texture reading nodes and nodes that access volume fields (like extinction or scattering). This is done to identify resources used by a shading network.
SDR_API SdrShaderPropertyConstPtr SdrShaderNode::GetShaderInput | ( | const TfToken & | inputName | ) | const |
Get a shader input property by name. nullptr
is returned if an input with the given name does not exist.
SDR_API const SdrTokenVec& SdrShaderNode::GetShaderInputNames | ( | ) | const |
Get an ordered list of all the input names on this shader node.
SDR_API SdrShaderPropertyConstPtr SdrShaderNode::GetShaderOutput | ( | const TfToken & | outputName | ) | const |
Get a shader output property by name. nullptr
is returned if an output with the given name does not exist.
SDR_API const SdrTokenVec& SdrShaderNode::GetShaderOutputNames | ( | ) | const |
Get an ordered list of all the output names on this shader node.
|
inline |
Return the version of the node.
Definition at line 115 of file shaderNode.h.
|
protected |
Definition at line 286 of file shaderNode.h.
|
protected |
Definition at line 287 of file shaderNode.h.
|
protected |
Definition at line 285 of file shaderNode.h.
|
protected |
Definition at line 288 of file shaderNode.h.
|
protected |
Definition at line 282 of file shaderNode.h.
|
protected |
Definition at line 281 of file shaderNode.h.
|
protected |
Definition at line 290 of file shaderNode.h.
|
protected |
Definition at line 291 of file shaderNode.h.