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