6 #ifndef MATERIALX_INTERFACE_H
7 #define MATERIALX_INTERFACE_H
132 virtual OutputPtr getConnectedOutput()
const;
165 static bool validChannelsCharacters(
const string&
channels,
const string& sourceType);
169 static bool validChannelsString(
const string&
channels,
const string& sourceType,
const string& destinationType);
181 virtual NodePtr getConnectedNode()
const;
200 static const std::unordered_map<string, CharSet> CHANNELS_CHARACTER_SET;
201 static const std::unordered_map<string, size_t> CHANNELS_PATTERN_LENGTH;
295 bool hasUpstreamCycle()
const;
370 child->setType(
type);
377 return getChildOfType<Input>(
name);
383 return getChildrenOfType<Input>();
395 removeChildOfType<Input>(
name);
404 vector<InputPtr> getActiveInputs()
const;
420 output->setType(
type);
427 return getChildOfType<Output>(
name);
433 return getChildrenOfType<Output>();
445 removeChildOfType<Output>(
name);
454 vector<OutputPtr> getActiveOutputs()
const;
459 void setConnectedOutput(
const string& inputName,
OutputPtr output);
463 OutputPtr getConnectedOutput(
const string& inputName)
const;
476 return addChild<Token>(
name);
482 return getChildOfType<Token>(
name);
488 return getChildrenOfType<Token>();
494 removeChildOfType<Token>(
name);
503 vector<TokenPtr> getActiveTokens()
const;
512 return getChildOfType<ValueElement>(
name);
523 vector<ValueElementPtr> getActiveValueElements()
const;
531 template <
class T>
InputPtr setInputValue(
const string&
name,
551 token = addToken(name);
552 token->setValue<
string>(
value);
609 void setVersionIntegers(
int majorVersion,
int minorVersion);
621 setTypedAttribute<bool>(DEFAULT_VERSION_ATTRIBUTE, defaultVersion);
627 return getTypedAttribute<bool>(DEFAULT_VERSION_ATTRIBUTE);
677 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()
bool hasChannels() const
Return true if this element has a channels string.
vector< InputPtr > getInputs() const
Return a vector of all Input elements.
size_t getUpstreamEdgeCount() const override
Return the number of queriable 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.
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 setChannels(const string &channels)
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.
static const string CHANNELS_ATTRIBUTE
const string & getChannels() const
Return the channels string of this element.
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
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
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.