MaterialX 1.38.9
Loading...
Searching...
No Matches
Input Class Reference

An input element within a Node or NodeDef. More...

#include <Interface.h>

Inheritance diagram for Input:
PortElement ValueElement TypedElement Element

Public Member Functions

 Input (ElementPtr parent, const string &name)
 
Default Geometric Property
void setDefaultGeomPropString (const string &geomprop)
 Set the defaultgeomprop string for the input.
 
bool hasDefaultGeomPropString () const
 Return true if the given input has a defaultgeomprop string.
 
const string & getDefaultGeomPropString () const
 Return the defaultgeomprop string for the input.
 
GeomPropDefPtr getDefaultGeomProp () const
 Return the GeomPropDef element to use, if defined for this input.
 
Connections
NodePtr getConnectedNode () const override
 Return the node, if any, to which this input is connected. More...
 
InputPtr getInterfaceInput () const
 Return the input on the parent graph corresponding to the interface name for this input.
 
Validation
bool validate (string *message=nullptr) const override
 Validate that the given element tree, including all descendants, is consistent with the MaterialX specification. More...
 
- Public Member Functions inherited from PortElement
void setNodeName (const string &node)
 Set the node name string of this element, creating a connection to the Node with the given name within the same NodeGraph.
 
bool hasNodeName () const
 Return true if this element has a node name string.
 
const string & getNodeName () const
 Return the node name string of this element.
 
void setNodeGraphString (const string &node)
 Set the node graph string of this element.
 
bool hasNodeGraphString () const
 Return true if this element has a node graph string.
 
const string & getNodeGraphString () const
 Return the node graph string of this element.
 
void setOutputString (const string &output)
 Set the output string of this element.
 
bool hasOutputString () const
 Return true if this element has an output string.
 
void setConnectedOutput (ConstOutputPtr output)
 Set the output to which this input is connected. More...
 
virtual OutputPtr getConnectedOutput () const
 Return the output, if any, to which this input is connected.
 
const string & getOutputString () const
 Return the output string of this element.
 
void setConnectedNode (ConstNodePtr node)
 Set the node to which this element is connected. More...
 
void setChannels (const string &channels)
 Set the channels string of this element, defining a channel swizzle that will be applied to the upstream result if this port is connected.
 
bool hasChannels () const
 Return true if this element has a channels string.
 
const string & getChannels () const
 Return the channels string of this element.
 
- Public Member Functions inherited from ValueElement
void setValueString (const string &value)
 Set the value string of an element.
 
bool hasValueString () const
 Return true if the given element has a value string.
 
const string & getValueString () const
 Get the value string of a element.
 
string getResolvedValueString (StringResolverPtr resolver=nullptr) const
 Return the resolved value string of an element, applying any string substitutions that are defined at the element's scope. More...
 
void setInterfaceName (const string &name)
 Set the interface name of an element.
 
bool hasInterfaceName () const
 Return true if the given element has an interface name.
 
const string & getInterfaceName () const
 Return the interface name of an element.
 
void setImplementationName (const string &name)
 Set the implementation name of an element.
 
bool hasImplementationName () const
 Return true if the given element has an implementation name.
 
const string & getImplementationName () const
 Return the implementation name of an element.
 
template<class T >
void setValue (const T &value, const string &type=EMPTY_STRING)
 Set the typed value of an element.
 
void setValue (const char *value, const string &type=EMPTY_STRING)
 Set the typed value of an element from a C-style string.
 
bool hasValue () const
 Return true if the element possesses a typed value.
 
ValuePtr getValue () const
 Return the typed value of an element as a generic value object, which may be queried to access its data. More...
 
ValuePtr getResolvedValue (StringResolverPtr resolver=nullptr) const
 Return the resolved value of an element as a generic value object, which may be queried to access its data. More...
 
ValuePtr getDefaultValue () const
 Return the default value for this element as a generic value object, which may be queried to access its data. More...
 
void setUnit (const string &unit)
 Set the unit string of an element.
 
bool hasUnit () const
 Return true if the given element has a unit string.
 
const string & getUnit () const
 Return the unit string of an element.
 
const string & getActiveUnit () const
 Return the unit defined by the assocaited NodeDef if this element is a child of a Node.
 
void setUnitType (const string &unit)
 Set the unit type of an element.
 
bool hasUnitType () const
 Return true if the given element has a unit type.
 
