HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_Node.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UN_Node.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_Node_h__
13 #define __UN_Node_h__
14 
15 #include "UN_API.h"
16 #include "UN_Include.h"
17 #include "UN_GraphData.h"
18 #include "UN_Handle.h"
19 #include "UN_Iterator.h"
20 #include "UN_NodeUtils.h"
21 #include "UN_Parm.h"
22 #include "UN_Port.h"
23 #include "UN_StickyNote.h"
24 #include "UN_Wire.h"
25 
26 #include <utility>
27 
28 class UN_Graph;
29 
30 
31 // ============================================================================
32 /// Base class template for the UN node handle.
33 /// Its main purpose is to factor common code for const and non-const handles.
34 template <typename BASE_CLASS, // class to derive from
35  typename GRAPH_DATA, // UN_GraphData or const UN_GraphData
36  typename NODE, // Node handle class (UN_Node or UN_ConstNode)
37  typename PARM, // Parm handle class (UN_Parm or UN_ConstParm)
38  typename PORT, // Port handle class (UN_Port or UN_ConstPort)
39  typename STICKY_NOTE, // Sticky note handle class (UN_StickyNote..)
40  typename WIRE> // Wire handle class (UN_Wire or UN_ConstWire)
41 class UN_NodeBase : public BASE_CLASS
42 {
43 protected:
44  /// Constructs a handle for an invalid node.
45  UN_NodeBase() = default;
46 
47  /// Constructs a handle that references the given node in the given graph.
48  UN_NodeBase( GRAPH_DATA *graph_data, UN_NodeID node_id )
49  : BASE_CLASS( graph_data, node_id )
50  {}
51 
52 public:
53  /// @{ Returns the owner of the underlying graph data structures.
54  GRAPH_DATA * graphData() const
55  { return BASE_CLASS::graphData(); }
56  const UN_GraphData * constGraphData() const
57  { return BASE_CLASS::constGraphData(); }
58  /// @}
59 
60  /// Returns the unique ID of the node this handle refers to.
61  UN_NodeID nodeID() const
62  { return UN_NodeID( BASE_CLASS::dataID() ); }
63 
64  /// @{ Returns true if this node is valid within the graph; false otherwise.
65  bool isValid() const
66  { return UN_NodeUtils::isValid(
67  graphData(), nodeID());
68  }
69 
70  explicit operator bool() const
71  { return isValid(); }
72  /// @}
73 
74 
75  /// Returns the parent of this node.
76  /// Note, for top-level nodes, this will return a graph's root node.
77  NODE parent() const
78  {
79  return graphData()
80  ? NODE( graphData(), graphData()->parent( nodeID() ))
81  : NODE();
82  }
83 
84  /// Returns a non-root parent node ID of the given child node.
85  /// Note, for top-level nodes, this will return an invalid node ID,
86  /// because their parent is the implicitly created graph's root node.
87  NODE nonRootParent() const
88  {
89  return graphData()
90  ? NODE( graphData(), graphData()->nonRootParent( nodeID() ))
91  : NODE();
92  }
93 
94 
95  /// Returns the node name that differentiates it among its siblings.
96  const UT_StringHolder & name() const
97  {
98  return UN_NodeUtils::name( graphData(), nodeID() );
99  }
100 
101  /// Returns the node's type that determines its functional behavour.
102  const UT_StringHolder & typeName() const
103  {
104  return UN_NodeUtils::typeName( graphData(), nodeID() );
105  }
106 
107  /// Returns the node's category that groups it with other nodes
108  /// that are operationally compatible (and connectable).
110  {
111  return UN_NodeUtils::categoryName( graphData(), nodeID() );
112  }
113 
114  /// Returns the signature for the node.
116  {
117  return UN_NodeUtils::signatureName( graphData(), nodeID() );
118  }
119 
120  /// Returns the node path.
122  {
123  return UN_NodeUtils::path( graphData(), nodeID() );
124  }
125 
126  /// Returns the comment for the node.
127  const UT_StringHolder & comment() const
128  {
129  return UN_NodeUtils::comment( graphData(), nodeID() );
130  }
131 
132  /// Returns the node's position in the node editor.
133  const UT_Vector2D & position() const
134  {
135  return UN_NodeUtils::position( graphData(), nodeID() );
136  }
137 
138  /// Returns the node's color.
139  const UT_Color & color() const
140  {
141  return UN_NodeUtils::color( graphData(), nodeID() );
142  }
143 
144  /// Returns the node's tags.
145  const UT_StringArray & tags() const
146  {
147  return UN_NodeUtils::tags( graphData(), nodeID() );
148  }
149 
150  /// Returns the node's metadata.
151  const UN_MetadataHolder & metadata() const
152  {
153  return UN_NodeUtils::metadata( graphData(), nodeID() );
154  }
155 
156 
157  /// Returns the names of the node parameters.
159  {
161  }
162 
163  /// Returns the type names of the node parameters.
165  {
167  }
168 
169  /// Returns a parameter by the given name, or an invalid parm if not found.
170  PARM findParm( const UT_StringRef &parm_name ) const
171  {
172  return PARM( graphData(),
173  UN_NodeUtils::findParm( graphData(), nodeID(), parm_name ));
174  }
175 
176  /// An iterator and a range for parameters that belong to this node.
178  PARM, GRAPH_DATA, UN_NodeUtils::ParmIterator >;
180 
181  /// Returns a range for iterating over node parameters.
183  {
184  auto parm_range = UN_NodeUtils::parmRange( graphData(), nodeID() );
185  return ParmRange(
186  ParmIterator( graphData(), parm_range.begin() ),
187  ParmIterator( graphData(), parm_range.end() ));
188  }
189 
190  /// Returns the parameters of this node.
192  {
193  return UNhandleArray<PARM>( graphData(),
194  UN_NodeUtils::parms( graphData(), nodeID() ));
195  }
196 
197 
198  /// Returns the names of the node ports of a given kind
200  {
201  return UN_NodeUtils::portNames( graphData(), nodeID(), port_kind );
202  }
203 
204  /// Returns the type names of the node ports of a given kind
206  {
207  return UN_NodeUtils::portTypeNames( graphData(), nodeID(), port_kind );
208  }
209 
210 
211  /// Returns this node's port by the given name,
212  /// or an invalid port handle, if no such port was found,
213  PORT findPort( UN_PortKind port_kind,
214  const UT_StringRef &port_name ) const
215  {
216  return PORT( graphData(),
217  UN_NodeUtils::findPort( graphData(), nodeID(),
218  port_kind, port_name ));
219  }
220 
221  /// And iterator and a range for ports that belong to this node.
223  PORT, GRAPH_DATA, UN_NodeUtils::PortIterator >;
225 
226  /// Returns a range for iterating over this node's ports of the given kind,
227  /// forward from first to last.
228  PortRange portRange( UN_PortKind port_kind ) const
229  {
230  auto port_range =
231  UN_NodeUtils::portRange( graphData(), nodeID(), port_kind );
232  return PortRange(
233  PortIterator( graphData(), port_range.begin() ),
234  PortIterator( graphData(), port_range.end() ));
235  }
236 
237  /// And iterator and a range for ports that belong to this node.
241 
242  /// Returns a range for iterating over this node's ports of the given kind,
243  /// backward from last to first.
245  {
246  auto port_range =
247  UN_NodeUtils::portReverseRange(graphData(), nodeID(), port_kind );
248  return PortReverseRange(
249  PortReverseIterator( graphData(), port_range.begin() ),
250  PortReverseIterator( graphData(), port_range.end() ));
251  }
252 
253  /// Returns this node's ports of the given kind.
254  UT_Array<PORT> ports( UN_PortKind port_kind ) const
255  {
256  return UNhandleArray<PORT>( graphData(),
257  UN_NodeUtils::ports( graphData(), nodeID(), port_kind ));
258  }
259 
260 
261  /// Returns true if any of the node's input ports has a connected source
262  /// wire (feeding data from a source port).
264  {
266  graphData(), nodeID() );
267  }
268 
269  /// Returns the names of the node input ports.
271  {
272  return portNames( UN_PortKind::Input );
273  }
274 
275  /// Returns the type names of the node input ports.
277  {
279  }
280 
281  /// Returns this node's input port by the given name,
282  /// or an invalid port handle, if no such input was found,
283  PORT findInputPort( const UT_StringRef &port_name ) const
284  {
285  return findPort( UN_PortKind::Input, port_name );
286  }
287 
288  /// Returns a range for iterating over node input ports,
289  /// forward from first to last.
291  {
292  return portRange( UN_PortKind::Input );
293  }
294 
295  /// Returns a range for iterating over node input ports,
296  /// backwards from last to first.
298  {
300  }
301 
302  /// Returns this node's input ports of the given kind.
304  {
305  return ports( UN_PortKind::Input );
306  }
307 
308 
309  /// Returns true if any of the node's output ports has a connected
310  /// destination wire feeding data to a destination port.
312  {
314  graphData(), nodeID() );
315  }
316 
317  /// Returns the names of the node output ports.
319  {
320  return portNames( UN_PortKind::Output );
321  }
322 
323  /// Returns the type names of the node output ports.
325  {
327  }
328 
329  /// Returns this node's output port by the given name,
330  /// or an invalid port handle, if no such output was found,
331  PORT findOutputPort( const UT_StringRef &port_name ) const
332  {
333  return findPort(UN_PortKind::Output, port_name);
334  }
335 
336  /// Returns a range for iterating over this node's output ports,
337  /// forward from first to last.
339  {
340  return portRange( UN_PortKind::Output );
341  }
342 
343  /// Returns a range for iterating over this node's output ports,
344  /// backwards from last to first.
346  {
348  }
349 
350  /// Returns this node's output ports of the given kind.
352  {
353  return ports( UN_PortKind::Output );
354  }
355 
356 
357  /// Returns a node name that is not taken by any of this nodes' children.
359  const UT_StringRef &child_name ) const
360  {
362  graphData(), nodeID(), child_name );
363  }
364 
365  /// Returns true if the node can have child nodes inside.
366  bool isSubnet() const
367  {
368  return UN_NodeUtils::isSubnet( graphData(), nodeID() );
369  }
370 
371  /// Returns the names of the node children nodes.
373  {
375  }
376 
377  /// Returns the child node by the given name,
378  /// or an invalid handle if no such child node was found.
379  NODE findChildNode( const UT_StringRef &child_name ) const
380  {
381  return NODE( graphData(),
382  UN_NodeUtils::findChildNode( graphData(), nodeID(),
383  child_name ));
384  }
385 
386  /// Returns a node at the given path, or an invalid handle if not found.
387  ///
388  /// @parm node_path - The node path identifying the node to find.
389  /// This can be either an absolute path (starting with a slash, '/')
390  /// or a relative path. When the path is relative, this node
391  /// is used as an anchor from which the relative path is followed
392  /// to find the desired node.
393  /// In particular, when the node path is just a name, this function
394  /// will look for a child by that name directly inside this parent.
395  /// The path can contain '.' for the current node, and '..' for parent.
396  NODE findNode( const UT_StringRef &node_path ) const
397  {
398  return NODE( graphData(),
399  UN_NodeUtils::findNode( graphData(), nodeID(),
400  node_path ));
401  }
402 
403 
404  /// An iterator and a range for the children of this parent node.
406  NODE, GRAPH_DATA, UN_NodeUtils::ChildNodeIterator >;
408 
409  /// Returns a range for iterating over node's immediate children.
411  {
412  auto node_range = UN_NodeUtils::childNodeRange( graphData(), nodeID() );
413 
414  return ChildNodeRange(
415  ChildNodeIterator( graphData(), node_range.begin() ),
416  ChildNodeIterator( graphData(), node_range.end() ));
417  }
418 
419 
420  /// Returns the children nodes directly inside this node.
422  {
423  return UNhandleArray<NODE>( graphData(),
424  UN_NodeUtils::childNodes( graphData(), nodeID() ));
425  }
426 
427 
428  /// An iterator and a range for traversing the descendant nodes
429  /// of this (ancestor) node.
433 
434  /// Returns a range for iterating over the descendant nodes
435  /// of this (ancestor) node.
437  {
438  auto node_range =
439  UN_NodeUtils::descendantNodeRange( graphData(), nodeID() );
440  return DescendantNodeRange(
441  DescendantNodeIterator( graphData(), node_range.begin() ),
442  DescendantNodeIterator( graphData(), node_range.end() ));
443  }
444 
445 
446  /// An iterator and a range for the connection wires between immediate
447  /// children inside this node.
448  /// (And also direct wires between inputs and outputs on this node).
450  WIRE, GRAPH_DATA, UN_NodeUtils::ChildWireIterator >;
452 
453  /// Returns a range for iterating over the connection wires between
454  /// this node's immediate children, directly inside the this node.
455  /// (And also direct wires between inputs and outputs on this node).
457  {
458  auto wire_range = UN_NodeUtils::childWireRange( graphData(), nodeID() );
459 
460  return ChildWireRange(
461  ChildWireIterator( graphData(), wire_range.begin() ),
462  ChildWireIterator( graphData(), wire_range.end() ));
463  }
464 
465  /// Returns the wires connecting child nodes directly inside this node
466  /// (And also direct wires between inputs and outputs on this node).
468  {
469  return UNhandleArray<WIRE>( graphData(),
470  UN_NodeUtils::childWires( graphData(), nodeID() ));
471  }
472 
473 
474  /// An iterator and a range for the connection wires between
475  /// the descendants (children, grandchildren, etc) inside this node.
476  /// (And also direct wires between inputs and outputs on this node).
480 
481  /// Returns a range for iterating over the connection wires between
482  /// this node's descendants (ie, its children and grandchildren, etc).
483  /// (And also direct wires between inputs and outputs on this node).
485  {
486  auto wire_range =
487  UN_NodeUtils::descendantWireRange( graphData(), nodeID());
488  return DescendantWireRange(
489  DescendantWireIterator( graphData(), wire_range.begin() ),
490  DescendantWireIterator( graphData(), wire_range.end() ));
491  }
492 
493  /// Returns the child sticky note by the given name,
494  /// or an invalid handle if no such child node was found.
495  STICKY_NOTE findChildStickyNote( const UT_StringRef &child_name ) const
496  {
497  return STICKY_NOTE( graphData(),
498  UN_NodeUtils::findChildStickyNote( graphData(), nodeID(),
499  child_name ));
500  }
501 
502  /// Returns the child sticky notes directly inside this node.
504  {
505  return UNhandleArray<STICKY_NOTE>( graphData(),
506  UN_NodeUtils::childStickyNotes( graphData(), nodeID() ));
507  }
508 
509  /// Returns the options object representing this node.
510  /// This can be then used for serialization to JSON, etc.
512  {
514  }
515 };
516 
517 
518 // ============================================================================
519 /// A handle that references a mutable node in a graph.
520 /// It abstracts the APIs that operate on this node's data,
521 /// which is stored inside graph's data containers.
522 /// It is a non-const (read-write) handle, so allows both queries
523 /// and mutations of the node's data.
524 class UN_API UN_Node : public UN_NodeBase< UN_Handle,
525  UN_GraphData, UN_Node, UN_Parm, UN_Port, UN_StickyNote, UN_Wire >
526 {
527 public:
528  /// Constructs a handle for an invalid node.
529  UN_Node() = default;
530 
531  /// Constructs a handle referencing the given node in the given graph.
532  UN_Node( UN_GraphData *graph_data, UN_NodeID node_id )
533  : UN_NodeBase( graph_data, node_id )
534  {}
535 
536 
537  /// @{ Comparison operators.
538  // Allows comparing node handles, but guards against
539  // comparing nodes to wires, for example.
540  bool operator==( const UN_Node &other ) const
541  { return UN_ConstHandle::operator==( other ); }
542  bool operator!=( const UN_Node &other ) const
543  { return UN_ConstHandle::operator!=( other ); }
544  /// @}
545 
546 
547  /// Returns the graph within which this node exists.
548  UN_Graph graph() const;
549 
550 
551  /// Sets the node name that differentiates it among its siblings.
552  void setName( const UT_StringRef &name ) const
553  {
554  UN_NodeUtils::setName( graphData(), nodeID(), name );
555  }
556 
557  /// Sets the node's type that determines its functional behavour.
558  void setTypeName( const UT_StringRef &type_name ) const
559  {
560  UN_NodeUtils::setTypeName( graphData(), nodeID(), type_name );
561  }
562 
563  /// Sets the signature on the node.
564  void setSignature( const UT_StringRef &signature_name ) const
565  {
566  UN_NodeUtils::setSignature( graphData(), nodeID(), signature_name );
567  }
568 
569  /// Sets the comment on the node. The comment can show up in network editor.
570  void setComment( const UT_StringRef &comment ) const
571  {
572  UN_NodeUtils::setComment( graphData(), nodeID(), comment );
573  }
574 
575  /// Sets the node's location. Used for the node position in network editor.
576  void setPosition( const UT_Vector2D &position ) const
577  {
578  UN_NodeUtils::setPosition( graphData(), nodeID(), position );
579  }
580 
581  /// Sets the node's color. The color is used in network editor.
582  void setColor( const UT_Color &color ) const
583  {
584  UN_NodeUtils::setColor( graphData(), nodeID(), color );
585  }
586 
587  /// Sets the tags for the node (copy-assignment).
588  void setTags( const UT_StringArray &tags ) const
589  {
590  UN_NodeUtils::setTags( graphData(), nodeID(), tags );
591  }
592 
593  /// Sets the tags for the node (move-assignment).
594  void setTags( UT_StringArray &&tags ) const
595  {
596  UN_NodeUtils::setTags( graphData(), nodeID(), std::move(tags) );
597  }
598 
599  /// Returns the tags moved out of the node.
600  /// This is useful in combination with rvalue ref version of setTags()
601  /// to optimize the edits to the tag list.
603  {
604  return UN_NodeUtils::stealTags( graphData(), nodeID() );
605  }
606 
607  /// Sets tags in-place, which is faster than setting the whole dictionary.
608  /// Intended usage:
609  /// n.updateTags([&value](auto &t) { t.set("key", value) });
610  template <typename OP>
611  void updateTags( const OP &op ) const
612  {
613  UN_NodeUtils::updateTags( graphData(), nodeID(), op );
614  }
615 
616 
617  /// Sets the metadata for the node (copy-assignment).
618  void setMetadata( const UN_MetadataHolder &metadata ) const
619  {
620  UN_NodeUtils::setMetadata( graphData(), nodeID(), metadata );
621  }
622 
623  /// Sets the metadata for the node (move-assignment).
624  void setMetadata( UN_MetadataHolder &&metadata ) const
625  {
626  UN_NodeUtils::setMetadata( graphData(), nodeID(), std::move(metadata) );
627  }
628 
629  /// Returns the metadata moved out of the node.
631  {
632  return UN_NodeUtils::stealMetadata( graphData(), nodeID() );
633  }
634 
635  /// Sets metadata in-place, which is faster than setting whole dictionary.
636  /// Intended usage:
637  /// n.updateTags([&value](auto &m) { m.set("key", value) });
638  template <typename OP>
639  void updateMetadata( const OP &op ) const
640  {
641  UN_NodeUtils::updateMetadata( graphData(), nodeID(), op );
642  }
643 
644  /// Simpler method to update a single metadata value in-place.
645  void updateMetadata( const UT_StringHolder &key,
647  {
648  UN_NodeUtils::updateMetadata(
649  graphData(), nodeID(), key, std::move(value) );
650  }
651 
652  /// Deletes this node from the graph.
653  void destroy() const
654  {
655  UN_NodeUtils::deleteNode( graphData(), nodeID() );
656  }
657 
658 
659  /// Adds and returns a new parameter to this node.
660  /// If another parameter of a given name already exists, returns an
661  /// invalid parameter, indicating a failure because of the name collision.
662  UN_Parm createParm( const UT_StringRef &parm_name,
663  const UT_StringRef &parm_type_name =
664  UN_UNDEFINED_PARM_TYPE_NAME.asRef()) const
665  {
666  return UN_Parm( graphData(),
668  parm_name, parm_type_name ));
669  }
670 
671 
672  /// Adds a new port to this node and returns it.
673  /// If another port of a given kind and name already exists, returns an
674  /// invalid port, indicating a failure because of the name collision.
676  const UT_StringRef &port_name = UT_StringRef(),
677  const UT_StringRef &port_type_name =
678  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
679  const UT_StringRef &port_label = UT_StringRef(),
680  const UT_Optional<exint> &index = std::nullopt ) const
681  {
682  return UN_Port( graphData(),
684  port_kind, port_name, port_type_name, port_label,
685  index ));
686  }
687 
688  /// Returns an existing port by the given name, or creates one
689  /// (with the given type and label) if not found.
691  const UT_StringRef &port_name,
692  const UT_StringRef &port_type_name =
693  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
694  const UT_StringRef &port_label = UT_StringRef() ) const
695  {
696  return UN_Port( graphData(),
697  UN_NodeUtils::findOrCreatePort( graphData(), nodeID(),
698  port_kind, port_name, port_type_name, port_label ));
699  }
700 
701 
702  /// Adds and returns a new input port to this node.
703  /// If another input port of a given name already exists, returns an
704  /// invalid port, indicating a failure because of the name collision.
706  const UT_StringRef &port_name = UT_StringRef(),
707  const UT_StringRef &port_type_name =
708  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
709  const UT_StringRef &port_label = UT_StringRef(),
710  const UT_Optional<exint> &index = std::nullopt ) const
711  {
713  port_name, port_type_name, port_label, index );
714  }
715 
716  /// Returns an existing input port by the given name, or creates one
717  /// (with the given type and label) if not found.
719  const UT_StringRef &port_name,
720  const UT_StringRef &port_type_name =
721  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
722  const UT_StringRef &port_label = UT_StringRef() ) const
723  {
724  return findOrCreatePort( UN_PortKind::Input,
725  port_name, port_type_name, port_label );
726  }
727 
728 
729  /// Adds and returns a new output port to this node.
730  /// If another outupt port of a given name already exists, returns an
731  /// invalid port, indicating a failure because of the name collision.
733  const UT_StringRef &port_name = UT_StringRef(),
734  const UT_StringRef &port_type_name =
735  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
736  const UT_StringRef &port_label = UT_StringRef(),
737  const UT_Optional<exint> &index = std::nullopt ) const
738  {
740  port_name, port_type_name, port_label, index );
741  }
742 
743  /// Returns an existing output port by the given name, or creates one
744  /// (with the given type and label) if not found.
746  const UT_StringRef &port_name,
747  const UT_StringRef &port_type_name =
748  UN_UNDEFINED_PORT_TYPE_NAME.asRef(),
749  const UT_StringRef &port_label = UT_StringRef() ) const
750  {
751  return findOrCreatePort( UN_PortKind::Output,
752  port_name, port_type_name, port_label );
753  }
754 
755 
756  /// Creates and returns a new node that is a child of this node.
758  const UT_StringRef &child_name = UT_StringRef(),
759  const UT_StringRef &child_type = UT_StringRef(),
760  const UT_StringRef &child_category = UT_StringRef()) const
761  {
762  return UN_Node( graphData(),
764  child_name, child_type, child_category ));
765  }
766 
767  /// Deletes the child node from the graph (removing it from this network).
768  void deleteChildNode( const UT_StringRef &child_name ) const
769  {
770  UN_NodeUtils::deleteChildNode( graphData(), nodeID(), child_name );
771  }
772 
773  /// Creates and returns a new sticky note that is a child of this node.
775  const UT_StringRef &note_name = UT_StringRef(),
776  const UT_StringRef &note_text = UT_StringRef()) const
777  {
778  return UN_StickyNote( graphData(),
780  note_name, note_text ));
781  }
782 
783  /// Deletes the child sticky note from the graph
784  /// (removing it from this network).
785  void deleteChildStickyNote( const UT_StringRef &sticky_note_name ) const
786  {
788  sticky_note_name );
789  }
790 
791  /// Configure the node based on the given options.
792  void setFromOptions( const UN_Options &node_opts ) const
793  {
794  UN_NodeUtils::setFromOptions( graphData(), nodeID(), node_opts );
795  }
796 };
797 
798 
799 // ============================================================================
800 /// A handle that references a const node in a graph.
801 /// It abstracts the APIs that operate on this node's data stored inside
802 /// graph's data containers.
803 /// It is a constant handle, so allows only queries of the node's data,
804 /// and does not allow setting any new values for.
805 class UN_API UN_ConstNode : public UN_NodeBase< UN_ConstHandle,
806  const UN_GraphData, UN_ConstNode, UN_ConstParm, UN_ConstPort,
807  UN_ConstStickyNote, UN_ConstWire >
808 {
809 public:
810  /// Constructs a handle for an invalid node.
811  UN_ConstNode() = default;
812 
813  /// Constructs a handle referencing the given node in the given graph.
814  UN_ConstNode( const UN_GraphData *graph_data, UN_NodeID node_id )
815  : UN_NodeBase( graph_data, node_id )
816  {}
817 
818  /// Constructs a const handle from a mutable node handle.
819  UN_ConstNode( const UN_Node &node )
820  : UN_ConstNode( node.constGraphData(), node.nodeID() )
821  {}
822 
823 
824  /// @{ Comparison operators.
825  // Allows comparing node handles, but guards against
826  // comparing nodes to wires, for example.
827  bool operator==( const UN_ConstNode &other ) const
828  { return UN_ConstHandle::operator==( other ); }
829  bool operator!=( const UN_ConstNode &other ) const
830  { return UN_ConstHandle::operator!=( other ); }
831  /// @}
832 
833 
834  /// Returns the graph within which this node exists.
835  UN_ConstGraph graph() const;
836 };
837 
838 // ============================================================================
839 // Free functions to compare a non-const node handle to a const node handle.
840 // Note, the const to non-const comparison is covered by implicit conversion
841 // of non-const handle to const handle, and using const to const handle comp.
842 static inline bool
843 operator==( const UN_Node &a, const UN_ConstNode &b )
844 {
845  return b == UN_ConstNode(a);
846 }
847 
848 static inline bool
849 operator!=( const UN_Node &a, const UN_ConstNode &b )
850 {
851  return !(b == a);
852 }
853 
854 // ============================================================================
855 
856 
857 #endif
858 
PortReverseRange inputPortReverseRange() const
Definition: UN_Node.h:297
void setFromOptions(const UN_Options &node_opts) const
Configure the node based on the given options.
Definition: UN_Node.h:792
UN_ConstNode(const UN_GraphData *graph_data, UN_NodeID node_id)
Constructs a handle referencing the given node in the given graph.
Definition: UN_Node.h:814
UN_HandleIterator< PORT, GRAPH_DATA, UN_NodeUtils::PortIterator > PortIterator
And iterator and a range for ports that belong to this node.
Definition: UN_Node.h:223
UN_WireIDList::const_iterator ChildWireIterator
A range for traversing the wires contained directly inside a node.
Definition: UN_NodeUtils.h:845
UN_API UN_OptionsPtr asOptions(const UN_GraphData *graph_data, UN_NodeID node_id)
UT_Array< NODE > childNodes() const
Returns the children nodes directly inside this node.
Definition: UN_Node.h:421
bool isSubnet() const
Returns true if the node can have child nodes inside.
Definition: UN_Node.h:366
PortRange outputPortRange() const
Definition: UN_Node.h:338
UT_Array< PORT > outputPorts() const
Returns this node's output ports of the given kind.
Definition: UN_Node.h:351
void setComment(const UT_StringRef &comment) const
Sets the comment on the node. The comment can show up in network editor.
Definition: UN_Node.h:570
UN_API void deleteChildStickyNote(UN_GraphData *graph_data, UN_NodeID parent_id, const UT_StringRef &child_sticky_note_name)
bool operator!=(const UN_ConstNode &other) const
Comparison operators.
Definition: UN_Node.h:829
UT_Array< STICKY_NOTE > childStickyNotes() const
Returns the child sticky notes directly inside this node.
Definition: UN_Node.h:503
GLsizei const GLfloat * value
Definition: glcorearb.h:824
UT_IteratorRange< ChildNodeIterator > ChildNodeRange
Definition: UN_Node.h:407
void setPosition(const UT_Vector2D &position) const
Sets the node's location. Used for the node position in network editor.
Definition: UN_Node.h:576
UN_Port createOutputPort(const UT_StringRef &port_name=UT_StringRef(), const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef(), const UT_Optional< exint > &index=std::nullopt) const
Definition: UN_Node.h:732
GRAPH_DATA * graphData() const
Returns the owner of the underlying graph data structures.
Definition: UN_Node.h:54
UT_Array< UT_StringHolder > outputPortTypeNames() const
Returns the type names of the node output ports.
Definition: UN_Node.h:324
UT_StringHolder findValidUniqueChildNodeName(const UT_StringRef &child_name) const
Returns a node name that is not taken by any of this nodes' children.
Definition: UN_Node.h:358
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
PORT findInputPort(const UT_StringRef &port_name) const
Definition: UN_Node.h:283
UT_Array< UT_StringHolder > parmTypeNames() const
Returns the type names of the node parameters.
Definition: UN_Node.h:164
UT_Array< UT_StringHolder > inputPortTypeNames() const
Returns the type names of the node input ports.
Definition: UN_Node.h:276
UN_HandleIterator< NODE, GRAPH_DATA, UN_NodeUtils::ChildNodeIterator > ChildNodeIterator
An iterator and a range for the children of this parent node.
Definition: UN_Node.h:406
bool operator!=(const UN_Node &other) const
Comparison operators.
Definition: UN_Node.h:542
#define UN_API
Definition: UN_API.h:11
UT_Array< UT_StringHolder > childNodeNames() const
Returns the names of the node children nodes.
Definition: UN_Node.h:372
UT_IteratorRange< PortReverseIterator > PortReverseRange
Definition: UN_Node.h:240
UT_Array< UT_StringHolder > portNames(UN_PortKind port_kind) const
Returns the names of the node ports of a given kind.
Definition: UN_Node.h:199
UT_Array< PORT > ports(UN_PortKind port_kind) const
Returns this node's ports of the given kind.
Definition: UN_Node.h:254
OutGridT const XformOp bool bool
void setTags(const UT_StringArray &tags) const
Sets the tags for the node (copy-assignment).
Definition: UN_Node.h:588
bool isAnyInputPortConnectedToSrc() const
Definition: UN_Node.h:263
std::optional< T > UT_Optional
Definition: UT_Optional.h:26
UN_API UT_Array< UT_StringHolder > childNodeNames(const UN_GraphData *graph_data, UN_NodeID node_id)
Returns the names of the children nodes of the given parent node.
UT_IteratorRange< ChildWireIterator > ChildWireRange
Definition: UN_Node.h:451
UN_API void setFromOptions(UN_GraphData *graph_data, UN_NodeID node_id, const UN_Options &node_opts)
Load and set the node based on the given options.
void setTags(UT_StringArray &&tags) const
Sets the tags for the node (move-assignment).
Definition: UN_Node.h:594
UN_HandleIterator< NODE, GRAPH_DATA, UN_NodeUtils::DescendantNodeIterator > DescendantNodeIterator
Definition: UN_Node.h:431
UT_IteratorRange< PortIterator > PortRange
Definition: UN_Node.h:224
UN_API bool isAnyOutputPortConnectedToDst(const UN_GraphData *graph_data, UN_NodeID node_id)
UN_HandleIterator< WIRE, GRAPH_DATA, UN_NodeUtils::ChildWireIterator > ChildWireIterator
Definition: UN_Node.h:450
void updateMetadata(const OP &op) const
Definition: UN_Node.h:639
UN_API UN_PortID createPort(UN_GraphData *graph_data, UN_NodeID node_id, UN_PortKind port_kind, const UT_StringRef &port_name, const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef(), const UT_Optional< exint > &index=std::nullopt)
UN_ParmIDList::const_iterator ParmIterator
Definition: UN_NodeUtils.h:284
UN_Port findOrCreateInputPort(const UT_StringRef &port_name, const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef()) const
Definition: UN_Node.h:718
UT_IteratorRange< DescendantNodeIterator > DescendantNodeRange
Definition: UN_Node.h:432
UN_Port createInputPort(const UT_StringRef &port_name=UT_StringRef(), const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef(), const UT_Optional< exint > &index=std::nullopt) const
Definition: UN_Node.h:705
UN_NodeBase(GRAPH_DATA *graph_data, UN_NodeID node_id)
Constructs a handle that references the given node in the given graph.
Definition: UN_Node.h:48
UN_API UT_StringHolder path(const UN_GraphData *graph_data, UN_NodeID node_id)
Returns the node path.
const UT_StringHolder & comment() const
Returns the comment for the node.
Definition: UN_Node.h:127
UN_API UN_NodeID createChildNode(UN_GraphData *graph_data, UN_NodeID parent_id, const UT_StringRef &child_name=UT_StringRef(), const UT_StringRef &child_type=UT_StringRef(), const UT_StringRef &child_category=UT_StringRef())
Creates and returns a new node that is a child of this node.
UN_OptionsPtr asOptions() const
Definition: UN_Node.h:511
UT_Array< UT_StringHolder > parmNames() const
Returns the names of the node parameters.
Definition: UN_Node.h:158
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size(){return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >);}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size< T, 0 >)};};template< typename T > struct subtype_count{static constexpr int value{is_mutable_container< T >::value?expected_max_vector_size:type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min{static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type >{static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min(){return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min(){return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >);}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size_min< T, 0 >)};};template< typename T > struct subtype_count_min{static constexpr int value{is_mutable_container< T >::value?((type_count< T >::value< expected_max_vector_size)?type_count< T >::value:0):type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count{static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type >{static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category:int{char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object{static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type >{static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type >{static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >{static constexpr object_category value{object_category::floating_point};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value >::type >{static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1)&&std::is_constructible< T, std::string >::value >::type >{static constexpr object_category value{object_category::string_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type{using type=typename std::conditional<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type >{static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type >{static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name(){return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >);}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name(){return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name(){auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >)}+ ','+tuple_name< T, I+1 >);if(str.back()== ',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
Definition: CLI11.h:1729
void setColor(const UT_Color &color) const
Sets the node's color. The color is used in network editor.
Definition: UN_Node.h:582
const UT_StringHolder & signatureName() const
Returns the signature for the node.
Definition: UN_Node.h:115
UN_Node(UN_GraphData *graph_data, UN_NodeID node_id)
Constructs a handle referencing the given node in the given graph.
Definition: UN_Node.h:532
UN_API UT_Array< UT_StringHolder > parmTypeNames(const UN_GraphData *graph_data, UN_NodeID node_id)
Returns the type names of the node parameters.
void deleteChildStickyNote(const UT_StringRef &sticky_note_name) const
Definition: UN_Node.h:785
void setTypeName(const UT_StringRef &type_name) const
Sets the node's type that determines its functional behavour.
Definition: UN_Node.h:558
UN_Port createPort(UN_PortKind port_kind, const UT_StringRef &port_name=UT_StringRef(), const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef(), const UT_Optional< exint > &index=std::nullopt) const
Definition: UN_Node.h:675
void setMetadata(const UN_MetadataHolder &metadata) const
Sets the metadata for the node (copy-assignment).
Definition: UN_Node.h:618
PortRange inputPortRange() const
Definition: UN_Node.h:290
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
UNI_PortKind
Specifies the port kind, ie, wheter it is an input or an output port.
Definition: UNI_Include.h:21
UT_StringHolder path() const
Returns the node path.
Definition: UN_Node.h:121
const UT_Color & color() const
Returns the node's color.
Definition: UN_Node.h:139
PortRange portRange(UN_PortKind port_kind) const
Definition: UN_Node.h:228
UN_NodeBase()=default
Constructs a handle for an invalid node.
UN_API UT_Array< UT_StringHolder > parmNames(const UN_GraphData *graph_data, UN_NodeID node_id)
Returns the names of the node parameters.
UN_API UT_Array< UT_StringHolder > portTypeNames(const UN_GraphData *graph_data, UN_NodeID node_id, UN_PortKind port_kind)
Returns the type names of the node ports of a given kind.
bool operator==(const UN_ConstNode &other) const
Comparison operators.
Definition: UN_Node.h:827
GLuint const GLchar * name
Definition: glcorearb.h:786
bool isAnyOutputPortConnectedToDst() const
Definition: UN_Node.h:311
ParmRange parmRange() const
Returns a range for iterating over node parameters.
Definition: UN_Node.h:182
const UT_StringArray & tags() const
Returns the node's tags.
Definition: UN_Node.h:145
UT_Array< PARM > parms() const
Returns the parameters of this node.
Definition: UN_Node.h:191
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
UT_Array< UT_StringHolder > outputPortNames() const
Returns the names of the node output ports.
Definition: UN_Node.h:318
void setName(const UT_StringRef &name) const
Sets the node name that differentiates it among its siblings.
Definition: UN_Node.h:552
STICKY_NOTE findChildStickyNote(const UT_StringRef &child_name) const
Definition: UN_Node.h:495
UN_Parm createParm(const UT_StringRef &parm_name, const UT_StringRef &parm_type_name=UN_UNDEFINED_PARM_TYPE_NAME.asRef()) const
Definition: UN_Node.h:662
UT_Array< PORT > inputPorts() const
Returns this node's input ports of the given kind.
Definition: UN_Node.h:303
const UN_MetadataHolder & metadata() const
Returns the node's metadata.
Definition: UN_Node.h:151
const UT_StringHolder & categoryName() const
Definition: UN_Node.h:109
PortReverseRange outputPortReverseRange() const
Definition: UN_Node.h:345
ChildWireRange childWireRange() const
Definition: UN_Node.h:456
A map of string to various well defined value types.
Definition: UT_Options.h:87
UN_HandleIterator< PORT, GRAPH_DATA, UN_NodeUtils::PortReverseIterator > PortReverseIterator
And iterator and a range for ports that belong to this node.
Definition: UN_Node.h:239
UN_NodeID nodeID() const
Returns the unique ID of the node this handle refers to.
Definition: UN_Node.h:61
UT_Array< WIRE > childWires() const
Definition: UN_Node.h:467
void setSignature(const UT_StringRef &signature_name) const
Sets the signature on the node.
Definition: UN_Node.h:564
const UT_Vector2D & position() const
Returns the node's position in the node editor.
Definition: UN_Node.h:133
void updateTags(const OP &op) const
Definition: UN_Node.h:611
UN_API bool isAnyInputPortConnectedToSrc(const UN_GraphData *graph_data, UN_NodeID node_id)
GLuint color
Definition: glcorearb.h:1261
UT_StringArray stealTags() const
Definition: UN_Node.h:602
const UT_StringHolder & name() const
Returns the node name that differentiates it among its siblings.
Definition: UN_Node.h:96
void destroy() const
Deletes this node from the graph.
Definition: UN_Node.h:653
UT_IteratorRange< ParmIterator > ParmRange
Definition: UN_Node.h:179
PARM findParm(const UT_StringRef &parm_name) const
Returns a parameter by the given name, or an invalid parm if not found.
Definition: UN_Node.h:170
void setMetadata(UN_MetadataHolder &&metadata) const
Sets the metadata for the node (move-assignment).
Definition: UN_Node.h:624
NODE findNode(const UT_StringRef &node_path) const
Definition: UN_Node.h:396
UN_Port findOrCreateOutputPort(const UT_StringRef &port_name, const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef()) const
Definition: UN_Node.h:745
GLuint index
Definition: glcorearb.h:786
bool operator!=(const UN_ConstHandle &other) const
Definition: UN_Handle.h:68
bool operator==(const UN_ConstHandle &other) const
Definition: UN_Handle.h:59
bool isValid() const
Returns true if this node is valid within the graph; false otherwise.
Definition: UN_Node.h:65
NODE nonRootParent() const
Definition: UN_Node.h:87
SIM_API const UT_StringHolder position
UN_API void deleteChildNode(UN_GraphData *graph_data, UN_NodeID parent_id, const UT_StringRef &child_name)
Deletes the child node from the graph (removing it from this network).
UN_HandleIterator< PARM, GRAPH_DATA, UN_NodeUtils::ParmIterator > ParmIterator
An iterator and a range for parameters that belong to this node.
Definition: UN_Node.h:178
bool operator==(const UN_Node &other) const
Comparison operators.
Definition: UN_Node.h:540
UN_API UT_StringHolder findValidUniqueChildNodeName(const UN_GraphData *graph_data, UN_NodeID node_id, const UT_StringRef &child_name=UT_StringRef())
const UT_StringHolder & typeName() const
Returns the node's type that determines its functional behavour.
Definition: UN_Node.h:102
DescendantNodeRange descendantNodeRange() const
Definition: UN_Node.h:436
UN_PortIDList::const_reverse_iterator PortReverseIterator
Definition: UN_NodeUtils.h:492
PORT findOutputPort(const UT_StringRef &port_name) const
Definition: UN_Node.h:331
UN_API UN_StickyNoteID createChildStickyNote(UN_GraphData *graph_data, UN_NodeID parent_id, const UT_StringRef &sticky_note_name=UT_StringRef(), const UT_StringRef &sticky_note_text=UT_StringRef())
Creates and returns a new sticky note that is a child of this node.
UN_NodeIDList::const_iterator ChildNodeIterator
An iterator and a range for iterating over child node IDs.
Definition: UN_NodeUtils.h:648
PORT findPort(UN_PortKind port_kind, const UT_StringRef &port_name) const
Definition: UN_Node.h:213
UN_Node createChildNode(const UT_StringRef &child_name=UT_StringRef(), const UT_StringRef &child_type=UT_StringRef(), const UT_StringRef &child_category=UT_StringRef()) const
Creates and returns a new node that is a child of this node.
Definition: UN_Node.h:757
ChildNodeRange childNodeRange() const
Returns a range for iterating over node's immediate children.
Definition: UN_Node.h:410
UN_Port findOrCreatePort(UN_PortKind port_kind, const UT_StringRef &port_name, const UT_StringRef &port_type_name=UN_UNDEFINED_PORT_TYPE_NAME.asRef(), const UT_StringRef &port_label=UT_StringRef()) const
Definition: UN_Node.h:690
UN_StickyNote createChildStickyNote(const UT_StringRef &note_name=UT_StringRef(), const UT_StringRef &note_text=UT_StringRef()) const
Creates and returns a new sticky note that is a child of this node.
Definition: UN_Node.h:774
UN_PortIDList::const_iterator PortIterator
An iterator and a range for iterating over node port IDs.
Definition: UN_NodeUtils.h:458
UT_Array< UT_StringHolder > inputPortNames() const
Returns the names of the node input ports.
Definition: UN_Node.h:270
PortReverseRange portReverseRange(UN_PortKind port_kind) const
Definition: UN_Node.h:244
void updateMetadata(const UT_StringHolder &key, UT_OptionEntryPtr &&value)
Simpler method to update a single metadata value in-place.
Definition: UN_Node.h:645
DescendantWireRange descendantWireRange() const
Definition: UN_Node.h:484
const UN_GraphData * constGraphData() const
Returns the owner of the underlying graph data structures.
Definition: UN_Node.h:56
NODE findChildNode(const UT_StringRef &child_name) const
Definition: UN_Node.h:379
void deleteChildNode(const UT_StringRef &child_name) const
Deletes the child node from the graph (removing it from this network).
Definition: UN_Node.h:768
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542
An iterator for traversing the wires deep inside the given node.
Definition: UN_NodeUtils.h:861
UN_ConstNode(const UN_Node &node)
Constructs a const handle from a mutable node handle.
Definition: UN_Node.h:819
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
UN_HandleIterator< WIRE, GRAPH_DATA, UN_NodeUtils::DescendantWireIterator > DescendantWireIterator
Definition: UN_Node.h:478
UT_IteratorRange< DescendantWireIterator > DescendantWireRange
Definition: UN_Node.h:479
NODE parent() const
Definition: UN_Node.h:77
UN_API UT_Array< UT_StringHolder > portNames(const UN_GraphData *graph_data, UN_NodeID node_id, UN_PortKind port_kind)
Returns the names of the node ports of a given kind.
UT_UniquePtr< UN_Options > UN_OptionsPtr
Definition: UN_Include.h:640
UN_API UN_ParmID createParm(UN_GraphData *graph_data, UN_NodeID node_id, const UT_StringRef &parm_name, const UT_StringRef &parm_type_name=UN_UNDEFINED_PARM_TYPE_NAME.asRef())
UN_MetadataHolder stealMetadata() const
Returns the metadata moved out of the node.
Definition: UN_Node.h:630
UT_Array< UT_StringHolder > portTypeNames(UN_PortKind port_kind) const
Returns the type names of the node ports of a given kind.
Definition: UN_Node.h:205