HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Network.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: OP Library (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __OP_Network_h__
13 #define __OP_Network_h__
14 
15 #include "OP_API.h"
16 #include "OP_DataTypes.h"
17 #include "OP_DotList.h"
18 #include "OP_GroupList.h"
19 #include "OP_NetworkBox.h"
20 #include "OP_NetworkBoxList.h"
21 #include "OP_Node.h"
22 #include "OP_PostIt.h"
23 #include "OP_PostItNoteList.h"
24 #include <UT/UT_Array.h>
25 #include <UT/UT_ValArray.h>
26 #include <UT/UT_Set.h>
27 #include <UT/UT_String.h>
28 #include <UT/UT_StringMMPattern.h>
29 #include <UT/UT_SymbolTable.h>
30 #include <SYS/SYS_Types.h>
31 #include <iosfwd>
32 #include <set>
33 
34 class UT_CPIO;
35 class UT_WorkBuffer;
36 class UT_StringArray;
37 class OP_Director;
38 class OP_Dot;
39 class OP_Group;
40 class OP_Operator;
41 class OP_OperatorTable;
42 class OP_ProxyRefNode;
44 class OP_UndoLoad;
45 class op_PathSet;
46 class MOT_Director;
47 
49 
51 
52 // The tile type is used to distinguish between the various types of
53 // nodes that the networks are starting to contain.
55 {
56  OP_TILE_ALL = 0xFF,
57  OP_TILE_NODE = 0x01, // The regular op nodes
58  OP_TILE_PARENT = 0x02, // The parent inputs for subnets
59  OP_TILE_GROUP = 0x04, // The op groups
60 
61  // These are for convenience
65 };
66 
67 // If you are looking for the OBJ_TABLE_NAME and SOP_SCRIPT_NAME style #defines
68 // that used to be here, they have been moved up to OP_Node.h.
69 
71 {
72  OP_RENAME_NO_PROPAGATE = 0x00, // does no propagation
73  OP_RENAME_NORMAL = 0x01, // does all propagation
74  OP_RENAME_NO_EVENTS = 0x02, // does not send op events AND
75  // does not re-export chops
76  OP_RENAME_NO_DEPENDENCIES = 0x04, // does not notify dependencies
77 
79 };
80 
82 {
84  {
85  replacePrefix = 0;
86  replaceSuffix = 0;
88  }
89 
97 
98 private:
99  // copy constructors are not implemented yet
101  OP_FixNameParms &operator =( const OP_FixNameParms &copy );
102 };
103 
104 // This class is used to filter OP_Operators from being instantiated
105 // and shelf tools from appearing in the Tab menu.
107 {
108  public:
110  virtual ~OP_OperatorFilter() { }
111 
112  /// Returns true if an operator type can be created as a child, and
113  /// false otherwise.
114  virtual bool allowOperatorAsChild(OP_Operator *op) { return true; }
115 
116  /// Returns true if an operator type should be listed in the Tab menu,
117  /// and false otherwise.
119  { return allowOperatorAsChild(op); }
120 
121  /// Returns true if a shelf tool by the given name can appear
122  /// in the Tab menu for that (parent) network.
123  virtual bool allowTool(const char *tool_name) { return true; }
124 
125  /// Returns true if a shelf tool by the given name can appear
126  /// in the Tab menu for that (parent) network.
127  virtual bool allowToolSubmenus(const UT_StringHolder &tool_name,
128  const UT_StringArray &submenus) { return allowTool(tool_name); }
129 };
130 
131 typedef void *(OP_Network::*OP_FindItemFunc) (const char *);
132 
134 {
135 public:
137  ~OP_NetworkOperatorFilter() override;
138 
139  bool allowOperatorAsChild(OP_Operator *op) override;
140  bool allowOperatorInTabMenu(OP_Operator *op) override;
141 
142  bool allowToolSubmenus(const UT_StringHolder &tool_name,
143  const UT_StringArray &submenus) override;
144 
145  void setFilter(const UT_StringHolder &filter);
146 private:
147  UT_StringHolder myFilterString;
148  UT_StringMMPattern myPattern;
149  bool myHasSlash;
150 };
151 
152 class OP_API OP_Network : public OP_Node
153 {
154 public:
155  static const char *getScriptFromTable(const char *table);
156  static const char *getOpTypeFromTable(const char *table);
157 
158  // Primary node access methods. Only take OP_Node's into consideration
159  int getNchildren() const override;
160  OP_Node *getChild(const char *name=nullptr,
161  int *hint=nullptr) const override;
162  OP_Node *getChild(int index) const override;
163  virtual int getChildIndex(const OP_Node *) const;
164 
165  // isNetwork returns if the node can have children. This is true
166  // if the node has an operator table or has any children.
167  // This does NOT tell you if it is derived from OP_Network.
168  int isNetwork() const override;
169 
170  int getDandROpsEqual() override;
171  int updateDandROpsEqual(int check_inputs = 1) override;
172 
173  // This method a node within the network's UT_ValArray of children
174  // dstindex can be any number between 0 and childcount + 1.
175  // dstindex refers to the index of the child before which the
176  // src node should be moved.
177  virtual void moveChildIndex(int srcindex, int dstindex);
178 
179  // These work the same as getOpType* but return what sort of ops
180  // this network usually has as children. Of course, there's
181  // always the chance of heterogenous ops skulking around in there
182  // so treat it as a guideline rather than an assertion.
183  virtual const char *getChildType() const;
184  virtual OP_OpTypeId getChildTypeID() const = 0;
185 
186  int getTemplateOps(UT_ValArray<OP_Node *> &list);
187 
188  // obtains the children that match a given operator name.
189  // INPUTS:
190  // op_name - the name of a operator to look for (e.g., "object_merge")
191  // OUTPUTS:
192  // list - the list of children that are instances of an operator
193  // that is identified by op_name
194  // RETURNS:
195  // number of children in the output list
196  int getOpsByName(const char *op_name,
197  UT_Array<OP_Node *> &list) const;
198 
199  OP_Node *peekCurrentNodePtr();
200  void stashCurrentNodePtr(const OP_Node *child);
201  OP_Node * getStashedCurrentNodePtr() const;
202 
203  virtual OP_Node *getCurrentNodePtr();
204  virtual OP_Node *getDisplayNodePtr();
205  virtual OP_Node *getRenderNodePtr();
206  virtual OP_Node *getExportNodePtr();
207  virtual CHOP_Node *getAudioNodePtr();
208  virtual OP_Node *getCop3DNodePtr(); // Export if present, else display
209  virtual const UT_ValArray<OP_Node *> &getOutputNodePtrs() const;
210 
211  virtual void childDeleted(OP_Node *);
212  virtual void childFlagChange(OP_Node *);
213 
214  fpreal getChildrenScale() const { return myChildScale; }
215  void setChildrenScale(fpreal scale);
216 
217  // Returns the OP_OperatorFilter object for this network. Used to
218  // filter out some OP_Operator types. See OP_OperatorFilter above.
219  virtual OP_OperatorFilter *getOperatorFilter();
220 
221  /// Obtains the namespace scope names for this network and for its parents,
222  /// all aranged in a stack array, with this network's name first in the
223  /// array, and the node hierarchy root (director) appearing last.
224  /// By convention, the scope name is the same as the network operator name
225  /// (with the table name).
226  void getNetworkScopeStack(UT_StringArray &scope_stack);
227 
228  /// Returns true if the given op can be created as a child of this network.
229  bool isOperatorAllowedAsChild(OP_Operator *op);
230 
231  /// Returns true if the given op can show up in the Tab menu.
232  virtual bool isOperatorAllowedInTabMenu(OP_Operator *op);
233 
234  /// Returns true if the given op can show up in the Tab menu.
235  bool isOperatorCreateAllowed(OP_Operator *op);
236 
237  /// Returns true if the given tool can appear in the Tab menu for this net.
238  bool isToolAllowed(const UT_StringHolder &tool_name,
239  const UT_StringArray &submenus);
240 
241  /// Adds a new OP_Node of the specified type as a child of this node.
242  /// If 'name' is not given, then it will use 'type' suffixed with a unique
243  /// numeric suffix. In either case, if the 'name' collides with a
244  /// pre-existing node, then the actual node will be created with a unique
245  /// name created by numeric suffixing.
246  /// @param exact_type If true, the operator name parameter 'type',
247  /// is used verbatim to lookup the operator. Otherwise,
248  /// a preferred operator name that matches 'type'
249  /// specification is found first and then is used to lookup
250  /// the operator. The preferred type may be different than
251  /// 'type' for version namespace (eg "hda"
252  /// may match the preferred "hda::2.0" operator), for
253  /// scope namespace (eg "hda" may match
254  /// "Object/outer::hda" inside "outer" subnet), or for
255  /// operator namespace (eg, "userX::hda" may be preferred
256  /// to "hda", if the namespace hierarchy is so configured
257  /// that "userX" namespace trumps the top level (global)
258  /// namespace).
259  OP_Node *createNode(
260  const char *type,
261  const char *name = nullptr,
262  int notify = 1,
263  int explicitly = 1,
264  int loadcontents = 1,
265  int *aliased_scripted_op = nullptr,
266  char *mat_icon_filename = nullptr,
267  bool exact_type = false);
268 
269  /// Convenience method for requesting en exact type
271  const char *name = nullptr)
272  {
273  return createNode(type, name, 1, 1, 1, nullptr,
274  nullptr, true);
275  }
276 
277  // Create dummy reference proxy nodes for dangling references
278  // This should only be called from OP_Node!
279  OP_Network *createProxyRefNode( const char *path ) override;
280 
281 
282  // Returns the list of nodes eligible to be considered for child
283  // errors.
285  OP_NodeList &nodes) const override;
286 
287  // Makes a copy of a single node inside this network. The source node does
288  // not need to be inside this network.
289  OP_Node *copyNode(const OP_Node *srcnode,
290  const char *toname = nullptr,
291  bool reference_parameters = false);
292 
293  // Makes a copy of any number of network items inside this network. The
294  // source items must all be contained in a single network, but it does
295  // not need to be this network.
296  bool copyItems(const OP_NetworkBoxItemList &srcitems,
297  OP_NetworkBoxItemList &destitems,
298  bool reference_parameters,
299  bool relative_references,
300  bool connect_outputs_to_multi_inputs);
301 
302  // Makes a copy of all picked network items into this network. The source
303  // network does not need to be this network.
304  void copyPickedItems(
305  const OP_Network *srcnet,
306  OP_ItemTypeMask item_type_mask,
307  OP_Group *newnodes = nullptr,
308  const OP_FixNameParms *fix_name_parms=nullptr);
309 
310  // Copy 'srcnetbox' and its contents to this network. 'toname' specifies
311  // the name you'd like the copy to have. If this name has already been
312  // taken in this network, we'll use a slightly altered unique version of
313  // it. 'nodes' may only be non-null when 'save_type' is
314  // OP_NETWORKBOX_SAVE_SPECIFIED_CONTENTS, in which case it must be a valid
315  // ptr array of nodes in 'netbox'.
316  OP_NetworkBox *copyNetworkBox(OP_NetworkBox *srcnetbox,
317  OP_NetworkBoxSaveType save_type,
318  OP_NodeList *nodes = nullptr,
319  const char *toname = nullptr,
320  bool reference_parameters = false);
321 
322  // Copy a single post-it note into this network. The source post-it does
323  // not need to be in this network.
324  OP_PostIt *copyPostItNote(OP_PostIt *src_note,
325  const char *toname = nullptr);
326 
327  // Makes a copy of all picked nodes into this network. The source network
328  // does not need to be this network.
329  void copyPickedNodes(const OP_Network *srcnet,
330  OP_Group *newnodes=nullptr,
331  const OP_FixNameParms *fix_name_parms=nullptr);
332 
333  // Moves the picked nodes from srcnet into this network.
334  // If src_nodes_ptr and dest_nodes_ptr are not null, they will be set
335  // to the original node pointers and the new node pointers. (The nodes
336  // in src_nodes_ptr will have been deleted.)
337  virtual bool movePickedNodes(OP_Network *src_net,
338  OP_NodeList *src_nodes_ptr=nullptr,
339  OP_NodeList *dest_nodes_ptr=nullptr);
340 
341  /// Returns true if it is safe at this time to destroy this node.
342  static bool canDestroyNode(OP_Node *node);
343 
344  int destroyNode(OP_Node *node);
345  int destroyNodes(const OP_NodeList &nodes);
346 
347  virtual int renameNode(OP_Node *node, const char *name,
349 
350  /// Obtains the CHOP network to store motion effects. If create is true,
351  /// then it will be created if it doesn't exist yet.
352  OP_Network *findOrCreateMotionEffectsNetwork(bool create=true);
353 
354  // Delete implicit ancestors. If included is true delete the initial given
355  // node as well. If a state name is passed in, check that the nodes were
356  // created by that state. The node is not deleted if any of its outputs do
357  // not match the given state. This function will have no effect on nodes
358  // not belonging to this network, or on subnetworks. The deletion will
359  // stop at the first invalid node (if keep_node points to anything, that
360  // node is invalid for deletion).
361  OP_Node *deleteImplicitAncestors(
362  OP_Node &node,
363  const char *state = nullptr,
364  OP_Node *keep_node = nullptr,
365  bool included = true);
366  // non-destructive version of deleteImplicitAncestors() that just returns
367  // the information.
368  OP_Node *getImplicitAncestors(
369  OP_NodeList &implicit_nodes,
370  OP_NodeList &border_nodes,
371  OP_Node &node,
372  const char *state = nullptr,
373  OP_Node *keep_node = nullptr,
374  bool included = true);
375 
376  // Fetch all channel collections from this node down.
377  int getAllCollections(UT_ValArray<CH_Collection *> &list,
378  int hide=0);
379 
380  /// Build a unique node name or a unique operator name from
381  /// the one given. We'll pretend we also have children with the names in
382  /// 'fakeChildren' when we do our name-collision checking if 'fakeChildren'
383  /// is non-NULL.
384  void uniqueNodeName(UT_String &name,
385  UT_StringSet *fake_children = nullptr);
386 
387  // This function is used to make some extra names invalid. Returns 0
388  // by default. Used by the VOPNET manager to prevent a new VOPNET
389  // with a name that matches an existing operator type.
390  virtual int isInvalidName(const char *name);
391 
392  static void fixName( const char *name,
393  const OP_FixNameParms &fix_name_parms,
394  UT_String &fixed_name );
395 
396  // I/O methods - there are also the save & load inherited from the
397  // OP_Node class.
398 
399  ///Save all picked items of the types specified by 'item_type'. Note that
400  ///saving any nodes or netboxes implicitly always saves indirect inputs if
401  ///they're picked (legacy behaviour). If 'item_type' includes netboxes, you
402  ///can specify the save policy for netboxes regarding how much of their
403  ///contents they should be saved along with themselves. This is the only way
404  ///for a node to remember which netbox it was in.
405  OP_ERROR savePickedItems(std::ostream &os,
406  const OP_SaveFlags &flags,
407  OP_ItemTypeMask item_type,
408  OP_NetworkBoxSaveType save_type =
410 
411  ///Save all items of the types specified by 'item_type'. Note that
412  ///saving any nodes or netboxes implicitly always saves indirect inputs if
413  ///they're picked or part of a picked netbox (legacy behaviour).
414  OP_ERROR saveAllItems(std::ostream &os,
415  const OP_SaveFlags &flags,
416  OP_ItemTypeMask item_type);
417 
418  // Saves a single node with the same save options on the child nodes
419  // as on the top level node, with the exception of network box membership
420  // for children (which should always be saved)
421  OP_ERROR saveSingle(std::ostream &os, OP_Node *op,
422  const OP_SaveFlags &flags,
423  const UT_String &name_override = UT_String());
424  // Saves a single node with different save options for the child nodes
425  // compared to the top level node.
426  OP_ERROR saveSingle(std::ostream &os, OP_Node *op,
427  const OP_SaveFlags &flags,
428  const OP_SaveFlags &childflags,
429  std::set<int>* renaming_exclude_ids = nullptr,
430  const UT_String &name_override = UT_String());
431 
432  ///Saves a single netbox. 'save_type' lets you specify the save policy
433  ///with regards to how much of its contents the network box saves with it.
434  ///'nodes' may only be non-null when 'save_type' is
435  ///OP_NETWORKBOX_SAVE_SPECIFIED_CONTENTS, in which case it must be a valid
436  ///ptr array of nodes in 'netbox'.
437  OP_ERROR saveSingleNetworkBox(std::ostream &os,
438  OP_NetworkBox &netbox,
439  const OP_SaveFlags &flags,
440  OP_NetworkBoxSaveType save_type,
441  OP_NodeList *nodes = nullptr);
442 
443  /// Save a single post it note.
444  OP_ERROR saveSinglePostIt(std::ostream &os, OP_PostIt &pnote,
445  const OP_SaveFlags &flags);
446 
447  /// Save a single dot.
448  OP_ERROR saveSingleDot(std::ostream &os, OP_Dot &dot,
449  const OP_SaveFlags &flags);
450 
451  ///In order to avoid duplicately saving nodes in 'op_list' that have already
452  ///been saved by their netboxes, make sure to mark those netboxes and then
453  ///pass in 'skip_nodes_in_marked_netboxes' as true.
454  OP_ERROR saveOpList(std::ostream &os,
455  const UT_Array<OP_Node *> &op_list,
456  const OP_SaveFlags &save_flags,
457  int *nsaved = nullptr);
458 
459  //Use when saving a mixture of different types of items into 1 file
460  OP_ERROR saveItemList(std::ostream &os,
461  const OP_NetworkBoxItemList &items,
462  const OP_SaveFlags &save_flags);
463 
464  const char *getClipboardFile(const char *file_prefix = nullptr);
465 
466  //Note that although we now have an OP_ItemTypeMask parameter available to
467  //us, we still need to keep the OP_TileType parameters to indicate saving
468  //of groups *boo*
469  int saveToClipboard(int all, OP_TileType type=OP_TILE_NODE,
470  int grouplist=0,
471  OP_ItemTypeMask item_type = OP_ITEMTYPE_NODE,
472  const char *file_prefix = nullptr);
473  int loadFromClipboard(fpreal x = 0, fpreal y = 0,
474  bool turn_off_display = false,
475  const char *file_prefix = nullptr);
476 
477  // loadNetwork will load nodes into the current net. For example,
478  // if there file is "foo.sops", you would call obj->loadNetwork().
479  // if the file were "foo.obj", you would call obj->getParent()->loadNetwork
480  bool loadNetwork(UT_IStream &is,
481  int merge = 0,
482  const char *pattern = nullptr,
483  int overwrite = 0,
484  const OP_FixNameParms *fix_name_parms = nullptr,
485  UT_StringArray *src_names = nullptr,
486  UT_StringArray *dest_names = nullptr);
487 
488  // Second signature for loadNetwork which takes an OP_OverwriteAction enum
489  // to control the overwrite behavior in a more granular way than the bool
490  // parameter offered in the method above.
491  bool loadIntoNetwork(UT_IStream &is,
493  bool merge = false,
494  const char *pattern = nullptr,
495  const OP_FixNameParms *fix_name_parms = nullptr,
496  UT_StringArray *src_names = nullptr,
497  UT_StringArray *dest_names = nullptr);
498 
499  bool pasteNetworkForMove(UT_IStream &is,
500  UT_StringArray &src_names,
501  UT_StringArray &dest_names);
502 
503  bool opShouldHandleChange(OP_EventType reason) override;
504 
505  static bool isOpWritten(UT_IStream &is);
506 
507  void clearUnreferencedInputs() override;
508 
509  /// Check a stream for collisions for loading... This will add the
510  /// problem nodes to 'node_list' and the problem network boxes to
511  /// 'netbox_list', and also return the total number of collisions found...
512  /// It rewinds the stream to the starting point, thus, it can't be used with
513  /// stdin! Remember that a node can collide with a network box, since they
514  /// share the same namespace!
515  int getLoadCollisions(UT_IStream &is, OP_NodeList &node_list,
516  UT_ValArray<OP_NetworkBox *> &netbox_list,
517  UT_ValArray<OP_PostIt *> &pnote_list,
518  const char *pattern = "*");
519 
520  /// Simulates adding items with the names in 'names' to this network, and
521  /// stores the resulting names after name-collisions have been addressed
522  /// back into 'names'. This works for anything sharing the node namespace,
523  /// which currently includes nodes and network boxes.
524  void simulateNameCollisions(UT_StringArray &names);
525 
526  // The getSortedList() returns an array of all the child nodes sorted
527  // alphabetically.
528  const UT_ValArray<OP_Node *> *getSortedList();
529 
530  // getAnyOutputOf will return the first OP found which is has the
531  // given OP as an input. Returns null if no such op exists.
532  OP_Node *getAnyOutputOf(OP_Node *op) const;
533 
534  // getAnyOP will return any OP in the collection.
535  // Null if there are none.
536  OP_Node *getAnyOP() const;
537 
538  // Group manipulation methods:
539  char *findUniqueGroupName(const char *basename=nullptr);
540  OP_Group * findGroup(const char *name) const;
541  OP_Group * createGroup(const char *name=nullptr);
542  int destroyGroup(const char *name);
543  int destroyGroup(OP_Group *group);
544 
545  int getNgroups() const;
546  OP_Group *getGroup(int index) const;
547  int getGroups(UT_ValArray<OP_Group *> &list, int internal=0);
548  int getMemberships(const OP_Node *node,
550  int internal=0);
551 
552  char *findUniqueNetworkBoxName(const char *base = nullptr);
553  char *findUniquePostItNoteName(const char *base = nullptr);
554  char *findUniqueDotName(const char *base = nullptr);
555 
556  /// Pass in NULL as the name if you'd like a default name. Passing in
557  /// 'items' will automatically create a network box containing those items
558  /// with the netbox positioned properly around them
559  OP_NetworkBox *createNetworkBox(const char *name,
560  OP_NetworkBoxItemList *items = nullptr);
561  int getNnetworkBoxes() const;
562  // Given a path, return the network box. The path may be relative.
563  OP_NetworkBox *findNetworkBox(const char *const_path) override;
564  // Unlike 'findNetworkBox()', these 2 methods only return netboxes
565  // contained directly in this network itself.
566  OP_NetworkBox *getNetworkBox(int index) const;
567  OP_NetworkBox *getNetworkBox(const char *name) const;
568 
569  /// Pass in NULL as the name if you'd like a default name.
570  OP_PostIt *createPostItNote(const char *name);
571  int getNpostItNotes() const;
572  // Given a path, return the post it note. The path may be relative.
573  OP_PostIt *findPostItNote(const char *const_path) override;
574  // Unlike 'findPostItNote()', these 2 methods only return postits
575  // contained directly in this network itself.
576  OP_PostIt *getPostItNote(int index) const;
577  OP_PostIt *getPostItNote(const char *name) const;
578 
579  // Dots are not meant to be referenced by name.
581  { return myDotList; }
582  int getNdots() const;
583  // Given a path, return the post it note. The path may be relative.
584  OP_Dot *findDot(const char *const_path) override;
585  OP_Dot *getDot(int index) const;
586  OP_Dot *getDot(const char *name) const;
587 
588  /// Return the number of items picked. 'item_type_mask' is a bit field used
589  /// to specify which item types you'd liked to include in the count. Use the
590  /// values in OP_ItemType to set the bits in 'item_type_mask'.
591  unsigned int nPicked(OP_ItemTypeMask item_type_mask,
592  bool include_hidden_nodes) const;
593 
594  /// Return all picked items of types specified by 'item_type_mask'.
595  /// Note that if only picked nodes are of interest, there is also
596  /// OP_Node::getPickedChildren().
597  void getPickedItems(OP_ItemTypeMask item_type_mask,
598  OP_NetworkBoxItemList &picked,
599  bool include_hidden = false,
600  bool recurse_picked_netboxes = false) const;
601 
602  /// Return all items that match the type mask.
603  void getAllItems(OP_ItemTypeMask item_type_mask,
604  OP_NetworkBoxItemList &items) const;
605 
606  /// Returns true if the item was successfully deleted
607  bool destroyItem(OP_NetworkBoxItem *item);
608  /// Returns the number of successfully deleted items
609  int destroyItems(const OP_NetworkBoxItemList &items);
610 
611  /// Same as findNode or findNetworkBox, but more generalized so you can
612  /// search through multiple items with just one method. 'item_type_mask' is
613  /// used to specify what type of items you want to consider in your search.
614  /// Does not support indirect parent input searches.
615  OP_NetworkBoxItem *findItem(const char *const_path,
616  OP_ItemTypeMask item_type = OP_ITEMTYPE_ALL
617  ) override;
618 
619  /// Look up a direct child item by name, with an option to screen based
620  /// on the item type. Like findItem above, but doesn't look into child
621  /// networks.
622  OP_NetworkBoxItem *getItem(const char *name,
623  OP_ItemTypeMask item_type = OP_ITEMTYPE_ALL);
624 
625  /// Returns true if the given node is a child descendant of the same
626  /// type with no intervening levels of different type.
627  bool isSubNode(const OP_Node *node) const;
628 
629  /// Try to avoid using this method, it only clears the selection for tiles,
630  /// not network boxes (network boxes are considered items but not tiles).
631  /// Can use setAllPickFlags() instead. In fact, since there are no group
632  /// tiles in the worksheet any more, this method has become somewhat useless
633  void clearSelection(OP_TileType t, int grouplist);
634 
635  ///Set the pick flags to 'value' for all items of types specified by
636  ///'item_type'
637  void setAllPickFlags(OP_ItemTypeMask item_type, int value);
638  void pickRequest(OP_NetworkBoxItem *item, int shift);
639  void pickRequest(int shift)
640  { OP_Node::pickRequest(shift); }
641 
642  void addPicked(const OP_Group *group); // Pick these nodes
643  void subPicked(const OP_Group *group); // Removed from picked
644 
645  // There are two versions of getOperatorTable. One that takes an
646  // operator type and returns the table for that type. The second
647  // returns the operator table associated with this network. This
648  // latter assumes that "setOperatorTable" has been called. All
649  // OP_Network sub-class constructors should do this:
650  //
651  // setOperatorTable(getOperatorTable(operatorType));
652  //
653  // If the script_path is NOT null, this method will create the
654  // operator table if it doesn't exist. Otherwise, it will return
655  // null for non-existant table names.
656  static OP_OperatorTable *getOperatorTable(
657  const UT_StringRef &op_type,
658  const char *script_path=nullptr);
660  { return myOperatorTable; }
661  virtual const char *getScriptDirectory();
662 
663  // this is overridden so that we can clear the group flags
664  void clearUndoFlags() override;
665 
666  // Sub-networks use parent inputs to connect open inputs in
667  // the net to inputs in the parent. A list of the parent connections
668  // is the bookeeping required to manage and resolve these connections.
669  bool wantsParentInputs() const;
670 
671  // Get all picked Parent Inputs
672  int getNparentInputs() const
673  { return myParentInputs.entries(); }
674  OP_SubnetIndirectInput *findParentInput(const char *const_path) override;
675  OP_SubnetIndirectInput *getParentInput(OP_InputIdx index) const;
676  OP_SubnetIndirectInput *getParentInput(const char *name) const;
677 
678  // getIndirectString returns a string that can be used to save
679  // parent inputs that refer to our parent input table.
680  // These are simply saved as a string index into our table.
681  // These can be resolved back using resolveIndirectString.
682  int getIndirectString(OP_IndirectInput *, UT_String &);
683  OP_IndirectInput *resolveIndirectString(const char *);
684 
685  void inputConnectChanged(OP_InputIdx which) override;
686 
687  void getAllConnectedChildren(
688  OP_InputIdx input_index, UT_Array<OP_Node*> &nodes,
689  bool expand_subnets = true) const;
690  void getAllConnectedChildrenNamed(
691  const OP_ConnectorId& input_name,
692  UT_Array<OP_Node*> &nodes,
693  bool expand_subnets = true) const;
694 
695  // The ViewSetting functions are used by ICE to store the name
696  // of the COP currently being viewed. Put here because COP2_SubNets
697  // and ICENET_Nodes both need to store this information.
698  virtual void setViewSetting(const char *) {};
699  virtual const char *getViewSetting() const { return ""; }
700 
701  void dumpDependencies(std::ostream &os) override;
702 
703  void changeParmTemplate(
704  PRM_Template *new_template) override;
705 
706  int getNumChildManagers(OP_OpTypeId type) const;
707  void addChildManager(OP_OpTypeId type);
708  void removeChildManager(OP_OpTypeId type);
709  bool getSaveWithVopnets() override;
710  void runDelScript() override;
711  void clearDelScripts(int picked_only);
712 
713  /// This method will unscope all the channels belonging to this op.
714  /// If the recurse flag is set it will recurse through the children
715  /// (at this level the recurse flag is ignored).
716  void unscopeChannels(bool recurse) override;
717 
718  /// This method will undisplay all the channels belonging to this op.
719  /// If the recurse flag is set it will recurse through the children
720  /// (at this level the recurse flag is ignored).
721  void undisplayChannels(bool recurse) override;
722 
723  /// This method will undisplay all the channels belonging to this op.
724  /// If the recurse flag is set it will recurse through the children
725  /// (at this level the recurse flag is ignored).
726  void unpinChannels(bool recurse) override;
727 
728  // Do global expansion on a pattern - get lists of network boxes
729  // If expand is given, concatenated with full list of names
730  // If list is given, appended with list of nodes.
731  void globNetworkBoxes(
732  const char *pat,
733  UT_String *expand,
734  UT_ValArray<OP_NetworkBox *> *list = nullptr,
735  OP_GlobContext *context = nullptr,
736  const char *prefix = " ") override;
737 
738  void globPostIts(
739  const char *pat, UT_String *expand,
740  UT_ValArray<OP_PostIt *> *list = nullptr,
741  OP_GlobContext *context = nullptr,
742  const char *prefix = " ") override;
743 
744  /// Returns the unique id of the representative operator that this network
745  /// may have. The changed_child parameter and the current_rep_id are used
746  /// in order to minimize the number of findSubNode() calls that are made.
747  int getRepresentativeNodeId(OP_Node *changed_child,
748  int current_rep_id);
749 
750  // Changes a child node's type from its current type to 'newtype'
751  // the keep... parameters will maintain the same name, pararmeter values
752  // and network contents if set to true.
753  bool changeChildNodeType(OP_Node *child,
754  const char *newtype,
755  bool keepname,
756  bool keepparms,
757  bool keepcontents,
758  bool quiet,
759  int *new_child_id = nullptr);
760 
761  // Returns true if the supplied node is specially marked as editable
762  // in this locked HDA node.
763  bool getIsSubNodeEditable(const OP_Node *subnode) const;
764  bool hasAnyEditableSubNodes() const;
766  { return myEditableSubNodes; }
767 
768  /// Builds the list of subnodes that are marked as message nodes.
769  /// Returns false if there are none (list.entries() == 0 then)
770  bool getMessageSubNodes(OP_NodeList &list) const;
771 
772  // Add any OTL-defined operators used by this network to the specified
773  // table.
775  UT_Set<OP_Operator *> &active_operators
776  ) const override;
777 
778  // Save a packet containing the fallback library paths for the specified
779  // operators.
780  static void saveOTLBackupInformation(std::ostream &os,
781  const OP_OperatorList &fallbackops,
782  const OP_OperatorList &dummyops);
783 
784  static void saveFallbacksPathsFor(
785  std::ostream &os,
786  const UT_Set<OP_Operator *> &otloptable);
787 
788  OP_SubnetIndirectInput *getNamedParentInput(
789  const OP_ConnectorId& name) const;
791  { return myIsClearingContentsOfEditableSubnodes; }
792 
793  int64 getMemoryUsage(bool inclusive) const override;
794 
795  static bool warnDeprecatedOpsOnLoad()
796  { return theWarnDeprecatedOpsOnLoad; }
797  static void setWarnDeprecatedOpsOnLoad(bool enable)
798  { theWarnDeprecatedOpsOnLoad = enable; }
799 
800  void setCachedMimeFile(const char *filename);
801  const char *getCachedMimeFile() const;
802  void clearCachedMimeFile();
803  bool hasCachedMimeFile() const;
804 
805  OP_ERROR getErrorSeverity() override;
806  void getRawErrors(UT_Array<UT_Error> &errors,
807  bool update) override;
808 
809 protected:
810  // Protected constructor since networks are only created by Operators.
811  OP_Network(OP_Network *parent, const char *name, OP_Operator *op);
812  ~OP_Network() override;
813 
814  void clearAndDestroy() override;
815  void clearAndDestroyNodes();
816 
818  OP_Node *by_whom,
819  OP_EventType reason,
820  int parm_index,
821  OP_PropagateData &prop_data) override;
822 
823  // new method for dependencies: use the PRM_TYPE_OP_REF_*
824  // in your parm template to add your dependency.
825  // override this to do special cases, make sure you call the base class
826  void buildOpDependencies() override;
828  const UT_String &full_from,
829  OP_NodeList &cook_nodes) override;
831  const UT_String &full_from,
832  OP_NodeList &cook_nodes) override;
833  void rebuildOpDependents( bool proxy_only ) override;
834 
835  // clone dependencies from the proxy. proxy is no longer valid
836  // after the clone!
837  void cloneFromProxyRefNode( OP_Network *proxy ) override;
838  // clone a new proxy node. this node is no longer valid after this!
839  OP_Network * cloneToProxyRefNode() override;
840  int hasProxyRefNodes() const override
841  { return myProxyRefNodes.entries() > 0; }
842  void removeProxyRefNode( OP_Network *proxy );
843  void moveProxyRefNodes( OP_Network *dest ) override;
844 
845  void moveDependencies( OP_Node *from_node ) override;
846 
847  // Override of OP_Node::load to handle some network-specific packets.
848  bool load(UT_IStream &is,
849  const char *ext = "",
850  const char *path = nullptr) override;
851 
852  /// Called upon entering and exiting loadNetwork() method
853  virtual void beginLoadingInNetwork();
854  virtual void endLoadingInNetwork();
855 
856  // Called at the end of loadChildOrder()
857  virtual void finishedLoadingChildOrder();
858 
859  // Called when loadNetwork finishes loading this whole network.
860  // Do not set `is_child_call`. That argument is set internally to
861  // true when finishedLoadingNetwork() is called on the node's children.
862  virtual void finishedLoadingNetwork(bool is_child_call=false);
863 
864 public:
865  /// Returns the current recursion depth of syncContents, note this is
866  /// NOT thread safe.
867  static int syncContentsLevel();
868 
869 protected:
870  // This overrides the OP_Node function.
871  // syncContents loads the given stream into this operator.
872  // The stream should be in .hip file format, with "this" pointing to
873  // the root node in the .hip file. It handles collisions gracefully
874  // by updating the existing operators instead of deleting and
875  // recreating them. It deletes any existing nodes not in the
876  // stream, and creates nodes if necessary.
877  bool syncContents(UT_IStream &is) override;
878 
879  // The following should only be called by the director, who doesn't have
880  // a real choice, does he?
881  virtual void addNode(OP_Node *node, int notify=1, int explicitly=1);
882 
883  OP_Node *findConnectedNode(OP_Node *op) const;
884 
885  // These functions ensure we have valid render and display nodes.
886  OP_Node *getPreferredDisplayNodePtr(OP_Node *skipthisnode)const;
887  void resetDisplayNodePtr(OP_Node *skipthisnode=nullptr);
888  OP_Node *getPreferredRenderNodePtr(OP_Node *skipthisnode) const;
889  void resetRenderNodePtr(OP_Node *skipthisnode=nullptr);
890  OP_Node *getPreferredAudioNodePtr(OP_Node *skipthisnode) const;
891  void resetAudioNodePtr(OP_Node *skipthisnode=nullptr);
892  virtual CHOP_Node **getAudioNodeRef();
893 
894  // This function calls all of the above, for when we are deleting nodes.
895  void validateStatusNodePtrs(const OP_NodeList &skipnodes);
896 
897  virtual void updateExtraFlagPtrs();
898 
899  void nodeUnlocked() override;
900 
901  bool canDestroyNode() override;
902  virtual void destroySingleNode(OP_Node *node);
903 
904  // This function goes recursively through every node below this one and
905  // renames it to some unique but meaningless value. This is used for
906  // compiling networks.
907  void modifyAllChildNodeNames(bool renamepickableobjects,
908  const char *prefix, int &id,
909  std::set<int>* renaming_exclude_ids = nullptr);
910 
911  /// This is a helper method to the setChannelScope method. It traverses
912  /// the node's parameters and sets the scope on them according to the
913  /// given pattern.
914  /// This method is also defined in OP_Parameters, it is overridden here
915  /// to provide parsing support for network paths.
916  void traverseScope(const char *pattern,
917  OP_ScopeOp scope_op,
918  const OP_ScopeOptions &scope_opts) override;
919 
920 
926 
927  // Implemented in VOPs. Only the new nodes are to be inserted into the out
928  // list, not any of the existing ones.
929  virtual void getAdditionalUndoNodes(const OP_NodeList& orig_list,
930  OP_NodeList& nodes_for_input_undo) { }
931 
932  /// Returns true if the child at node can should be saved, false otherwise.
933  virtual bool getAllowSavingChild(OP_Node *node,
934  const OP_SaveFlags &flags)
935  { return true; }
936 
937 private:
938  // Some helper functions for loading and saving.
939  OP_ERROR saveNetwork(std::ostream &os, const OP_SaveFlags &flags,
940  const OP_SaveFlags &childflags,
941  const char *path_prefix, bool vopnets);
942  OP_ERROR saveChildNodes(std::ostream &os, const OP_SaveFlags &flags,
943  const char *path_prefix, bool vopnets,
944  bool force_no_init = false);
945  OP_ERROR saveOp(std::ostream &os, OP_Node *node,
946  const OP_SaveFlags &flags,
947  const OP_SaveFlags &childflags, const char *path_prefix,
948  bool vopnets, bool force_no_init = false,
949  const UT_StringHolder &name_override = UT_StringHolder());
950  OP_ERROR savePostIt(std::ostream &os, OP_PostIt *pnote,
951  const OP_SaveFlags &flags,
952  const char *path_prefix);
953  bool loadNodeType(UT_IStream &is, OP_Network *net,
954  UT_String &node_type, int &matches);
955  bool loadOp(UT_IStream &is,
956  OP_OverwriteAction overwrite,
957  const char *path,
958  op_PathSet &noneditable_missing_table);
959 
960  ///Save out all the netboxes in this network to 'os' in separate packets
961  OP_ERROR saveNetworkBoxes(std::ostream &os, const OP_SaveFlags &flags,
962  const char *path_prefix);
963  OP_ERROR savePostIts(std::ostream &os, const OP_SaveFlags &flags,
964  const char *path_prefix);
965  OP_ERROR saveDots(std::ostream &os, const OP_SaveFlags &flags,
966  const char *path_prefix);
967 
968  /// Load a network box from 'is'. Can load from both .hip files and the
969  /// clipboard. 'path' is used as the new netbox's name. If 'overwrite' is
970  /// specified, the new netbox will overwrite any other netboxes in this
971  /// network with the same name, rather than modify its name to be unique.
972  /// 'created' is used to return a ptr to the new network box.
973  bool loadNetworkBox(UT_IStream &is, const char *path = "",
974  bool path_contains_network = true,
975  bool path_contains_packet_ext = true,
977  OP_NetworkBox **created = nullptr);
978 
979  /// Load a post-it note from 'is'. Can load from both .hip files and the
980  /// clipboard. 'path' is used as the new post-it's name. If 'overwrite' is
981  /// specified, the new post-it will overwrite any other post-its in this
982  /// network with the same name, rather than modify its name to be unique.
983  /// 'created' is used to return a ptr to the new post-it.
984  bool loadPostIt(UT_IStream &is, const char *path = "",
985  bool path_contains_network = true,
986  bool path_contains_packet_ext = true,
988  OP_PostIt **created = nullptr);
989 
990  /// Load a network dot from 'is'. Can load from both .hip files and the
991  /// clipboard. 'path' is used as the new dot's name. If 'overwrite' is
992  /// specified, the new dot will overwrite any other dots in this
993  /// network with the same name, rather than modify its name to be unique.
994  /// 'created' is used to return a ptr to the new post-it.
995  bool loadDot(UT_IStream &is, const char *path = "",
996  bool path_contains_network = true,
997  bool path_contains_packet_ext = true,
999  OP_Dot **created = nullptr);
1000 
1001  // Some special handling for items loaded into a network due to copy/paste
1002  // or undo/redo. We need to register these items with an OP_UndoLoad, and
1003  // we may want to pick them.
1004  void beginPickLoaded(bool pick_loaded);
1005  void beginLoadUndo(OP_Node *save_ops[4]);
1006  void itemLoaded(OP_NetworkBoxItem *item);
1007  void endLoadUndo(OP_Node *save_ops[4]);
1008  void endPickLoaded();
1009 
1010  // Some helper functions for syncContents.
1011  bool syncContentsInit(UT_IStream &is,
1012  OP_Network *net, OP_Node *node,
1013  UT_String &node_name, OP_Node *&newnode,
1014  bool &match_definition_failure,
1015  const char *packet_node_path);
1016  // Helper method to clear the netboxes/post-its from any subnodes of the
1017  // given network whose netboxes may be saved to *this network's contents
1018  // section without a preceding .init packet for that subnode.
1019  void syncContentsClearNetboxesFromNonInitSubNodes(OP_Network *net);
1020  // Helper method to clear the contents of any editable subnodes which will
1021  // be loaded from the hip file or a parent asset's contents.
1022  void clearContentsOfEditableSubNodes();
1023  // Helper method to determine if an ancestor is an instance of a particular
1024  // operator currently loading its contents section.
1025  bool isLoadingContentsSection(OP_Operator *op) const;
1026 
1027  void setDoMergeFlag( bool flag ) { myDoMerge = flag; }
1028 
1029  // These functions perform operations that are required after loading
1030  // a number of new operators. Used by loadNetwork and syncContents.
1031  void resolveNetworkBoxOwnership();
1032  void initSpecialNodes(OP_NodeList &loaded_ops);
1033  void initNodeConnectors(OP_NodeList &loaded_ops);
1034  void sendBulkNotifications(const OP_NodeList &loaded_ops,
1035  const OP_NodeList &op_roots,
1036  bool builddependencies,
1037  bool notify_name_dependents);
1038  void fixPendingOverride();
1039 
1040  int savePartialVerify(std::ostream &os);
1041  void createParentInputs();
1042 
1043  // Build a list of item roots from the stream. In English, this means that
1044  // 'item_roots' will be populated with the paths of all items at the top
1045  // level of this load. Initial stream position is unchanged.
1046  bool buildItemRoots(UT_IStream &is, const char *merge_pattern,
1047  UT_StringArray &item_roots);
1048 
1049  // Destroys all child nodes except those that appear in the supplied
1050  // list (and their parents). Traverses into writable child nodes too.
1051  // Returns the number of descendants found in nodes.
1052  void destroyAllNodesExcept(const UT_Set<OP_Node *> &nodes);
1053 
1054  // Then after the list is made, we go through and rename the original
1055  // items so there won't be any collisions on loading
1056  void prepareCollisionNames(const OP_NetworkBoxItemList &items,
1057  UT_WorkBuffer &prefix);
1058  // Then, after the load, we go through and rename the items to their
1059  // original status (renaming the collisions along the way)
1060  void fixLoadInputs(); // Resolves references of nodes
1061  void fixLoadNames(const OP_NetworkBoxItemList &items,
1062  UT_WorkBuffer &prefix,
1063  const OP_FixNameParms *fix_name_parms,
1064  UT_StringArray *dest_names);
1065 
1066  int groupCount() const; // Doesn't count internal groups.
1067  OP_ERROR saveGroupList(std::ostream &os, int binary = 0);
1068  bool loadGroupList(UT_IStream &is, const char *path="");
1069  OP_ERROR saveParentInputs(std::ostream &os, int picked= 0);
1070  bool loadParentInputs(UT_IStream &is, const char *path = "");
1071  OP_ERROR saveNetworkData(std::ostream &os, int binary = 0,
1072  int picked= 0);
1073  bool loadNetworkData(UT_IStream &is, const char *path = "");
1074  OP_ERROR saveChildOrder(std::ostream &os, const OP_SaveFlags &flags);
1075  bool loadChildOrder(UT_IStream &is);
1076  OP_ERROR saveCompiledSection(std::ostream &os, int binary = 0,
1077  int picked= 0);
1078  bool loadCompiledSection(UT_IStream &is, const char *path = "");
1079 
1080  // these should surround saving of ops within a network.
1081  void prepareOpSave(std::ostream &os, const OP_SaveFlags &flags,
1082  int &nsaved, int &write_trailer);
1083  void cleanupOpSave(std::ostream &os, const OP_SaveFlags &flags,
1084  int &nsaved, int &write_trailer);
1085 
1086  // A helper function for findUniqueGroupName and findUniqueNetworkBoxName
1087  // and findUniqueDotName which takes the "does this item exist" function as
1088  // a parameter
1089  char *findUniqueName(const char *base, OP_FindItemFunc find);
1090 
1091  void changeNodeIdFromLoad(OP_Node &node, int new_id);
1092  void invokeFinishLoadingNetwork(OP_NodeList& op_roots);
1093 
1094  bool verifyParents();
1095  static bool verifyAllParents();
1096 
1097  void setOperatorTable(OP_OperatorTable *table);
1098 
1099  UT_SymbolMap<OP_Node *> mySymbols;
1101  UT_ValArray<OP_Network *> myProxyRefNodes;
1102  UT_ValArray<OP_Node *> mySortedList;
1103  UT_ValArray<OP_SubnetIndirectInput*> myParentInputs;
1104  OP_GroupList myGroups;
1105  OP_NetworkBoxList myNetworkBoxes;
1106  OP_PostItNoteList myPostItNotes;
1107  OP_DotList myDotList;
1108  OP_OperatorTable *myOperatorTable;
1109  OP_Node *myLastLoadedOpPtr;
1110  OP_NetworkBox *myLastLoadedNetworkBox;
1111  OP_PostIt *myLastLoadedPostIt;
1112  OP_Dot *myLastLoadedDot;
1113  OP_Node *myCreatedNode;
1114  UT_SortedSet<int> myEditableSubNodes;
1115  OP_UndoLoad *myUndoLoad;
1116  bool myPickLoaded;
1117 
1118  fpreal myChildScale;
1119  int myDandRCounter;
1120  short myDandROpsEqual;
1121  char myNameSortDirty;
1122  char myOpLoadedFlag;
1123  bool myDoMerge;
1124  UT_StringHolder mySkipBadNodePath;
1125 
1126  OP_InputIdx myLastInputChanged;
1127  int myChildManagerCount[NUM_MANAGERS];
1128  int myStashedCurrentNodeId;
1129  bool myIsClearingContentsOfEditableSubnodes;
1130  UT_StringHolder myCachedMimeFile;
1131 
1132  OP_NetworkOperatorFilter myNetworkFilter;
1133 
1134  static bool theWarnDeprecatedOpsOnLoad;
1135 
1136  friend class OP_Director;
1137  friend class MOT_Director;
1138 };
1139 
1141 
1142 /// Safe reference to an OP node
1144 {
1145 public:
1147  OP_NetworkId(const OP_Network *node) { *this = node; }
1148  OP_NetworkId(const OP_NetworkId &id) { myId = id.myId; }
1149 
1150  bool isValid() const
1151  {
1152  const OP_Node *node = OP_Node::lookupNode(myId);
1153  return (node && node->isNetwork());
1154  }
1155 
1157  {
1158  OP_Node *node = OP_Node::lookupNode(myId);
1159  if(node && node->isNetwork())
1160  return static_cast<OP_Network *>(node);
1161  return nullptr;
1162  }
1163  const OP_Network *ptr() const
1164  {
1165  const OP_Node *node = OP_Node::lookupNode(myId);
1166  if(node && node->isNetwork())
1167  return static_cast<const OP_Network *>(node);
1168  return nullptr;
1169  }
1171  {
1172  OP_Node *node = OP_Node::lookupNode(myId);
1173  if(node && node->isNetwork())
1174  return static_cast<OP_Network *>(node);
1175  return nullptr;
1176  }
1177  void clear() { myId = OP_INVALID_NODE_ID; }
1178 
1179  void operator=(const OP_Network *net)
1180  {
1181  myId = net ? net->getUniqueId() : OP_INVALID_NODE_ID;
1182  }
1183  bool operator==(const OP_Network *net) const
1184  {
1185  const int id = net ? net->getUniqueId() : OP_INVALID_NODE_ID;
1186  return id == myId;
1187  }
1188  bool operator!=(const OP_Network *net) const
1189  {
1190  const int id = net ? net->getUniqueId() : OP_INVALID_NODE_ID;
1191  return id != myId;
1192  }
1193  bool operator==(const OP_Node *node) const
1194  {
1195  const int id = node ? node->getUniqueId() : OP_INVALID_NODE_ID;
1196  return id == myId;
1197  }
1198  bool operator!=(const OP_Node *node) const
1199  {
1200  const int id = node ? node->getUniqueId() : OP_INVALID_NODE_ID;
1201  return id != myId;
1202  }
1203  void setId(int id) { myId = id; }
1204 private:
1205  int myId;
1206 };
1207 
1208 #endif
1209 
UT_ValArray< OP_Node * > myOutputNodes
Definition: OP_Network.h:925
bool isValid() const
Definition: OP_Network.h:1150
int getUniqueId() const
Definition: OP_Node.h:750
virtual bool allowOperatorInTabMenu(OP_Operator *op)
Definition: OP_Network.h:118
OP_TileType
Definition: OP_Network.h:54
GLbitfield flags
Definition: glcorearb.h:1596
UT_String suffixReplaceStr
Definition: OP_Network.h:94
Definition: UT_Set.h:58
virtual void moveProxyRefNodes(OP_Network *)
Definition: OP_Node.h:3570
virtual void globNetworkBoxes(const char *pat, UT_String *expand, UT_ValArray< OP_NetworkBox * > *list=nullptr, OP_GlobContext *glob_context=nullptr, const char *prefix=" ")
GT_API const UT_StringHolder filename
myNodes
Definition: UT_RTreeImpl.h:708
virtual void traverseScope(const char *pattern, OP_ScopeOp scope_op, const OP_ScopeOptions &scope_options)
Safe reference to an OP node.
Definition: OP_Network.h:1143
void operator=(const OP_Network *net)
Definition: OP_Network.h:1179
int getNparentInputs() const
Definition: OP_Network.h:672
virtual void clearAndDestroy()
virtual void cloneFromProxyRefNode(OP_Network *proxy)
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
virtual OP_Node * getChild(const char *name, int *hint=nullptr) const
GLsizei const GLfloat * value
Definition: glcorearb.h:824
virtual bool canDestroyNode()
Return true if it is safe at this time to destroy this node.
OP_OperatorTable * getOperatorTable() const
Definition: OP_Network.h:659
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int OP_InputIdx
Definition: OP_DataTypes.h:184
OP_NetworkId(const OP_Network *node)
Definition: OP_Network.h:1147
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual const char * getViewSetting() const
Definition: OP_Network.h:699
virtual bool load(UT_IStream &is, const char *ext="", const char *path=nullptr)
void buildOpDependencies() override
GLint y
Definition: glcorearb.h:103
virtual OP_Network * cloneToProxyRefNode()
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2138
virtual void nodeUnlocked()
Definition: OP_Node.h:3706
bool operator!=(const OP_Node *node) const
Definition: OP_Network.h:1198
void setId(int id)
Definition: OP_Network.h:1203
#define OP_INVALID_NODE_ID
Definition: OP_ItemId.h:24
virtual void runDelScript()
bool operator!=(const OP_Network *net) const
Definition: OP_Network.h:1188
fpreal getChildrenScale() const
Definition: OP_Network.h:214
OP_NetworkBoxSaveType
Definition: OP_NetworkBox.h:40
int64 getMemoryUsage(bool inclusive) const override
virtual void inputConnectChanged(OP_InputIdx which)
bool operator==(const OP_Node *node) const
Definition: OP_Network.h:1193
OP_Node * myDisplayNodePtr
Definition: OP_Network.h:922
SIM_API const UT_StringHolder all
virtual bool getAllowSavingChild(OP_Node *node, const OP_SaveFlags &flags)
Returns true if the child at node can should be saved, false otherwise.
Definition: OP_Network.h:933
virtual int propagateModification(OP_Node *by_whom, OP_EventType reason, int parm_index, OP_PropagateData &prop_data)
void notifyRenameDependents(const UT_String &full_from)
virtual OP_PostIt * findPostItNote(const char *const_path)
Definition: OP_Node.h:905
virtual void globPostIts(const char *pat, UT_String *expand, UT_ValArray< OP_PostIt * > *list=nullptr, OP_GlobContext *glob_context=nullptr, const char *prefix=" ")
GA_API const UT_StringHolder scale
virtual ~OP_OperatorFilter()
Definition: OP_Network.h:110
virtual bool allowTool(const char *tool_name)
Definition: OP_Network.h:123
static bool warnDeprecatedOpsOnLoad()
Definition: OP_Network.h:795
virtual int isNetwork() const
int hasProxyRefNodes() const override
Definition: OP_Network.h:840
virtual int getNchildren() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
OP_NetworkId(const OP_NetworkId &id)
Definition: OP_Network.h:1148
virtual void unpinChannels(bool recurse)
UT_SymbolMap< OP_OperatorTable * > OP_OperatorTableMap
Definition: OP_Network.h:50
OP_DotList & getDotList()
Definition: OP_Network.h:580
UT_String prefixReplaceStr
Definition: OP_Network.h:91
virtual OP_Network * createProxyRefNode(const char *path)
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
Definition: CE_Vector.h:137
virtual OP_ERROR getErrorSeverity()
virtual void setViewSetting(const char *)
Definition: OP_Network.h:698
static void setWarnDeprecatedOpsOnLoad(bool enable)
Definition: OP_Network.h:797
void notifyRenameReferences(const UT_String &full_from)
OP_Node * createNodeOfExactType(const char *type, const char *name=nullptr)
Convenience method for requesting en exact type.
Definition: OP_Network.h:270
long long int64
Definition: SYS_Types.h:116
GLuint id
Definition: glcorearb.h:655
OP_OpTypeId
Definition: OP_OpTypeId.h:18
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: OP_Dot.h:24
virtual OP_NetworkBoxItem * findItem(const char *const_path, OP_ItemTypeMask item_type=OP_ITEMTYPE_ALL)
Definition: OP_Node.h:911
GLushort pattern
Definition: glad.h:2583
bool getIsClearingContentsOfEditableSubnodes()
Definition: OP_Network.h:790
virtual void undisplayChannels(bool recurse)
GLint GLenum GLint x
Definition: glcorearb.h:409
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
bool operator==(const OP_Network *net) const
Definition: OP_Network.h:1183
OP_Node * myRenderNodePtr
Definition: OP_Network.h:921
void pickRequest(int shift)
GLdouble t
Definition: glad.h:2397
virtual bool allowOperatorAsChild(OP_Operator *op)
Definition: OP_Network.h:114
int removeTrailingDigits
Definition: OP_Network.h:96
friend class OP_Network
Definition: OP_Node.h:4191
const UT_SortedSet< int > & getEditableSubNodes() const
Definition: OP_Network.h:765
OP_OverwriteAction
Definition: OP_DataTypes.h:286
OP_Network * operator->() const
Definition: OP_Network.h:1170
void pickRequest(int shift)
Definition: OP_Network.h:639
void *(OP_Network::* OP_FindItemFunc)(const char *)
Definition: OP_Network.h:131
virtual void changeParmTemplate(PRM_Template *new_template)
unsigned int OP_ItemTypeMask
Definition: OP_ItemId.h:43
Create an evaluation context scope with a new node.
Definition: OP_Director.h:71
virtual void rebuildOpDependents(bool proxy_only)
virtual bool syncContents(UT_IStream &is)
virtual bool allowToolSubmenus(const UT_StringHolder &tool_name, const UT_StringArray &submenus)
Definition: OP_Network.h:127
virtual void unscopeChannels(bool recurse)
virtual void dumpDependencies(std::ostream &os)
fpreal64 fpreal
Definition: SYS_Types.h:278
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:786
virtual void getPotentialChildErrorNodes(OP_NodeList &nodes) const
virtual int getDandROpsEqual()
Definition: OP_Node.h:846
OP_EventType
Definition: OP_Value.h:22
virtual void getActiveOperatorsDefinedByOTL(UT_Set< OP_Operator * > &active_operators) const
static OP_Node * lookupNode(int unique_id, bool include_proxy=false)
Definition: OP_Node.h:734
virtual bool getSaveWithVopnets()
void clearUndoFlags() override
virtual int updateDandROpsEqual(int=1)
Definition: OP_Node.h:849
const OP_Network * ptr() const
Definition: OP_Network.h:1163
virtual bool opShouldHandleChange(OP_EventType reason)
OutGridT XformOp bool bool MergePolicy merge
virtual void getAdditionalUndoNodes(const OP_NodeList &orig_list, OP_NodeList &nodes_for_input_undo)
Definition: OP_Network.h:929
virtual void moveDependencies(OP_Node *from_node)
virtual void getRawErrors(UT_Array< UT_Error > &errors, bool update)
virtual OP_SubnetIndirectInput * findParentInput(const char *const_path)
Definition: OP_Node.h:909
OP_ScopeOp
Definition: OP_Parameters.h:58
virtual OP_NetworkBox * findNetworkBox(const char *name)
Definition: OP_Node.h:903
OP_Network * ptr()
Definition: OP_Network.h:1156
OP_RenameAction
Definition: OP_Network.h:70
UT_String suffixStr
Definition: OP_Network.h:95
state
Definition: core.h:2289
OP_API const OP_OperatorTableMap & OPgetGlobalOperatorTables()
void clear()
Definition: OP_Network.h:1177
bool myExportNodeDirty
Definition: OP_Network.h:923
virtual void clearUnreferencedInputs()
Definition: OP_PostIt.h:42
OP_Node * myExportNodePtr
Definition: OP_Network.h:924
virtual OP_Dot * findDot(const char *const_path)
Definition: OP_Node.h:907
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
UT_String prefixStr
Definition: OP_Network.h:92