const string & getUnitType () const
 Return the unit type of an element.
 
void setIsUniform (bool value)
 Set the uniform attribute flag on this element.
 
bool getIsUniform () const
 The the uniform attribute flag for this element.
 
- Public Member Functions inherited from TypedElement
void setType (const string &type)
 Set the element's type string.
 
bool hasType () const
 Return true if the given element has a type string.
 
virtual const string & getType () const
 Return the element's type string. More...
 
bool isColorType () const
 Return true if the element is of color type.
 
bool isMultiOutputType () const
 Return true if the element is of multi-output type.
 
TypeDefPtr getTypeDef () const
 Return the TypeDef declaring the type string of this element. More...
 
- Public Member Functions inherited from Element
 Element (const Element &)=delete
 
Elementoperator= (const Element &)=delete
 
bool operator== (const Element &rhs) const
 Return true if the given element tree, including all descendants, is identical to this one.
 
bool operator!= (const Element &rhs) const
 Return true if the given element tree, including all descendants, differs from this one.
 
void setCategory (const string &category)
 Set the element's category string.
 
const string & getCategory () const
 Return the element's category string. More...
 
void setName (const string &name)
 Set the element's name string. More...
 
const string & getName () const
 Return the element's name string.
 
string getNamePath (ConstElementPtr relativeTo=nullptr) const
 Return the element's hierarchical name path, relative to the root document. More...
 
ElementPtr getDescendant (const string &namePath) const
 Return the element specified by the given hierarchical name path, relative to the current element. More...
 
void setFilePrefix (const string &prefix)
 Set the element's file prefix string.
 
bool hasFilePrefix () const
 Return true if the given element has a file prefix string.
 
const string & getFilePrefix () const
 Return the element's file prefix string.
 
const string & getActiveFilePrefix () const
 Return the file prefix string that is active at the scope of this element, taking all ancestor elements into account.
 
void setGeomPrefix (const string &prefix)
 Set the element's geom prefix string.
 
bool hasGeomPrefix () const
 Return true if the given element has a geom prefix string.
 
const string & getGeomPrefix () const
 Return the element's geom prefix string.
 
const string & getActiveGeomPrefix () const
 Return the geom prefix string that is active at the scope of this element, taking all ancestor elements into account.
 
void setColorSpace (const string &colorSpace)
 Set the element's color space string.
 
bool hasColorSpace () const
 Return true if the given element has a color space string.
 
const string & getColorSpace () const
 Return the element's color space string.
 
const string & getActiveColorSpace () const
 Return the color space string that is active at the scope of this element, taking all ancestor elements into account.
 
void setInheritString (const string &inherit)
 Set the inherit string of this element.
 
bool hasInheritString () const
 Return true if this element has an inherit string.
 
const string & getInheritString () const
 Return the inherit string of this element.
 
void setInheritsFrom (ConstElementPtr super)
 Set the element that this one directly inherits from.
 
ElementPtr getInheritsFrom () const
 Return the element, if any, that this one directly inherits from.
 
bool hasInheritedBase (ConstElementPtr base) const
 Return true if this element has the given element as an inherited base, taking the full inheritance chain into account.
 
bool hasInheritanceCycle () const
 Return true if the inheritance chain for this element contains a cycle.
 
void setNamespace (const string &space)
 Set the namespace string of this element.
 
bool hasNamespace () const
 Return true if this element has a namespace string.
 
const string & getNamespace () const
 Return the namespace string of this element.
 
string getQualifiedName (const string &name) const
 Return a qualified version of the given name, taking the namespace at the scope of this element into account.
 
void setDocString (const string &doc)
 Set the documentation string of this element.
 
string getDocString () const
 Return the documentation string of this element.
 
template<class T >
bool isA (const string &category=EMPTY_STRING) const
 Return true if this element belongs to the given subclass. More...
 
template<class T >
shared_ptr< T > asA ()
 Dynamic cast to an instance of the given subclass.
 
template<class T >
shared_ptr< const T > asA () const
 Dynamic cast to a const instance of the given subclass.
 
template<class T >
shared_ptr< T > addChild (const string &name=EMPTY_STRING)
 Add a child element of the given subclass and name. More...
 
ElementPtr addChildOfCategory (const string &category, string name=EMPTY_STRING)
 Add a child element of the given category and name. More...
 
ElementPtr changeChildCategory (ElementPtr child, const string &category)
 Change the category of the given child element. More...
 
