Loading...
Searching...
No Matches
SdrShaderNode Class Reference

A specialized version of NdrNode which holds shading information. More...

#include <shaderNode.h>

+ Inheritance diagram for SdrShaderNode:

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())
 Constructor.
 
Inputs and Outputs

An input or output is also generically referred to as a "property".

SDR_API SdrShaderPropertyConstPtr GetShaderInput (const TfToken &inputName) const
 Get a shader input property by name.
 
SDR_API SdrShaderPropertyConstPtr GetShaderOutput (const TfToken &outputName) const
 Get a shader output property by name.
 
SDR_API NdrTokenVec GetAssetIdentifierInputNames () const
 Returns the list of all inputs that are tagged as asset identifier inputs.
 
SDR_API SdrShaderPropertyConstPtr GetDefaultInput () const
 Returns the first shader input that is tagged as the default input.
 
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 TfTokenGetLabel () const
 The label assigned to this node, if any.
 
SDR_API const TfTokenGetCategory () const
 The category assigned to this node, if any.
 
SDR_API std::string GetRole () const
 Returns the role of this node.
 
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 const NdrTokenVec & GetPages () const
 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).
 
SDR_API const NdrTokenVec & GetPrimvars () const
 The list of primvars this node knows it requires / uses.
 
SDR_API const NdrTokenVec & GetAdditionalPrimvarProperties () const
 The list of string input properties whose values provide the names of additional primvars consumed by this node.
 
SDR_API std::string GetImplementationName () const
 Returns the implementation name of this node.
 
Aggregate Information
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 NdrTokenVec GetAllVstructNames () const
 Gets all vstructs that are present in the shader.
 
- Public Member Functions inherited from NdrNode
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.
 
virtual NDR_API ~NdrNode ()
 Destructor.
 
const NdrIdentifierGetIdentifier () const
 Return the identifier of the node.
 
NdrVersion GetVersion () const
 Return the version of the node.
 
const std::string & GetName () const
 Gets the name of the node.
 
const TfTokenGetFamily () const
 Gets the name of the family that the node belongs to.
 
const TfTokenGetContext () const
 Gets the context of the node.
 
const TfTokenGetSourceType () const
 Gets the type of source that this node originated from.
 
const std::string & GetResolvedDefinitionURI () const
 Gets the URI to the resource that provided this node's definition.
 
const std::string & GetResolvedImplementationURI () const
 Gets the URI to the resource that provides this node's implementation.
 
const std::string & GetSourceCode () const
 Returns the source code for this node.
 
virtual NDR_API bool IsValid () const
 Whether or not this node is valid.
 
virtual NDR_API std::string GetInfoString () const
 Gets a string with basic information about this node.
 
NDR_API const NdrTokenVec & GetInputNames () const
 Get an ordered list of all the input names on this node.
 
NDR_API const NdrTokenVec & GetOutputNames () const
 Get an ordered list of all the output names on this node.
 
NDR_API NdrPropertyConstPtr GetInput (const TfToken &inputName) const
 Get an input property by name.
 
NDR_API NdrPropertyConstPtr GetOutput (const TfToken &outputName) const
 Get an output property by name.
 
NDR_API const NdrTokenMap & GetMetadata () const
 All metadata that came from the parse process.
 

Protected Attributes

NdrTokenVec _primvars
 
NdrTokenVec _primvarNamingProperties
 
TfToken _label
 
TfToken _category
 
NdrTokenVec _departments
 
NdrTokenVec _pages
 
SdrPropertyMap _shaderInputs
 
SdrPropertyMap _shaderOutputs
 
- Protected Attributes inherited from NdrNode
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

- Protected Member Functions inherited from NdrNode
NdrNodeoperator= (const NdrNode &)=delete
 

Detailed Description

A specialized version of NdrNode which holds shading information.

Definition at line 84 of file shaderNode.h.

Constructor & Destructor Documentation

◆ SdrShaderNode()

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.

Member Function Documentation

◆ GetAdditionalPrimvarProperties()

SDR_API const NdrTokenVec & GetAdditionalPrimvarProperties ( ) const
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 189 of file shaderNode.h.

◆ GetAllVstructNames()

SDR_API NdrTokenVec GetAllVstructNames ( ) const

Gets all vstructs that are present in the shader.

◆ GetAssetIdentifierInputNames()

SDR_API NdrTokenVec GetAssetIdentifierInputNames ( ) const

Returns the list of all inputs that are tagged as asset identifier inputs.

◆ GetCategory()

SDR_API const TfToken & GetCategory ( ) const
inline

The category assigned to this node, if any.

Distinct from the family returned from GetFamily().

Definition at line 146 of file shaderNode.h.

◆ GetDefaultInput()

SDR_API SdrShaderPropertyConstPtr 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.

◆ GetDepartments()

SDR_API const NdrTokenVec & GetDepartments ( ) const
inline

The departments this node is associated with, if any.

Definition at line 163 of file shaderNode.h.

◆ GetHelp()

SDR_API std::string GetHelp ( ) const

The help message assigned to this node, if any.

◆ GetImplementationName()

SDR_API std::string 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.

◆ GetLabel()

SDR_API const TfToken & GetLabel ( ) const
inline

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 141 of file shaderNode.h.

◆ GetPages()

SDR_API const NdrTokenVec & GetPages ( ) const
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 171 of file shaderNode.h.

◆ GetPrimvars()

SDR_API const NdrTokenVec & GetPrimvars ( ) const
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 180 of file shaderNode.h.

◆ GetPropertyNamesForPage()

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()).

To get properties that are not assigned to a page, an empty string can be used for pageName.

◆ GetRole()

SDR_API std::string 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.

◆ GetShaderInput()

SDR_API SdrShaderPropertyConstPtr 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.

◆ GetShaderOutput()

SDR_API SdrShaderPropertyConstPtr 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.

Member Data Documentation

◆ _category

TfToken _category
protected

Definition at line 242 of file shaderNode.h.

◆ _departments

NdrTokenVec _departments
protected

Definition at line 243 of file shaderNode.h.

◆ _label

TfToken _label
protected

Definition at line 241 of file shaderNode.h.

◆ _pages

NdrTokenVec _pages
protected

Definition at line 244 of file shaderNode.h.

◆ _primvarNamingProperties

NdrTokenVec _primvarNamingProperties
protected

Definition at line 238 of file shaderNode.h.

◆ _primvars

NdrTokenVec _primvars
protected

Definition at line 237 of file shaderNode.h.

◆ _shaderInputs

SdrPropertyMap _shaderInputs
protected

Definition at line 246 of file shaderNode.h.

◆ _shaderOutputs

SdrPropertyMap _shaderOutputs
protected

Definition at line 247 of file shaderNode.h.


The documentation for this class was generated from the following file: