6 #ifndef MATERIALX_NODE_H
7 #define MATERIALX_NODE_H
68 void setNameGlobal(
const string&
name);
77 void setConnectedNode(
const string& inputName,
ConstNodePtr node);
81 NodePtr getConnectedNode(
const string& inputName)
const;
85 void setConnectedNodeName(
const string& inputName,
const string& nodeName);
89 string getConnectedNodeName(
const string& inputName)
const;
105 bool allowRoughMatch =
false)
const;
147 vector<PortElementPtr> getDownstreamPorts()
const;
157 return getNodeDef(
target);
162 InputPtr addInputFromNodeDef(
const string& inputName);
165 void addInputsFromNodeDef();
209 node->setCategory(category);
217 NodePtr node = addNode(nodeDef->getNodeString(),
name, nodeDef->getType());
218 node->setNodeDefString(nodeDef->getName());
225 return getChildOfType<Node>(
name);
232 return getChildrenOfType<Node>(category);
238 vector<NodePtr> nodes;
239 for (
auto node : getNodes())
241 if (node->getType() == nodeType)
243 nodes.push_back(node);
252 removeChildOfType<Node>(
name);
276 return addChild<Backdrop>(
name);
282 return getChildOfType<Backdrop>(
name);
288 return getChildrenOfType<Backdrop>();
294 removeChildOfType<Backdrop>(
name);
324 string asStringDot()
const;
347 void setNameGlobal(
const string&
name);
354 vector<OutputPtr> getMaterialOutputs()
const;
377 vector<PortElementPtr> getDownstreamPorts()
const;
391 InputPtr addInterfaceName(
const string& inputPath,
const string& interfaceName);
395 void removeInterfaceName(
const string& inputPath);
400 void modifyInterfaceName(
const string& inputPath,
const string& interfaceName);
422 Element(parent, CATEGORY, name)
455 setTypedAttribute<float>(WIDTH_ATTRIBUTE,
width);
467 return getTypedAttribute<float>(WIDTH_ATTRIBUTE);
477 setTypedAttribute<float>(HEIGHT_ATTRIBUTE,
height);
489 return getTypedAttribute<float>(HEIGHT_ATTRIBUTE);
497 void setContainsElements(
const vector<ConstTypedElementPtr>& nodes);
500 vector<TypedElementPtr> getContainsElements()
const;
bool hasContainsString() const
Return true if this backdrop has a contains string.
BackdropPtr addBackdrop(const string &name=EMPTY_STRING)
Add a Backdrop to the graph.
GLuint GLsizei const GLchar * message
shared_ptr< Output > OutputPtr
A shared pointer to an Output.
NodeGraph(ElementPtr parent, const string &name)
shared_ptr< NodeDef > NodeDefPtr
#define MATERIALX_NAMESPACE_BEGIN
shared_ptr< const InterfaceElement > ConstInterfaceElementPtr
A shared pointer to a const InterfaceElement.
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
static const string HEIGHT_ATTRIBUTE
shared_ptr< const Node > ConstNodePtr
A shared pointer to a const Node.
void removeNode(const string &name)
Remove the Node, if any, with the given name.
shared_ptr< const Backdrop > ConstBackdropPtr
A shared pointer to a const Backdrop.
const string & getAttribute(const string &attrib) const
static const string CATEGORY
static const string CATEGORY
shared_ptr< InterfaceElement > InterfaceElementPtr
A shared pointer to an InterfaceElement.
shared_ptr< const GeomPropDef > ConstGeomPropDefPtr
A shared pointer to a const GeomPropDef.
size_t getInputCount() const
Return the number of Input elements.
GraphElement(ElementPtr parent, const string &category, const string &name)
NodePtr getNode(const string &name) const
Return the Node, if any, with the given name.
virtual Edge getUpstreamEdge(size_t index=0) const
vector< ElementPtr > ElementVec
A vector of elements.
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum GLenum type
Backdrop(ElementPtr parent, const string &name)
size_t getUpstreamEdgeCount() const override
Return the number of queryable upstream edges for this element.
virtual bool validate(string *message=nullptr) const
Node(ElementPtr parent, const string &name)
vector< NodePtr > getNodes(const string &category=EMPTY_STRING) const
vector< BackdropPtr > getBackdrops() const
Return a vector of all Backdrop elements in the graph.
bool hasHeight() const
Return true if this backdrop has a height attribute.
static const string CATEGORY
NodePtr addNode(const string &category, const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
GLuint const GLchar * name
shared_ptr< const NodeGraph > ConstNodeGraphPtr
A shared pointer to a const NodeGraph.
shared_ptr< Input > InputPtr
A shared pointer to an Input.
MX_CORE_API const string MATERIAL_TYPE_STRING
shared_ptr< const GraphElement > ConstGraphElementPtr
A shared pointer to a const GraphElement.
shared_ptr< Backdrop > BackdropPtr
A shared pointer to a Backdrop.
static const string CONTAINS_ATTRIBUTE
bool hasWidth() const
Return true if this backdrop has a width attribute.
ConstInterfaceElementPtr getDeclaration(const string &target=EMPTY_STRING) const override
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
std::function< bool(NodePtr node)> NodePredicate
shared_ptr< const NodeDef > ConstNodeDefPtr
BackdropPtr getBackdrop(const string &name) const
Return the Backdrop, if any, with the given name.
void removeBackdrop(const string &name)
Remove the Backdrop, if any, with the given name.
bool hasAttribute(const string &attrib) const
Return true if the given attribute is present.
shared_ptr< GraphElement > GraphElementPtr
A shared pointer to a GraphElement.
virtual ConstInterfaceElementPtr getDeclaration(const string &target=EMPTY_STRING) const
float getWidth() const
Return the width attribute of the backdrop.
string getContainsString() const
Return the contains string for this backdrop.
void setWidth(float width)
Set the width attribute of the backdrop.
void setContainsString(const string &contains)
Set the contains string for this backdrop.
void setHeight(float height)
Set the height attribute of the backdrop.
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
#define MATERIALX_NAMESPACE_END
shared_ptr< const NodeDef > ConstNodeDefPtr
A shared pointer to a const NodeDef.
vector< NodePtr > getMaterialNodes() const
Return a vector of all material nodes.
NodePtr addNodeInstance(ConstNodeDefPtr nodeDef, const string &name=EMPTY_STRING)
Add a Node that is an instance of the given NodeDef.
bool OIIO_UTIL_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
shared_ptr< NodeGraph > NodeGraphPtr
A shared pointer to a NodeGraph.
vector< NodePtr > getNodesOfType(const string &nodeType) const
Return a vector of nodes in the graph which have a given type.
InterfaceElementPtr getImplementation(const string &target=EMPTY_STRING) const
static const string WIDTH_ATTRIBUTE
float getHeight() const
Return the height attribute of the backdrop.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
shared_ptr< Node > NodePtr
A shared pointer to a Node.
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.