ElementPtr getChild (const string &name) const
 Return the child element, if any, with the given name.
 
template<class T >
shared_ptr< T > getChildOfType (const string &name) const
 Return the child element, if any, with the given name and subclass. More...
 
const vector< ElementPtr > & getChildren () const
 Return a constant vector of all child elements. More...
 
template<class T >
vector< shared_ptr< T > > getChildrenOfType (const string &category=EMPTY_STRING) const
 Return a vector of all child elements that are instances of the given subclass, optionally filtered by the given category string. More...
 
void setChildIndex (const string &name, int index)
 Set the index of the child, if any, with the given name. More...
 
int getChildIndex (const string &name) const
 Return the index of the child, if any, with the given name. More...
 
void removeChild (const string &name)
 Remove the child element, if any, with the given name.
 
template<class T >
void removeChildOfType (const string &name)
 Remove the child element, if any, with the given name and subclass. More...
 
void setAttribute (const string &attrib, const string &value)
 Set the value string of the given attribute.
 
bool hasAttribute (const string &attrib) const
 Return true if the given attribute is present.
 
const string & getAttribute (const string &attrib) const
 Return the value string of the given attribute. More...
 
const StringVecgetAttributeNames () const
 Return a vector of stored attribute names, in the order they were set.
 
template<class T >
void setTypedAttribute (const string &attrib, const T &data)
 Set the value of an implicitly typed attribute. More...
 
template<class T >
getTypedAttribute (const string &attrib) const
 Return the value of an implicitly typed attribute. More...
 
void removeAttribute (const string &attrib)
 Remove the given attribute, if present.
 
ElementPtr getSelf ()
 Return our self pointer.
 
ConstElementPtr getSelf () const
 Return our self pointer.
 
ElementPtr getParent ()
 Return our parent element.
 
ConstElementPtr getParent () const
 Return our parent element.
 
ElementPtr getRoot ()
 Return the root element of our tree.
 
ConstElementPtr getRoot () const
 Return the root element of our tree.
 
DocumentPtr getDocument ()
 Return the root document of our tree.
 
ConstDocumentPtr getDocument () const
 Return the root document of our tree.
 
template<class T >
shared_ptr< const T > getAncestorOfType () const
 Return the first ancestor of the given subclass, or an empty shared pointer if no ancestor of this subclass is found.
 
TreeIterator traverseTree () const
 Traverse the tree from the given element to each of its descendants in depth-first order, using pre-order visitation. More...
 
GraphIterator traverseGraph () const
 Traverse the dataflow graph from the given element to each of its upstream sources in depth-first order, using pre-order visitation. More...
 
virtual Edge getUpstreamEdge (size_t index=0) const
 Return the Edge with the given index that lies directly upstream from this element in the dataflow graph. More...
 
virtual size_t getUpstreamEdgeCount () const
 Return the number of queriable upstream edges for this element. More...
 
ElementPtr getUpstreamElement (size_t index=0) const
 Return the Element with the given index that lies directly upstream from this one in the dataflow graph. More...
 
InheritanceIterator traverseInheritance () const
 Traverse the inheritance chain from the given element to each element from which it inherits. More...
 
void setSourceUri (const string &sourceUri)
 Set the element's source URI. More...
 
bool hasSourceUri () const
 Return true if this element has a source URI.
 
const string & getSourceUri () const
 Return the element's source URI.
 
const string & getActiveSourceUri () const
 Return the source URI that is active at the scope of this element, taking all ancestor elements into account.
 
void copyContentFrom (const ConstElementPtr &source)
 Copy all attributes and descendants from the given element to this one. More...
 
virtual void clearContent ()
 Clear all attributes and descendants from this element. More...
 
string createValidChildName (string name) const
 Using the input name as a starting point, modify it to create a valid, unique name for a child element.
 
StringResolverPtr createStringResolver (const string &geom=EMPTY_STRING) const
 Construct a StringResolver at the scope of this element. More...
 
string asString () const
 Return a single-line description of this element, including its category, name, and attributes.
 

Static Public Attributes

static const string CATEGORY
 
static const string DEFAULT_GEOM_PROP_ATTRIBUTE = "defaultgeomprop"
 
- Static Public Attributes inherited from PortElement
static const string NODE_NAME_ATTRIBUTE = "nodename"
 
static const string NODE_GRAPH_ATTRIBUTE = "nodegraph"
 
