12 #ifndef __UN_UniGraph_h__
13 #define __UN_UniGraph_h__
38 { myGraphData = graph_data; }
47 bool isValid( UNI_NodeID node_id )
const override;
48 bool isValid( UNI_PortID port_id )
const override;
49 bool isValid( UNI_WireID wire_id )
const override;
50 bool isValid( UNI_StickyNoteID sticky_note_id )
const override;
53 UNI_NodeID
rootNode()
const override;
62 bool force_include_current )
const override;
65 UNI_NodeID
parentNode( UNI_NodeID node_id )
const override;
66 bool isSubnet( UNI_NodeID node_id )
const override;
67 bool isEditable( UNI_NodeID node_id )
const override;
69 UNI_NodeIDList
childNodes( UNI_NodeID node_id )
const override;
70 UNI_NodeID
findNode( UNI_NodeID from_id,
91 UNI_PortIDList
inputPorts( UNI_NodeID node_id )
const override;
93 int port_index )
const override;
95 UNI_PortID port_id )
const override;
98 UNI_PortIDList
outputPorts( UNI_NodeID node_id )
const override;
100 int port_index )
const override;
102 UNI_PortID port_id )
const override;
113 UNI_NodeID
ownerNode( UNI_PortID port_id )
const override;
117 UNI_PortID
outerPort( UNI_PortID port_id )
const override;
121 bool canSetName( UNI_PortID port_id )
const override;
128 UNI_WireIDList
childWires( UNI_NodeID node_id )
const override;
129 UNI_PortID
srcPort( UNI_WireID wire_id )
const override;
130 UNI_PortID
dstPort( UNI_WireID wire_id )
const override;
131 UNI_WireIDList
srcWires( UNI_PortID port_id )
const override;
132 UNI_WireIDList
dstWires( UNI_PortID port_id )
const override;
135 UNI_StickyNoteIDList
childStickyNotes( UNI_NodeID parent_id)
const override;
140 UNI_NodeID
ownerNode( UNI_StickyNoteID note_id )
const override;
143 float textSize( UNI_StickyNoteID note_id )
const override;
147 bool isCollapsed( UNI_StickyNoteID note_id )
const override;
150 const UNI_NodeIDList &node_ids,
151 const UNI_StickyNoteIDList ¬e_ids,
152 std::ostream &os)
const override;
163 const UNI_PortIDList &create_input_ports,
164 const UNI_PortIDList &create_output_ports)
override;
165 void setName( UNI_NodeID node_id,
170 bool update_node )
override;
172 bool update_port )
override;
179 void setTags( UNI_NodeID node_id,
184 void destroy( UNI_NodeID node_id )
override;
193 void setName( UNI_PortID port_id,
196 void destroy( UNI_WireID wire_id )
override;
200 void setName( UNI_StickyNoteID note_id,
204 void setSize( UNI_StickyNoteID note_id,
206 void setColor( UNI_StickyNoteID note_id,
208 void setText( UNI_StickyNoteID note_id,
213 const float size )
override;
215 bool collapsed )
override;
217 bool hidden )
override;
218 void destroy( UNI_StickyNoteID note_id )
override;
221 UNI_NodeIDList &node_ids,
222 UNI_StickyNoteIDList ¬e_ids,
249 {
return UN_Node( &unGraphData(),
id ); }
253 {
return UN_Port( &unGraphData(),
id ); }
256 const UN_PortType * unPortType( UNI_PortID
id )
const;
268 void updateDownstreamDirtyPortTypes(
269 const UN_WireIDList &originating_wires,
273 void updateNodeSignature( UN_NodeID node_id );
virtual UT_StringHolder text(UNI_StickyNoteID note_id) const =0
Returns the sticky note's contents.
virtual bool isValid(UNI_NodeID node_id) const =0
Returns true if the given ID refers to a valid item in this graph.
virtual UNI_PortID srcPort(UNI_WireID wire_id) const =0
virtual UNI_WireIDList srcWires(UNI_PortID port_id) const =0
Return the wires that connect to a given port.
virtual UNI_PortKind portKind(UNI_PortID port_id) const =0
Returns what kind of a port this is: input or output.
virtual void setComment(UNI_NodeID node_id, const UT_StringHolder &comment)=0
Set the user-authored comment for a node.
UN_ConstNode unNode(UNI_NodeID id) const
Convenience methods to get a UN items from an UNI ID.
virtual UNI_PortIDList subnetInputPorts(UNI_PortID port_id) const =0
virtual UT_StringArray tags(UNI_NodeID node_id) const =0
The list of tags associated with a node.
void setGraphData(UN_GraphData *graph_data)
virtual bool portAcceptsSubPorts(UNI_PortID port_id) const =0
Returns whether the port accepts subports.
virtual UT_Color textColor(UNI_StickyNoteID note_id) const =0
Returns the sticky note's text (foreground) color.
virtual UT_StringHolder colorName(UNI_PortID port_id) const =0
virtual void setContainerConnectPosition(UNI_NodeID parent_id, UNI_ContainerConnectType contype, const UT_Vector2D &pos)=0
GLsizei const GLfloat * value
GLsizei const GLchar *const * path
virtual bool parmOverriddenByConnection(UNI_NodeID node_id, const UT_StringRef &parm_name) const =0
virtual UNI_StickyNoteID createStickyNote(UNI_NodeID parent_id, const UT_StringHolder &name)=0
Create a new sticky note inside the provided node.
virtual bool isBackgroundHidden(UNI_StickyNoteID note_id) const =0
virtual UNI_WireIDList dstWires(UNI_PortID port_id) const =0
Return the wires that connect to a given port.
virtual bool isValidName(const UT_StringRef &name) const =0
Generic functions related to entity naming.
UN_ConstStickyNote unStickyNote(UNI_StickyNoteID id) const
Convenience methods to get a UN items from an UNI ID.
virtual UNI_NodeIDList childNodes(UNI_NodeID parent_id) const =0
Returns the children nodes that live inside the given parent node.
virtual UT_Vector2D size(UNI_StickyNoteID note_id) const =0
Returns the sticky note's size (width & height).
virtual UNI_StickyNoteID findStickyNote(UNI_NodeID from_id, const UT_StringRef &path) const =0
Find the sticky note at a path relative to a starting node.
const UN_GraphData & unGraphData() const
Returns the underlying UN graph.
UN_StickyNote unStickyNote(UNI_StickyNoteID id)
Convenience methods to get a UN items from an UNI ID.
virtual UNI_NodeID createNode(UNI_NodeID parent_id, const UT_StringHolder &node_name, const UT_StringHolder &node_type_name, const UT_StringHolder &signature_name=UT_StringHolder())=0
Create a new node inside the provided node.
virtual int numberOfOutputPorts(UNI_NodeID node_id) const =0
Output ports of a node.
virtual UT_Color color(UNI_NodeID node_id) const =0
The color tint of the node in the graph editor.
virtual bool hasDynamicPorts(UNI_NodeID node_id) const =0
virtual UNI_ParmValue parmValue(UNI_NodeID node_id, const UT_StringRef &parm_name) const =0
Get the value of a parm on this node.
virtual UNI_PortIDList inputPorts(UNI_NodeID node_id) const =0
Input ports of a node.
virtual void setSize(UNI_StickyNoteID note_id, const UT_Vector2D &size)=0
Set the size of the sticky note in the graph editor.
virtual UNI_NodeID createSubnet(UNI_NodeID parent_id, const UT_StringHolder &subnet_node_name, const UNI_PortIDList &create_input_ports, const UNI_PortIDList &create_output_ports)=0
virtual UT_StringHolder comment(UNI_NodeID node_id) const =0
The user-authored comment for a node.
virtual void setBackgroundHidden(UNI_StickyNoteID note_id, bool hidden)=0
virtual bool isMultiSignature(UNI_NodeID node_id) const =0
Returns true if the node has many signatures to choose from.
bool isEditable() const
Control whether this graph is editable.
virtual int findInputPortIndex(UNI_NodeID node_id, UNI_PortID port_id) const =0
Input ports of a node.
virtual bool isEditableSubnet(UNI_NodeID parent_id) const =0
virtual UT_StringHolder categoryName(UNI_NodeID node_id) const =0
The category name of the node.
virtual UNI_PortIDList subnetOutputPorts(UNI_PortID port_id) const =0
virtual UNI_StickyNoteIDList childStickyNotes(UNI_NodeID parent_id) const =0
virtual UT_StringHolder iconName(UNI_NodeID node_id) const =0
Returns the icon name for the given node.
virtual bool isEmpty() const =0
Returns true if the graph has no nodes.
virtual bool wireDirectlyToContainer() const =0
virtual int numberOfInputPorts(UNI_NodeID node_id) const =0
Input ports of a node.
virtual UT_StringHolder helpURL(UNI_NodeID node_id) const =0
virtual UNI_WireID createWire(UNI_PortID src, UNI_PortID dst)=0
Connect two ports.
virtual UNI_PortID outputPort(UNI_NodeID node_id, int port_index) const =0
Output ports of a node.
virtual UT_Vector2D position(UNI_NodeID node_id) const =0
The position of the node in the graph editor.
UN_ConstPort unPort(UNI_PortID id) const
Convenience methods to get a UN items from an UNI ID.
virtual bool isSubnet(UNI_NodeID node_id) const =0
Returns true if the given node is a subnet (can have child nodes).
virtual UT_Vector2D containerConnectPosition(UNI_NodeID parent_id, UNI_ContainerConnectType contype) const =0
virtual UNI_WireIDList childWires(UNI_NodeID parent_id) const =0
Returns the wires that live directly inside the given parent node.
virtual void setText(UNI_StickyNoteID note_id, const UT_StringHolder &text)=0
Set the sticky note text in the graph editor.
virtual void setColor(UNI_NodeID node_id, const UT_Color &clr)=0
Set the color tint of the node in the graph editor.
virtual UNI_PortShape shape(UNI_PortID port_id) const =0
Returns the visual shape of the port in the UI.
virtual void setTextSize(UNI_StickyNoteID note_id, const float size)=0
Set the size of the sticky note text in the graph editor.
virtual UNI_PortID outerPort(UNI_PortID port_id) const =0
Returns the "outer port" of a subport.
UN_Node unNode(UNI_NodeID id)
Convenience methods to get a UN items from an UNI ID.
virtual bool portIsSubPort(UNI_PortID port_id) const =0
Returns whether the port is a subport.
virtual UT_StringHolder name() const =0
UNI_PortKind
Specifies the port kind, ie, wheter it is an input or an output port.
virtual void setTags(UNI_NodeID node_id, const UT_StringArray &tags)=0
Set the list of tags associated with a node.
virtual UNI_WireStyle wireStyle() const =0
The drawing style of the connection wires in the graph.
virtual UT_StringHolder signatureName(UNI_NodeID node_id) const =0
The name of the current signature of the given node.
GLuint const GLchar * name
virtual void setPosition(UNI_NodeID node_id, const UT_Vector2D &pos)=0
Set the position of the node in the graph editor.
std::variant< UNI_InvalidParmValue, UNI_DefaultParmValue, bool, int64, fpreal64, UT_Vector2D, UT_Vector3D, UT_Vector4D, UT_Matrix3D, UT_Matrix4D, UT_StringHolder, UNI_RampParmValue > UNI_ParmValue
Variant data type that holds all the parm value types allowed in UNI parms.
virtual UNI_NodeID ownerNode(UNI_PortID port_id) const =0
virtual UNI_NodeID findNode(UNI_NodeID from_id, const UT_StringRef &path) const =0
virtual void updateDownstreamPortTypes(UNI_NodeID node_id, bool update_node)=0
virtual void destroy(UNI_NodeID node_id)=0
Destroy a node.
virtual void setContainerConnectColor(UNI_NodeID parent_id, UNI_ContainerConnectType contype, const UT_Color &clr)=0
virtual UNI_NodeID parentNode(UNI_NodeID node_id) const =0
virtual UNI_PortIDList outputPorts(UNI_NodeID node_id) const =0
Output ports of a node.
virtual UT_Array< UNI_Signature > signatures(UNI_NodeID node_id, bool compatible_only, bool force_include_current) const =0
virtual UT_Color containerConnectColor(UNI_NodeID parent_id, UNI_ContainerConnectType contype) const =0
UN_GraphData & unGraphData()
Returns the underlying UN graph.
virtual int findOutputPortIndex(UNI_NodeID node_id, UNI_PortID port_id) const =0
Output ports of a node.
virtual float textSize(UNI_StickyNoteID note_id) const =0
Returns the sticky note's text size.
virtual void setParmValue(UNI_NodeID node_id, const UT_StringRef &parm_name, const UNI_ParmValue &value)=0
Set the value of a parm on this node.
virtual UT_StringHolder findUniqueName(UNI_NodeID parent_id, const UT_StringHolder &name) const =0
Generic functions related to entity naming.
UN_Port unPort(UNI_PortID id)
Convenience methods to get a UN items from an UNI ID.
virtual UNI_PortID dstPort(UNI_WireID wire_id) const =0
UNI_PortShape
Specifies the visual shape of the port in the UI.
virtual bool isCollapsed(UNI_StickyNoteID note_id) const =0
Returns true if the sticky note is collapsed (minimized).
virtual void setName(UNI_NodeID node_id, const UT_StringHolder &name)=0
Set the name of a node.
virtual void setSignature(UNI_NodeID node_id, const UT_StringHolder &signature_name)=0
Sets the new signature on a node.
virtual UT_StringHolder typeName(UNI_NodeID node_id) const =0
The type name of the node.
virtual void setWireStyle(UNI_WireStyle wire_style)=0
The drawing style of the connection wires in the graph.
virtual void setCollapsed(UNI_StickyNoteID note_id, bool collapsed)=0
Returns true if the sticky note is collapsed (minimized).
virtual UNI_NodeID rootNode() const =0
virtual bool copyItems(UNI_NodeID parent_id, const UNI_NodeIDList &node_ids, const UNI_StickyNoteIDList ¬e_ids, std::ostream &os) const =0
virtual bool canSetName(UNI_PortID port_id) const =0
Some graphs support setting port names.
virtual bool isNameInUse(UNI_NodeID parent_id, const UT_StringRef &name) const =0
Generic functions related to entity naming.
virtual UT_StringHolder parmDialogScript(UNI_NodeID node_id) const =0
virtual UT_StringHolder path(UNI_NodeID node_id) const =0
The full path of the node.
virtual void setTextColor(UNI_StickyNoteID note_id, const UT_Color &clr)=0
Set the color of the sticky note text in the graph editor.
virtual bool pasteItems(UNI_NodeID parent_id, UNI_NodeIDList &node_ids, UNI_StickyNoteIDList ¬e_ids, std::istream &is, UT_StringMap< UT_StringHolder > *rename_map)=0
virtual UNI_PortID inputPort(UNI_NodeID node_id, int port_index) const =0
Input ports of a node.
virtual UT_StringHolder label(UNI_PortID port_id) const =0
The label of the port. Some ports can be renamed.