6 #ifndef MATERIALX_INTERFACE_H
7 #define MATERIALX_INTERFACE_H
150 virtual NodePtr getConnectedNode()
const;
216 void setConnectedInterfaceName(
const string& interfaceName);
289 bool hasUpstreamCycle()
const;
364 child->setType(
type);
371 return getChildOfType<Input>(
name);
377 return getChildrenOfType<Input>();
389 removeChildOfType<Input>(
name);
398 vector<InputPtr> getActiveInputs()
const;
414 output->setType(
type);
421 return getChildOfType<Output>(
name);
427 return getChildrenOfType<Output>();
439 removeChildOfType<Output>(
name);
448 vector<OutputPtr> getActiveOutputs()
const;
453 void setConnectedOutput(
const string& inputName,
OutputPtr output);
457 OutputPtr getConnectedOutput(
const string& inputName)
const;
470 return addChild<Token>(
name);
476 return getChildOfType<Token>(
name);
482 return getChildrenOfType<Token>();
488 removeChildOfType<Token>(
name);
497 vector<TokenPtr> getActiveTokens()
const;
506 return getChildOfType<ValueElement>(
name);
517 vector<ValueElementPtr> getActiveValueElements()
const;
525 template <
class T>
InputPtr setInputValue(
const string&
name,
545 token = addToken(name);
546 token->setValue<
string>(
value);
603 void setVersionIntegers(
int majorVersion,
int minorVersion);
615 setTypedAttribute<bool>(DEFAULT_VERSION_ATTRIBUTE, defaultVersion);
621 return getTypedAttribute<bool>(DEFAULT_VERSION_ATTRIBUTE);
671 input->setValue(value, type);
static const string NODE_DEF_ATTRIBUTE
GLuint GLsizei const GLchar * message
shared_ptr< Output > OutputPtr
A shared pointer to an Output.
InputPtr setInputValue(const string &name, const T &value, const string &type=EMPTY_STRING)
shared_ptr< NodeDef > NodeDefPtr
OutputPtr getOutput(const string &name) const
Return the Output, if any, with the given name.
virtual void clearContent()
Clear all attributes and descendants from this element.
shared_ptr< const PortElement > ConstPortElementPtr
A shared pointer to a const PortElement.
vector< OutputPtr > getOutputs() const
Return a vector of all Output elements.
static const string NODE_NAME_ATTRIBUTE
#define MATERIALX_NAMESPACE_BEGIN
bool hasVersionString() const
Return true if this interface has a version string.
shared_ptr< const InterfaceElement > ConstInterfaceElementPtr
A shared pointer to a const InterfaceElement.
GLsizei const GLfloat * value
const string & getNodeName() const
Return the node name string of this element.
shared_ptr< Node > NodePtr
string getTokenValue(const string &name)
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
bool getDefaultVersion() const
Return the default version flag of this element.
bool hasNodeGraphString() const
Return true if this element has a node graph string.
shared_ptr< const Node > ConstNodePtr
A shared pointer to a const Node.
bool hasNodeName() const
Return true if this element has a node name string.
const string & getAttribute(const string &attrib) const
MX_CORE_API std::tuple< int, int, int > getVersionIntegers()
vector< InputPtr > getInputs() const
Return a vector of all Input elements.
size_t getUpstreamEdgeCount() const override
Return the number of queryable upstream edges for this element.
shared_ptr< InterfaceElement > InterfaceElementPtr
A shared pointer to an InterfaceElement.
shared_ptr< Token > TokenPtr
A shared pointer to a Token.
TokenPtr addToken(const string &name=EMPTY_STRING)
size_t getInputCount() const
Return the number of Input elements.
void setNodeGraphString(const string &node)
Set the node graph string of this element.
virtual Edge getUpstreamEdge(size_t index=0) const
TokenPtr getToken(const string &name) const
Return the Token, if any, with the given name.
void setOutputString(const string &output)
Set the output string of this element.
const string & getNodeDefString() const
Return the NodeDef string for the interface.
Output(ElementPtr parent, const string &name)
void removeToken(const string &name)
Remove the Token, if any, with the given name.
GLint GLint GLsizei GLint GLenum GLenum type
static const string DEFAULT_INPUT_ATTRIBUTE
void setTarget(const string &target)
Set the target string of this interface.
size_t getOutputCount() const
Return the number of Output elements.
bool hasNodeDefString() const
Return true if the given interface has a NodeDef string.
shared_ptr< const Input > ConstInputPtr
A shared pointer to a const Input.
shared_ptr< const Output > ConstOutputPtr
A shared pointer to a const Output.
void removeOutput(const string &name)
Remove the Output, if any, with the given name.
InputPtr getInput(const string &name) const
Return the Input, if any, with the given name.
shared_ptr< PortElement > PortElementPtr
A shared pointer to a PortElement.
static const string NODE_GRAPH_ATTRIBUTE
const string & getOutputString() const
Return the output string of this element.
shared_ptr< GeomPropDef > GeomPropDefPtr
A shared pointer to a GeomPropDef.
bool validate(string *message=nullptr) const override
bool hasTarget() const
Return true if the given interface has a target string.
bool validate(string *message=nullptr) const override
InterfaceElement(ElementPtr parent, const string &category, const string &name)
GLuint const GLchar * name
void removeInput(const string &name)
Remove the Input, if any, with the given name.
const string & getNodeGraphString() const
Return the node graph string of this element.
OutputPtr addOutput(const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
void setDefaultVersion(bool defaultVersion)
Set the default version flag of this element.
ValueElementPtr getValueElement(const string &name) const
Return the ValueElement, if any, with the given name.
SYS_FORCE_INLINE UT_StringHolder getToken(Add enum_value)
shared_ptr< Input > InputPtr
A shared pointer to an Input.
virtual ~InterfaceElement()
GT_API const UT_StringHolder version
void setNodeDefString(const string &nodeDef)
Set the NodeDef string for the interface.
void setVersionString(const string &version)
Set the version string of this interface.
void setAttribute(const string &attrib, const string &value)
Set the value string of the given attribute.
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string DEFAULT_TYPE_STRING
shared_ptr< const Node > ConstNodePtr
TokenPtr setTokenValue(const string &name, const string &value)
static const string CATEGORY
shared_ptr< const NodeDef > ConstNodeDefPtr
bool hasAttribute(const string &attrib) const
Return true if the given attribute is present.
static const string DEFAULT_VERSION_ATTRIBUTE
PortElement(ElementPtr parent, const string &category, const string &name)
static const string VERSION_ATTRIBUTE
bool hasOutputString() const
Return true if this element has an output string.
virtual void unregisterChildElement(ElementPtr child)
static const string TARGET_ATTRIBUTE
virtual void registerChildElement(ElementPtr child)
virtual NodePtr getConnectedNode() const
Return the node, if any, to which this element is connected.
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
shared_ptr< ValueElement > ValueElementPtr
A shared pointer to a ValueElement.
#define MATERIALX_NAMESPACE_END
const string & getTarget() const
Return the target string of this interface.
vector< TokenPtr > getTokens() const
Return a vector of all Token elements.
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
InputPtr addInput(const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
static const string OUTPUT_ATTRIBUTE
void setNodeName(const string &node)
shared_ptr< Node > NodePtr
A shared pointer to a Node.
const string & getVersionString() const
Return the version string of this interface.