static const string OUTPUT_ATTRIBUTE = "output"
 
static const string CHANNELS_ATTRIBUTE = "channels"
 
- Static Public Attributes inherited from ValueElement
static const string VALUE_ATTRIBUTE = "value"
 
static const string INTERFACE_NAME_ATTRIBUTE = "interfacename"
 
static const string IMPLEMENTATION_NAME_ATTRIBUTE = "implname"
 
static const string IMPLEMENTATION_TYPE_ATTRIBUTE = "impltype"
 
static const string ENUM_ATTRIBUTE = "enum"
 
static const string ENUM_VALUES_ATTRIBUTE = "enumvalues"
 
static const string UI_NAME_ATTRIBUTE = "uiname"
 
static const string UI_FOLDER_ATTRIBUTE = "uifolder"
 
static const string UI_MIN_ATTRIBUTE = "uimin"
 
static const string UI_MAX_ATTRIBUTE = "uimax"
 
static const string UI_SOFT_MIN_ATTRIBUTE = "uisoftmin"
 
static const string UI_SOFT_MAX_ATTRIBUTE = "uisoftmax"
 
static const string UI_STEP_ATTRIBUTE = "uistep"
 
static const string UI_ADVANCED_ATTRIBUTE = "uiadvanced"
 
static const string UNIT_ATTRIBUTE = "unit"
 
static const string UNITTYPE_ATTRIBUTE = "unittype"
 
static const string UNIFORM_ATTRIBUTE = "uniform"
 
- Static Public Attributes inherited from TypedElement
static const string TYPE_ATTRIBUTE = "type"
 
- Static Public Attributes inherited from Element
static const string NAME_ATTRIBUTE = "name"
 
static const string FILE_PREFIX_ATTRIBUTE = "fileprefix"
 
static const string GEOM_PREFIX_ATTRIBUTE = "geomprefix"
 
static const string COLOR_SPACE_ATTRIBUTE = "colorspace"
 
static const string INHERIT_ATTRIBUTE = "inherit"
 
static const string NAMESPACE_ATTRIBUTE = "namespace"
 
static const string DOC_ATTRIBUTE = "doc"
 

Additional Inherited Members

- Static Public Member Functions inherited from PortElement
static bool validChannelsCharacters (const string &channels, const string &sourceType)
 Return true if the given channels characters are valid for the given source type string.
 
static bool validChannelsString (const string &channels, const string &sourceType, const string &destinationType)
 Return true if the given channels string is valid for the given source and destination type strings.
 
- Protected Types inherited from PortElement
using NodePtr = shared_ptr< Node >
 
using ConstNodePtr = shared_ptr< const Node >
 
- Protected Types inherited from TypedElement
using TypeDefPtr = shared_ptr< class TypeDef >
 
- Protected Types inherited from Element
using DocumentPtr = shared_ptr< Document >
 
using ConstDocumentPtr = shared_ptr< const Document >
 
- Protected Member Functions inherited from PortElement
 PortElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from ValueElement
 ValueElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from TypedElement
 TypedElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from Element
 Element (ElementPtr parent, const string &category, const string &name)
 
template<class T >
shared_ptr< T > resolveNameReference (const string &name, ConstElementPtr parent=nullptr) const
 
void validateRequire (bool expression, bool &res, string *message, const string &errorDesc) const
 
virtual void registerChildElement (ElementPtr child)
 
virtual void unregisterChildElement (ElementPtr child)
 
ElementPtr getSelfNonConst () const
 
- Protected Attributes inherited from Element
string _category
 
string _name
 
string _sourceUri
 
ElementMap _childMap
 
vector< ElementPtr_childOrder
 
StringMap _attributeMap
 
StringVec _attributeOrder
 
weak_ptr< Element_parent
 
weak_ptr< Element_root
 

Detailed Description

An input element within a Node or NodeDef.

An Input holds either a uniform value or a connection to a spatially-varying Output, either of which may be modified within the scope of a Material.

Member Function Documentation

◆ getConnectedNode()

NodePtr getConnectedNode ( ) const
overridevirtual

Return the node, if any, to which this input is connected.

Reimplemented from PortElement.

◆ validate()

bool validate ( string *  message = nullptr) const
overridevirtual

Validate that the given element tree, including all descendants, is consistent with the MaterialX specification.

Reimplemented from PortElement.


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