HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Node.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OP Library (C++)
7  *
8  * COMMENTS: The base class for all OP operators
9  *
10  */
11 
12 #ifndef __OP_Node_h__
13 #define __OP_Node_h__
14 
15 #include "OP_API.h"
16 #include "OP_BundleReferences.h"
17 #include "OP_Cache.h"
18 #include "OP_ConnectorId.h"
19 #include "OP_Context.h"
20 #include "OP_DataMicroNode.h"
21 #include "OP_DataTypes.h"
22 #include "OP_Dependency.h"
23 #include "OP_Error.h"
24 #include "OP_EventMicroNode.h"
25 #include "OP_InterestRef.h"
26 #include "OP_ItemId.h"
27 #include "OP_Lock.h"
28 #include "OP_NetworkBoxItem.h"
29 #include "OP_NodeFlags.h"
30 #include "OP_OpTypeId.h"
31 #include "OP_OTLLicenseType.h"
32 #include "OP_Parameters.h"
33 #include "OP_Value.h"
34 #include "OP_Version.h"
35 
36 #include <CH/CH_EventManager.h>
37 #include <CH/CH_Types.h>
38 #include <EXPR/EXPR_Lock.h>
39 #include <DEP/DEP_MicroNode.h>
40 #include <PY/PY_Result.h>
41 #include <UT/UT_Algorithm.h>
42 #include <UT/UT_Array.h>
43 #include <UT/UT_ArrayMap.h>
44 #include <UT/UT_Assert.h>
45 #include <UT/UT_BitArray.h>
46 #include <UT/UT_BoundingBox.h>
47 #include <UT/UT_Color.h>
48 #include <UT/UT_Error.h>
49 #include <UT/UT_LockedRawPtr.h>
50 #include <UT/UT_Matrix4.h>
51 #include <UT/UT_Options.h>
52 #include <UT/UT_PathSearch.h>
53 #include <UT/UT_SharedPtr.h>
54 #include <UT/UT_SmallArray.h>
55 #include <UT/UT_String.h>
56 #include <UT/UT_StringHolder.h>
57 #include <UT/UT_StringMap.h>
58 #include <UT/UT_StringView.h>
59 #include <UT/UT_SymbolTable.h>
60 #include <UT/UT_TaskState.h>
61 #include <UT/UT_TokenString.h>
62 #include <UT/UT_UniquePtr.h>
63 #include <UT/UT_ValArray.h>
64 #include <UT/UT_Vector3.h>
65 #include <UT/UT_VectorTypes.h>
66 #include <UT/UT_XformOrder.h>
67 #include <SYS/SYS_AtomicInt.h>
68 #include <SYS/SYS_Deprecated.h>
69 #include <SYS/SYS_Math.h>
70 #include <SYS/SYS_Types.h>
71 
72 #include <iosfwd>
73 #include <utility>
74 #include <limits.h>
75 #include <string.h>
76 
77 class UT_InfoTree;
78 class UT_IStream;
79 class UT_Ramp;
80 class UT_StringArray;
81 class UT_Undo;
82 class UT_WorkArgs;
83 class UT_WorkBuffer;
85 class IMG_Raster;
86 class PY_CompiledCode;
88 class PY_OpaqueObject;
89 class DD_Source;
90 class DD_ChoiceList;
91 class CL_Clip;
92 class CL_Track;
93 class CMD_Args;
94 class CH_Channel;
95 class CH_ChannelRef;
96 class CH_LocalVariable;
97 class PRM_BatchList;
98 class PRM_Name;
99 class PRM_Parm;
100 class PRM_ParmList;
101 class PRM_ParmMicroNode;
102 class PRM_RefId;
103 class PRM_Template;
104 class OP_Bundle;
105 class OP_DopParent;
106 class OP_Dot;
107 class OP_EditorContext;
108 class OP_GalleryEntry;
109 class OP_GlobContext;
110 class OP_Group;
111 class OP_IndirectInput;
112 class OP_Input;
113 class OP_Network;
114 class OP_NetworkBox;
115 class OP_Node;
116 class OP_NodeInfoParms;
118 class OP_Operator;
119 class OP_Output;
120 class OP_OutputCodeParms;
121 class OP_PostIt;
122 class OP_PreDefRules;
123 class OP_PropagateData;
124 class OP_SaveFlags;
126 class DOP_Parent;
127 class VOP_CodeGenerator;
130 
131 // avoid lengthy compilation dependency
133 
134 typedef int (*OP_EditCallback)(void *data, OP_Node *src,
135  CL_Track *track, fpreal t, fpreal value);
136 
140 
142 {
144  : myInput(p), myName(n) {}
147 };
148 
150 {
152  : myOutput(p), myName(n) {}
155 };
156 
158 {
159  OP_NodeParmRef(const OP_Node *eval_node = 0,
160  const PRM_Parm *parm_ref = 0,
161  int vi = -1)
162  : myEvalNode(eval_node)
163  , myParmRef(parm_ref)
164  , myVectorIndex(vi)
165  {
166  }
167 
168  bool operator==(const OP_NodeParmRef &other)
169  {
170  return (myEvalNode == other.myEvalNode
171  && myParmRef == other.myParmRef
172  && myVectorIndex == other.myVectorIndex);
173  }
174 
175  const OP_Node * myEvalNode; // node evaluating the given parameter
176  const PRM_Parm * myParmRef; // pointer to evaluated parameter
177  int myVectorIndex; // parameter component index
178 };
179 
181 {
184 };
185 
186 // Callback to delay the evaluation of a transform
188 {
189 public:
191  virtual const UT_Matrix4D& eval(bool &ret) = 0;
192 };
193 
195 {
196 public:
197  OP_EvaluateTransformTracksArgs( const UT_StringHolder name, UT_Matrix4D *w, UT_Matrix4D *l=nullptr, OP_TransformCallback *parent_cb=nullptr, int *timedep=nullptr )
198  : myTrackIndex(-1)
199  , myTrackCount(1)
200  , myTrackName(name)
201  , myWorldXfo(w)
202  , myLocalXfo(l)
203  , myParentXfo(parent_cb)
204  , myTimeDep(timedep)
205  {}
206 
207  OP_EvaluateTransformTracksArgs( int index, UT_Matrix4D *w, UT_Matrix4D *l=nullptr, OP_TransformCallback *parent_cb=nullptr, int *timedep=nullptr )
208  : myTrackIndex(index)
209  , myTrackCount(1)
210  , myWorldXfo(w)
211  , myLocalXfo(l)
212  , myParentXfo(parent_cb)
213  , myTimeDep(timedep)
214  {}
215 
216  // Callback to delay the evaluation of a transform
220 
224  int *myTimeDep;
225 };
226 
227 // Utility for detecting cycles when traversing graphs
230 
234 typedef std::pair<const OP_Node *, int> opNodeOutput;
235 
236 // The prefix used to specify an operator where a path would normally be used.
237 #define OPREF_PREFIX "op:"
238 #define OPREF_PREFIX_LEN 3
239 
240 // Default value of hash for compiled code associated with this node that
241 // shouldn't conflict with the hash of any actual cached code.
242 #define DEFAULT_COMP_HASH_VALUE (17*19)
243 
244 // Please, no spaces in these table names!
245 #define INVALID_TABLE_NAME "Node"
246 #define OBJ_TABLE_NAME "Object"
247 #define SOP_TABLE_NAME "Sop"
248 #define CHOPNET_TABLE_NAME "ChopNet"
249 #define CHOP_TABLE_NAME "Chop"
250 #define ROP_TABLE_NAME "Driver"
251 #define SHOP_TABLE_NAME "Shop"
252 #define COP2_TABLE_NAME "Cop2"
253 #define COPNET_TABLE_NAME "CopNet"
254 #define VOP_TABLE_NAME "Vop"
255 #define VOPNET_TABLE_NAME "VopNet"
256 #define DOP_TABLE_NAME "Dop"
257 #define TOP_TABLE_NAME "Top"
258 #define TOPNET_TABLE_NAME "TopNet"
259 #define LOP_TABLE_NAME "Lop"
260 
261 // Manager and Director tabel names:
262 #define MGR_TABLE_NAME "Manager"
263 #define DIR_TABLE_NAME "Director"
264 
265 // These are the "script" directories where help and initialization scripts
266 // are found.
267 #define INVALID_SCRIPT_NAME "node"
268 #define OBJ_SCRIPT_NAME "obj"
269 #define SOP_SCRIPT_NAME "sop"
270 #define CHOPNET_SCRIPT_NAME "ch"
271 #define CHOP_SCRIPT_NAME "chop"
272 #define ROP_SCRIPT_NAME "out"
273 #define SHOP_SCRIPT_NAME "shop"
274 #define COPNET_SCRIPT_NAME "img"
275 #define COP2_SCRIPT_NAME "cop2"
276 #define VOP_SCRIPT_NAME "vop"
277 #define VOPNET_SCRIPT_NAME "vex"
278 #define DOP_SCRIPT_NAME "dop"
279 #define TOP_SCRIPT_NAME "top"
280 #define TOPNET_SCRIPT_NAME "tasks"
281 #define LOP_SCRIPT_NAME "lop"
282 
283 // Manager and Director scripts... I doubt these will be used.
284 #define MGR_SCRIPT_NAME "mgr"
285 #define DIR_SCRIPT_NAME "dir"
286 #define MAT_SCRIPT_NAME "mat"
287 
288 // These are the op type names. These are used by icons among others.
289 #define INVALID_OPTYPE_NAME "NODE"
290 #define OBJ_OPTYPE_NAME "OBJ"
291 #define SOP_OPTYPE_NAME "SOP"
292 #define CHOPNET_OPTYPE_NAME "CHOPNET"
293 #define CHOP_OPTYPE_NAME "CHOP"
294 #define ROP_OPTYPE_NAME "ROP"
295 #define SHOP_OPTYPE_NAME "SHOP"
296 #define COP2_OPTYPE_NAME "COP2"
297 #define COPNET_OPTYPE_NAME "IMG"
298 #define VOP_OPTYPE_NAME "VOP"
299 #define VOPNET_OPTYPE_NAME "VOPNET"
300 #define DOP_OPTYPE_NAME "DOP"
301 #define TOP_OPTYPE_NAME "TOP"
302 #define TOPNET_OPTYPE_NAME "TOPNET"
303 #define LOP_OPTYPE_NAME "LOP"
304 
305 // These are the types of the manager nodes & director nodes.
306 // Manager nodes are things like /shop which don't have a specific
307 // type
308 // The director node is the root node which has everything inside it.
309 #define MGR_OPTYPE_NAME "MGR"
310 #define DIR_OPTYPE_NAME "DIR"
311 
312 /// Nice label names used by network view, corresponding to OP_OpTypeId
313 OP_API extern const char *OPtypeIdLabels[NUM_MANAGERS];
314 
315 // Stores the status of the node - undefined for currently
316 // uncached state,
318 {
322 };
323 
324 // These are some special defines used by VOPs. They need to be here
325 // because the OP_ConnectionMemory has to handle these operators in a
326 // special way,
327 #define VOP_OUTPUT_NODE_NAME "output"
328 #define VOP_SUBNET_OUTPUT_NODE_NAME "suboutput"
329 #define VOP_SUBNET_INPUT_NODE_NAME "subinput"
330 
331 // These defines provide a common place where the names of the management
332 // operator types are defined.
333 #define SHOP_MANAGEMENT_OPTYPE "shopnet"
334 #define COP2_MANAGEMENT_OPTYPE "cop2net"
335 #define ROP_MANAGEMENT_OPTYPE "ropnet"
336 #define CHOP_MANAGEMENT_OPTYPE "chopnet"
337 #define SOP_MANAGEMENT_OPTYPE "sopnet"
338 #define OBJ_MANAGEMENT_OPTYPE "objnet"
339 #define VOP_MANAGEMENT_OPTYPE "vopnet"
340 #define DOP_MANAGEMENT_OPTYPE "dopnet"
341 #define TOP_MANAGEMENT_OPTYPE "topnet"
342 #define LOP_MANAGEMENT_OPTYPE "lopnet"
343 
344 // This class has each of the above entities filled out.
345 // You can thus convert between different types by looking up
346 // with the known key and extracting what you want from this class.
347 // Looking up by id is fast, the rest requires a scan.
349 {
350 public:
355 };
356 
357 /// Options class for use with OP_Node::saveCommand()
359 {
360  // Initialize the options to match the opscript defaults
362  ( bool values_only_ = false
363  , bool defaultstoo_ = true
364  , bool docreate_ = true
365  , bool doparms_ = true
366  , bool doflags_ = true
367  , bool dowires_ = true
368  , bool dowiresout_ = true
369  , bool frames_ = false
370  , bool dogeneral_ = false
371  , bool dochblock_ = true
372  , bool dospareparms_ = true
373  , bool omit_version_info_ = false
374  )
375  : values_only(values_only_)
376  , defaultstoo(defaultstoo_)
377  , docreate(docreate_)
378  , doparms(doparms_)
379  , doflags(doflags_)
380  , dowires(dowires_)
381  , dowiresout(dowiresout_)
382  , frames(frames_)
383  , dogeneral(dogeneral_)
384  , dochblock(dochblock_)
385  , dospareparms(dospareparms_)
386  , omit_version_info(omit_version_info_)
387  {
388  }
389 
392  bool docreate;
393  bool doparms;
394  bool doflags;
395  bool dowires;
397  bool frames;
398  bool dogeneral;
399  bool dochblock;
402 };
403 
404 //___________________________________________________________________________
405 
406 
407 //
408 // a container class to describe the instantaneous state of a parameter
409 //
411 {
412 public:
416  int myIndex;
418 
419  int operator==(const opParmData &v) const
420  {
421  return (myValue == v.myValue &&
422  myLabel == v.myLabel &&
423  myNode == v.myNode &&
424  myIndex == v.myIndex &&
425  mySubIndex == v.mySubIndex
426  );
427  }
428 };
429 
430 
431 // Blank class definitions for all our node types...
432 class OBJ_Node;
433 class SOP_Node;
434 class CHOPNET_Node;
435 class CHOP_Node;
436 class COP2_Node;
437 class COPNET_Node;
438 class ROP_Node;
439 class TOP_Node;
440 class TOPNET_Node;
441 class LOP_Node;
442 class SHOP_Node;
443 class VOP_Node;
444 class VOPNET_Node;
445 class DOP_Node;
446 
447 #define INSTANTIATE_FINDNODE_FUNCTIONS(PREFIX) \
448  PREFIX##_Node *find##PREFIX##Node(const char *path) const \
449  { \
450  OP_Node *node; \
451  \
452  node = findNode(path); \
453  if (node) return node->castTo##PREFIX##Node(); \
454  return 0; \
455  }
456 #define INSTANTIATE_CASTNODE_FUNCTIONS(PREFIX) \
457  PREFIX##_Node *castTo##PREFIX##Node() const \
458  { \
459  /* If this is triggered, use CAST_FOONODE instead */ \
460  /* This is because foo->bar() should not be done with */ \
461  /* NULL foo for aesthetic reasons. */ \
462  { const void *this_local = this; \
463  UT_ASSERT(this_local); \
464  if (!this_local) return 0; } \
465  if (getOpTypeID() == PREFIX##_OPTYPE_ID) \
466  { \
467  return (PREFIX##_Node *) this; \
468  } \
469  return 0; \
470  }
471 
472 /// This macro allows us to run another macro for all node types
473 #define INSTANTIATE_FOR_ALL_NODE_TYPES(MACRO_FUNC) \
474  MACRO_FUNC(OBJ) \
475  MACRO_FUNC(SOP) \
476  MACRO_FUNC(CHOPNET) \
477  MACRO_FUNC(CHOP) \
478  MACRO_FUNC(ROP) \
479  MACRO_FUNC(SHOP) \
480  MACRO_FUNC(COP2) \
481  MACRO_FUNC(COPNET) \
482  MACRO_FUNC(VOP) \
483  MACRO_FUNC(VOPNET) \
484  MACRO_FUNC(DOP) \
485  MACRO_FUNC(TOP) \
486  MACRO_FUNC(TOPNET) \
487  MACRO_FUNC(LOP)
488 
493 
495 {
496 public:
497  // Methods to convert our enums and strings:
498  static const OP_TypeInfo *getOpInfoFromOpTypeID(OP_OpTypeId opid);
499  static const OP_TypeInfo *getOpInfoFromOpTypeName(const char *name);
500  static const OP_TypeInfo *getOpInfoFromTableName(const char *name);
501  static const OP_TypeInfo *getOpInfoFromScriptDir(const char *dir);
502  static const char *getOpTableNameFromManagerTypeName(const char *name);
503 
505  { return myParent; }
507  { return myRootCompiledParent; }
508 
509  //Return the network this item resides in (i.e. getParent()). This method
510  //was introduced to provide a standardized way of accessing the parent
511  //network of all different network box item types.
512  virtual OP_Network *getParentNetwork() const;
513 
514  // This function looks up our parent tree to determine if the given node
515  // is our parent, grandparent, great-grandparent...
516  bool getIsContainedBy(const OP_Node *testparent) const;
517 
518  /// Return the name of this node's parent
519  const UT_String &getNetName() const;
520 
521  /// This returns the OP_OpTypeId which corresponds to this node type.
522  /// Management nodes will return the type they really are, which
523  /// is likely different than the network they currently reside in.
524  virtual OP_OpTypeId getOpTypeID() const = 0;
525 
526  // This is the proper way to determine the optype.
527  // Do not assume your parents child type is your type! This will only
528  // become less true as time goes on :>
529  // The strings returned are the *_OPTYPE_NAME defined in OP_Network.h
530  virtual const char *getOpType() const = 0;
531 
532  virtual OP_ItemType getItemType() const;
533 
534  /// @anchor OP_Node_findFOONode
535  ///
536  /// FOO_Node *findFOONode(const char *path) const; @n
537  /// This function searches for the node at path relative
538  /// to this node. If not found, or if the found node is
539  /// not of type FOO_Node, it returns NULL. The result
540  /// is already cast to FOO_Node.
541  /// findOBJNode(const char *path)
542  /// findSOPNode(const char *path)
543  /// findCHOPNETNode(const char *path)
544  /// findCHOPNode(const char *path)
545  /// findROPNode(const char *path)
546  /// findSHOPNode(const char *path)
547  /// findCOP2Node(const char *path)
548  /// findCOPNETNode(const char *path)
549  /// findVOPNode(const char *path)
550  /// findVOPNETNode(const char *path)
551  /// findDOPNode(const char *path)
552  /// findTOPNode(const char *path)
553  /// findTOPNETNode(const char *path)
554  /// findLOPNode(const char *path)
555  // @{
557  // @}
558 
559  /// @anchor OP_Node_castToFOONode
560  ///
561  /// FOO_Node *castToFOONode() const; @n
562  /// This type checks the current node against FOO_Node.
563  /// If the cast is legal, this is returned. Otherwise, NULL.
564  /// While it likely will do the "right" thing with this == NULL,
565  /// that case is UT_ASSERTed as it is just asking for trouble.
566  /// castToOBJNode()
567  /// castToSOPNode()
568  /// castToCHOPNETNode()
569  /// castToCHOPNode()
570  /// castToROPNode()
571  /// castToSHOPNode()
572  /// castToCOP2Node()
573  /// castToCOPNETNode()
574  /// castToVOPNode()
575  /// castToVOPNETNode()
576  /// castToDOPNode()
577  /// castToTOPNode()
578  /// castToTOPNETNode()
579  /// castToLOPNode()
580  // @{
582  // @}
584  /// Obtain the node's script which is called when it is being deleted.
585  const UT_String &getDelScript(void) const { return myDelScript; }
586 
587  /// Set the node's deletion script. Returns true if the delete script was
588  /// set successfully.
589  bool setDelScript(const char *str);
590 
591  /// Accessors for this node's comment string.
592  // @{
593  const UT_String &getComment(void) const { return myComment; }
594  bool setComment(const char *str);
595  // @}
596 
597  /// Overrides the NetworkBoxItem implementations of getColor and setColor
598  /// to provide support Node-specific features like using the default color.
599  // @{
600  virtual UT_Color getColor() const;
601  virtual bool setColor(const UT_Color &col);
602  // @}
603 
604  /// Accessors for this node's flag indicating if it should use its
605  /// operator's default color instead of its local color.
606  // @{
607  int getColorDefault() const;
608  int setColorDefault(int usedefault);
609 
610  /// Accessors for this node's shape
611  // @{
612  const UT_StringHolder &getNodeShape() const;
613  void setNodeShape(const UT_StringHolder &shape);
614  // @}
615 
616  /// Node position/scale is used by the UI.
617  // @{
618  // These are in absolute coordinates, not the UI coordinates found in
619  // OPUI_Worksheet, though.
620  virtual void setXY(fpreal x, fpreal y);
621  virtual fpreal getX() const { return myPosX; }
622  virtual fpreal getY() const { return myPosY; }
623  virtual fpreal getW() const;
624  virtual fpreal getH() const;
625  // @}
626 
627  void pickRequest(int shift);
628 
629  /// Set allow_rel_paths to true to accept "." or ".." as valid paths.
630  static bool isValidOpName(const UT_StringView &s,
631  bool allow_rel_paths = false,
632  bool ignore_node_names_env_var = false);
633  static bool isValidOpName(const char *s,
634  bool allow_rel_paths = false,
635  bool ignore_node_names_env_var = false)
636  {
637  return isValidOpName(UT_StringView(s),
638  allow_rel_paths,
639  ignore_node_names_env_var);
640  }
641  static bool isValidOpPath(const UT_StringRef &s);
642  static bool forceValidOpName(UT_String &name);
643 
644  /// Override these methods so that search-and-replace operations
645  /// affect our delete script as well as our parameters.
646  // @{
647  virtual int findString(const char *str, bool fullword,
648  bool usewildcards) const;
649  virtual int changeString(const char *from, const char *to,
650  bool fullword);
651  // @}
652 
653  /// Mark this node, its descendants, and all data dependents containing
654  /// varname as being dirty. If changed_nodes is non-NULL, then it is
655  /// updated with the list of dirtied nodes which contains varname.
656  /// Returns true iff at least one node was dirtied.
657  bool notifyVarChange(
658  const char *varname,
659  OP_NodeList *changed_nodes = nullptr);
660 
661  // These are no-ops for nodes but will be implemented for networks:
662  virtual int getNchildren() const;
663  virtual OP_Node *getChild(const char *name, int *hint=0) const;
664  virtual OP_Node *getChild(int index) const;
665  void getPickedChildren(OP_NodeList &picked,
666  bool include_hidden=false) const;
667  void getAllChildren(OP_NodeList &children) const;
668  virtual OP_Node *matchChild(const char *pattern, OP_Node *prevmatch=0,
669  const char *optype=0,
670  int casesensitive = 0) const;
671  virtual OP_Node *matchChildBackwards(const char *pattern,
672  OP_Node *prevmatch=0,
673  const char *optype=0,
674  int casesensitive = 0) const;
675  virtual OP_Network *createProxyRefNode( const char *path );
676 
677  // Returns the maximum error severity of ourself and all of our
678  // children. For efficiency, early-exits at ABORT (so embedded
679  // FATAL might be shadowed by an ABORT) but in practice FATAL is
680  // unused.
681  OP_ERROR getChildErrorSeverity();
682 
683  // Returns the list of nodes eligible to be considered for child
684  // errors.
685  virtual void getPotentialChildErrorNodes(OP_NodeList &nodes) const;
687  // Returns the node with the requested unique integer identifier.
688  static OP_Node *lookupNode(int unique_id, bool include_proxy=false)
689  {
690  if( unique_id >= 0 && unique_id <= theUniqueId
691  && theUniqueNodes[unique_id] )
692  {
693  if( include_proxy || !theUniqueNodes[unique_id]
694  ->isProxyRefNode() )
695  return theUniqueNodes[unique_id];
696  }
697  return 0;
698  }
699  static int getNumUniqueIds()
700  { return theUniqueId + 1; }
701  // Fills the provided array with every node that currently exists.
702  static void getAllNodes(OP_NodeList &nodes);
703 
704  int getUniqueId() const
705  { return myUniqueId; }
706  virtual int64 getItemUniqueId() const
707  { return myUniqueId; }
708 
709  // The following function will take a standard pattern and expand
710  // all the groups out of the pattern, leaving a simple pattern
711  // in the result.
712  bool expandGroupPattern(const char *pattern,
713  UT_String &result,
714  bool expandToFullPaths = false);
715 
716  // The following methods take a standard pattern and return whether
717  // the pattern contains the specified bundle or group.
718  bool patternContainsBundle(const char *pattern,
719  const OP_Bundle *bundle) const;
720  bool patternContainsGroup(const char *pattern,
721  const OP_Group *group) const;
722 
723  virtual int isManager() const;
724  // This differs from isManager. Managers are the old school static
725  // things which are always present in fixed directories. Management
726  // nodes are managers that are in the wrong directory.
727  virtual int isManagementNode() const;
728  // This is a bit broader than management nodes. These nodes may
729  // be in the right directory, but represent an unexpected change
730  // of directory type, so need to be tracked so our tree filter
731  // will know about them.
732  bool isEffectivelyAManagementNode() const;
733 
734  // Returns ture if this node contains material nodes.
735  virtual bool isMaterialManager() const;
736 
737  // This function checks if the node is a subnet. Now that we can have
738  // NWN subnets (object subnets, vopnet subnets), we need to explicitly
739  // specify if these types of subnets count. In some cases we want them
740  // to count (such as checking for VOPNET subnets to see if we can
741  // generate code, or SHOP subnets to see if we can save to a palette).
742  // In other cases we want to exclude these management ops (such as
743  // when deciding to show the "Create Type From" menu item or checking
744  // if we can do an opwire -i command).
745  virtual int isSubNetwork(bool includemanagementops) const;
746  virtual int isNetwork() const;
747  virtual int isInSubNetwork() const;
748 
749  bool isProxyRefNode() const
750  { return myIsProxyRefNode; }
751  void setProxyRefNode(bool f)
752  { myIsProxyRefNode = f; }
753 
754  // Used by SOPs to determine which node is the output of a subnetwork.
755  virtual bool isOutputNode() const;
756  // Returns which output this node represents.
757  virtual int whichOutputNode() const;
758 
759  // isNetworkWithKids() will return 1 if the node is a network and the
760  // operator table for the node contains children which can be added to the
761  // node.
762  int isNetworkWithKids() const;
763 
764  virtual int isVex() const;
765 
766  // methods for managing the bundles we depend on in so that any change to
767  // the bundle in which we are interested triggers bundleChange call.
768  // NB: getParmBundle methods find or create a bundle ad it to the
769  // internal list of referenced bundles
770  OP_Bundle * getParmBundle(const char* parm_name, int vector_index,
771  UT_String &pattern, OP_Network *creator,
772  const char *filter);
773  void markBundleRefsAsUnused();
774  void cleanUnusedBundleRefs();
775  void cleanAllBundleRefs();
776 
777  static void getValueAsBundlePaths(fpreal t,
778  UT_WorkBuffer &resultbuf,
779  PRM_Parm *parm, int index,
780  OP_Node *srcnode
781  );
782  static void getValueAsBundlePaths(fpreal t,
783  OP_NodeList &resultnodes,
784  PRM_Parm *parm, int index,
785  OP_Node *srcnode
786  );
787 
788  // The bundleChanged() method is called whenever a bundle referenced by the
789  // OP is changed. The bundle is passed to the OP to let the OP know that
790  // it's out of date. The function should return 1 if the event was handled
791  // properly or 0 if it failed. The return codes are used for debugging
792  // only.
793  virtual bool bundleChanged(const OP_Bundle *bundle);
794  // If a bundle changes, you should call this method to touch the parameter
795  // which the bundle affects. The name is the token of the parm.
796  void touchBundleParm(const char *name);
797  void touchBundleParm(int parm_index);
799  // Function to determine if Display and Render node ptrs are the same
800  virtual int getDandROpsEqual() { return 1; }
801  // Function to update info about whether Render and Display node ptrs
802  // are the same. Recurses tree and updates all kids values.
803  virtual int updateDandROpsEqual(int = 1) { return 1; }
804 
805  /// Check to see whether @c node is an ancestor of @c this node in the
806  /// input hierarchy. Optionally check extra inputs. This method will
807  /// recurse using @c getInputs() (and optional getExtraInputNodes()
808  /// @note This node is considered to be an ancestor of itself
809  bool isInputAncestor(const OP_Node *parent,
810  bool check_extra=true) const;
811  /// Check to see whether the @c parent node is an ancestor of @c this node
812  /// in the parent/child hierarchy. That is, this method will call
813  /// getParent()/getChild() to traverse the hierarchy.
814  /// @note This node is considered to be an ancestor of itself
815  bool isParentAncestor(const OP_Node *parent) const;
816 
817  /// Get the info text for this op. This non-virtual function does
818  /// all the stuff common to all operator types.
819  /// @warning The return value is the value of the work buffer in the
820  /// OP_NodeInfoParms. Thus, you should never do @code
821  /// str = node->getInfoText(context, OP_NodeInfoParms());
822  /// @endcode
823  /// Since the lifetime of the temporary may not be long enough to extract
824  /// the string properly.
825  const char *getInfoText(OP_Context &context,
826  OP_NodeInfoParms &parms);
827  // Get Info Text that is specific to this node type.
828  virtual void getNodeSpecificInfoText(OP_Context &context,
829  OP_NodeInfoParms &parms);
830 
831  /// Uses the path (eg. "/obj/geo1") to find a node in our heirarchy
832  OP_Node *findNode(const char *path) const;
833 
834  /// Same as findNode() except it will return NULL if the path is to a node
835  /// that is either not a descendent of this node, or if it isn't the same
836  /// type as our children.
837  OP_Node *findSubNode(const char *path) const;
838 
839  // These are all Implemented in OP_Network, but put here as a virtual to
840  // make working / with hscript easier so that it can be called directly on
841  // an op node
842  virtual OP_NetworkBox *findNetworkBox(const char *name)
843  { return nullptr; }
844  virtual OP_PostIt *findPostItNote(const char *const_path)
845  { return nullptr; }
846  virtual OP_Dot *findDot(const char *const_path)
847  { return nullptr; }
848  virtual OP_SubnetIndirectInput *findParentInput(const char *const_path)
849  { return nullptr; }
850  virtual OP_NetworkBoxItem *findItem(const char *const_path,
851  OP_ItemTypeMask item_type =
853  { return nullptr; }
854 
855  // These functions will adhere to certain conventions, such as a reference
856  // to an object actually means a reference to the display or render
857  // guy in that object. This will also check this->isCookingRender
858  // to determine if it should auto-use the Render or Display.
859  // These will not fail if the returned node is the node itself.
860  SOP_Node *getSOPNode(const char *path, int addextra = 0,
861  bool *got_by_flag=nullptr) const;
862  // This method will use the render node of the composite network if
863  // it is a comp rather than a cop2 that is pointed to...
864  COP2_Node *getCOP2Node(const char *path, int addextra = 0) const;
865  // And this one will use the display node, which corresponds to the
866  // cook node in DOPs land.
867  DOP_Node *getDOPNode(const char *path, int addextra = 0) const;
868  ROP_Node *getROPNode(const char *path, int addextra = 0) const;
869  // This method will use the audio node of the chop network
870  CHOP_Node *getCHOPNode(const char *path, int addextra = 0,
871  bool *got_by_flag=nullptr) const;
872  // This method will use the display node of the top network
873  TOP_Node *getTOPNode(const char *path, int addextra = 0) const;
874  // This method will use the display node of the lop network
875  LOP_Node *getLOPNode(const char *path, int addextra = 0) const;
876  OBJ_Node *getOBJNode(const char *path, int addextra = 0) const;
877 
878  virtual OP_Node *castToOPNode() { return this; }
879  virtual const OP_Node *castToOPNode() const { return this; }
880 
881  /// Returns the path of this node relative to its getCreator()
882  virtual void getPathWithSubnet(UT_String &str) const;
883  void getPathWithSubnet(UT_StringHolder &str) const
884  { UT_String tmp; getPathWithSubnet(tmp); str.adoptFromString(tmp); }
885 
886  /// This will try to complete the path by finding the longest suffix
887  /// that will work with the given prefix. It will only complete up
888  /// to the next child. If it finds a valid child, it will append
889  /// a slash (/).
890  void completePath(const char *prefixpath,
891  UT_String &completepath) const;
892 
893  virtual CH_Channel *getTrackChannel(const char *name);
894 
895  virtual bool findParmFromTrack(const OP_FollowChanRefsOptions& opt,
896  const char *trackname,
897  OP_NodeParmRefCycle &cycle,
898  OP_Node *&node,
899  PRM_Parm *&parm, int &vecidx);
900 
901  // Batch evaluation of named parameters. This method requires extra lookup
902  // since parameters are specified by names, but it can handle generic
903  // parameter layout.
904  virtual void evaluateBatchParms(PRM_BatchList &list, fpreal now);
905 
906  // Do global expansion on a pattern - get lists of channels or nodes
907  // If expand is given, concatenated with full list of names
908  // If list is given, appended with list of nodes.
909  // If dependent given, addExtraInputs.
910  void globNodes(const char *pat, UT_String *expand,
911  UT_ValArray<OP_Node *> *list=0,
912  OP_GlobContext *context = 0,
913  const char *prefix = " ");
914 
915  CH_Channel *findChannel(const char *path);
916  void globChannels(const char *, UT_String &expand,
917  OP_GlobContext *context = 0,
918  const char *prefix = " ") const;
919 
920  void globChannels(const char *pattern,
921  CH_ChannelList &clist,
922  OP_GlobContext *context = 0,
923  OP_Node *dependent = 0);
924  // If use_multi_match is false, the pattern is
925  // treated as a single pattern instead of a space
926  // separated list of patterns. (Only applies
927  // to direct parameter names, i.e. the pattern must not be
928  // a path and must not contain a slash)
929  void globChanRefs(const char *pattern,
930  CH_ChannelRefList &list,
931  OP_GlobContext *context = 0,
932  OP_Node *dependent = 0,
933  bool use_multi_match = true);
934 
935  int globParms(const char *pattern, fpreal t,
936  UT_Array<opParmData> &list,
937  OP_GlobContext *context = 0,
938  OP_Node *dependent = 0,
939  int calc_value = 1);
940 
941  // this version only globs the current node
942  void globNodeParms(const char *pattern, fpreal t,
943  UT_Array<opParmData> &list,
945  OP_Node *dependent,
946  int calc_value,
947  bool animated_only);
948 
949  // this version only globs the current node
950  void globNodeChannels(const char *pattern,
951  CH_ChannelList &list,
953  int *parm_start = nullptr,
954  UT_IntArray *parm_indices = nullptr,
955  UT_IntArray *parm_sub_indices = nullptr
956  ) const;
957 
958  // this version only globs the current node
959  // If use_multi_match is false, the pattern is
960  // treated as a single pattern instead of a space
961  // separated list of patterns
962  void globNodeChanRefs(const char *pattern,
963  CH_ChannelRefList &list,
965  int *parm_start = nullptr,
966  UT_IntArray *parm_indices = nullptr,
967  UT_IntArray *parm_sub_indices=nullptr,
968  bool use_multi_match = true
969  ) const;
970 
971  ///Same as 'globNodes', except for network boxes. This is to be implemented
972  ///by OP_Network, but has been put here so it can be called directly on
973  ///OP_Node like all the other "glob" methods without a cast
974  virtual void globNetworkBoxes(const char *pat, UT_String *expand,
976  OP_GlobContext *glob_context = 0,
977  const char *prefix = " ");
978 
979  virtual void globPostIts(const char *pat, UT_String *expand,
980  UT_ValArray<OP_PostIt *> *list=0,
981  OP_GlobContext *glob_context = 0,
982  const char *prefix = " ");
983 
984  // Fetch all channels from this node on down.
985  int getAllChannels(CH_ChannelList &list, int scoped=0);
986 
987  // If you override opChanged() in a sub-class, you must call
988  // the OP_Node base method from the sub-class method
989  virtual void opChanged(OP_EventType reason, void *data=0);
990 
991  // If you override opChanged() in a subclass, you should first call
992  // opShouldHandleChange() before taking any custom action.
993  virtual bool opShouldHandleChange(OP_EventType reason);
994 
995  // This function is called whenever we have a parameter that references
996  // another parameter, and that referenced parameter changes. The pi
997  // value is the index of the parameter containing the reference.
998  virtual void referencedParmChanged(int pi);
999 
1000  /// Mark this node as needing a full recook.
1001  /// If 'evensmartcache' is true, a recook will occur even if all the
1002  /// parameters match in this node and all its inputs (only valid for
1003  /// COP2_Node).
1004  virtual void forceRecook(bool evensmartcache = true);
1005 
1006  /// This method causes any operators that load files to recook.
1007  /// By default, this searches for 'file' operators by iterating through
1008  /// inputs. Parms of type PRM_FILE are also marked dirty. Other nodes that
1009  /// load files differently may wish to override this method.
1010  virtual void reloadExternalFiles();
1011 
1012  /// Determines if this node needs to cook.
1013  ///
1014  /// The queryonly flag will not flag this as a read attempt to the
1015  /// caching mechanisms, and thus not update the touch time.
1016  virtual unsigned needToCook(OP_Context &context, bool queryonly=false);
1017 
1018  /// Cook this node's data. Returns true upon success, false otherwise.
1019  ///
1020  /// Upon failure, use OP_Parameters::error() and
1021  /// OP_Parameters::getErrorMessages() to determine reason.
1022  virtual bool cook(OP_Context &context);
1023 
1024  /// Schedule a task for cooking this node in parallel and wait for it to
1025  /// finish. Returns true upon success, false otherwise.
1026  bool parallelCook(OP_Context &context);
1027 
1028  /// Cook the given node list in parallel
1029  static bool parallelCook(OP_Context &context,
1030  const OP_NodeList &nodes);
1031 
1032  /// The cook lock is used to protect per node data structures during
1033  /// cooking. Subclasses should use this when calling cook(). Example:
1034  /// @code
1035  /// cookLockedExecute([&]() {
1036  /// // run code
1037  /// });
1038  /// @endcode
1039  template <typename F>
1040  void cookLockedExecute(const F &functor)
1041  {
1043  {
1044  OP_CookLock::Scope scope(myCookLock);
1045  functor();
1046  });
1047 #if H_BUILD_PARALLEL_COOK_MODE
1048  if (isOperatorThreadSafe())
1049  EXPR_StaticLock::theStaticCounter.add(-1);
1050 #endif
1051  }
1052 
1053  /// The cook lock is used to protect per node data structures during
1054  /// cooking. Subclasses should use lock this to protect private data.
1055  OP_CookLock & getCookLock() { return myCookLock; }
1057  UT_TaskState & taskState() { return myTaskState; }
1058  const UT_TaskState & taskState() const { return myTaskState; }
1059 
1060  // This normally chains to cookInputGroups.
1061  // Some networks, such as SOPs, use it to be able to
1062  // properly lock their gdp pointer around the cook.
1063  virtual OP_ERROR pubCookInputGroups(OP_Context &context, int alone = 0);
1064 
1065  void bumpVersionParm()
1066  {
1067  dataMicroNode().bumpModVersion();
1068  if (hasIndepParmListMicroNode())
1069  parmListMicroNode().bumpModVersion();
1070  }
1071  int cookParmsModified() const
1072  { return parmListMicroNodeConst()
1073  .isModVersionOutdated(); }
1074 
1075  // The data class of an OP is currently used solely for networks which
1076  // contain heterogeneous node types (i.e. used in SHOP networks to
1077  // distinguish different shader types). A data class of 0 is returned by
1078  // default.
1079  // A value of 0 is returned by default.
1080  virtual int getDataClass() const;
1081 
1082  // The xform order for how to interpret the given channel. Default
1083  // is XYZ.
1084  virtual void getXformOrder(UT_XformOrder &xord,
1085  const CH_Channel *chp) const;
1086 
1087  // "getCookedData" should return a void * version of the results of
1088  // the cook. NULL if it fails with appropriate stuff in our error manager.
1089  virtual OP_DataType getCookedDataType() const = 0;
1090  virtual void *getCookedData(OP_Context &);
1091  virtual void deleteCookedData() = 0;
1092 
1093  virtual int saveCookedData(std::ostream &os, OP_Context &,
1094  int binary = 0) = 0;
1095  virtual bool loadCookedData(UT_IStream &is, const char *path=0);
1096  virtual int saveCookedData(const char *filename, OP_Context &) = 0;
1097 
1098  /// Get the transform from this node's space to the 'to' node's space.
1099  /// Returns 1 if this was possible, 0 otherwise (e.g. failure to cook).
1100  virtual int getRelativeTransform(OP_Node &to, UT_Matrix4 &xform,
1101  OP_Context &context);
1102  virtual int getRelativeTransform(OP_Node &to, UT_DMatrix4 &xform,
1103  OP_Context &context);
1104  // overrides for OPs that can capture (right now only OBJ_Bone)
1105  virtual int getRelativeCaptureTransform(OP_Node &to,
1106  UT_Matrix4 &xform,
1107  OP_Context &context);
1108  virtual int getRelativeCaptureTransform(OP_Node &to,
1109  UT_DMatrix4 &xform,
1111 
1113  {
1114  TRANSFORM_WORLD,
1115  TRANSFORM_IWORLD,
1116  TRANSFORM_PRE,
1117  TRANSFORM_PARENT,
1118  TRANSFORM_PARM,
1119  TRANSFORM_PRECONSTRAINT,
1120  TRANSFORM_PARENTBONE,
1121  TRANSFORM_RAWPARM,
1122  TRANSFORM_PREPARM,
1123  TRANSFORM_PRERAWPARM,
1124  };
1125 
1126  // these next 3 are the minimal overrides for subclasses that have
1127  // transforms (see OBJ_Node)
1128  virtual bool getWorldTransform(UT_Matrix4D &xform, OP_Context &);
1129  virtual bool getIWorldTransform(UT_Matrix4D &xform, OP_Context &);
1130  virtual bool getTransform( TransformMode mode, UT_Matrix4D &xform, OP_Context &);
1132  // single precision versions of the above
1133  bool getWorldTransform(UT_Matrix4F &xform, OP_Context &ctx)
1134  {
1135  UT_Matrix4D m;
1136  bool ok = getWorldTransform(m, ctx);
1137  xform = m;
1138  return ok;
1139  }
1140  bool getIWorldTransform(UT_Matrix4F &xform, OP_Context &ctx)
1141  {
1142  UT_Matrix4D m;
1143  bool ok = getIWorldTransform(m, ctx);
1144  xform = m;
1145  return ok;
1146  }
1147  bool getTransform( TransformMode mode, UT_Matrix4F &xform, OP_Context &ctx)
1148  {
1149  UT_Matrix4D m;
1150  bool ok = getTransform(mode, m, ctx);
1151  xform = m;
1152  return ok;
1153  }
1154 
1155  /// Registers an error for cooking the given node's transform. If label is
1156  /// supplied, then it will be used as a label of the transform error.
1157  void addTransformError(const OP_Node &node,
1158  const char *label=0) const;
1159 
1160  // Compute the bounding box for the operator (if applicable). If the box
1161  // could be computed, return true, else return false.
1162  virtual bool getBoundingBox(UT_BoundingBox &box, OP_Context &);
1163 
1164  // This is used by VOPNETs to determine which table needs to be
1165  // refreshed when they change.
1166  virtual const char *getInternalOpTable() const
1167  { return INVALID_TABLE_NAME; }
1168  virtual OP_Operator *getInternalOperator() const
1169  { return 0; }
1170 
1171  virtual const char *inputLabel(unsigned idx) const;
1172  virtual const char *outputLabel(unsigned idx) const;
1173 
1174  // Here's a useful method which will return the string "Source %d", where
1175  // %d is the idx passed. Lets us check if the input label is using the
1176  // default or not.
1177  const char *inputLabelNum(unsigned idx) const;
1178  const char *outputLabelNum(unsigned idx) const;
1179 
1180  // returns a label that is applied to the drawn connector. NULL may be
1181  // returned as 'no label'.
1182  virtual const char *inputConnectorLabel(unsigned idx);
1183 
1184  // if true, the connector to the input will be dashed rather than solid.
1185  virtual int isRefInput(unsigned idx) const;
1186 
1187  // returns the index of the auxilary input, if any (currently only used
1188  // for the mask inputs in COPs).
1189  virtual int getAuxInput() const;
1190  virtual void getAuxInputName(OP_ConnectorId& name_out);
1191 
1192  // The lock method is used to lock the OP.
1193  // Returns the previous state of the lock flag.
1194  //
1195  // Note that to mimic the behaviour of the lock button, you MUST
1196  // call setModelLock, not setLock, or your next unlock won't have
1197  // a cached data.
1198  int setLock(int state, int saveundo = 1);
1199  int getSoftLock() const {return flags().getSoftLocked();}
1200  int getHardLock() const {return flags().getHardLocked();}
1201  int getLock() const {return flags().getLocked(); }
1202  // getNetworkLock() checks to see if the OP is effectively locked by
1203  // the network, i.e., each of the OPs output branches connect to a locked
1204  // OP down the network. Returns > 0 if locked, <= 0 if unlocked.
1205  // When relaxedlockcheck is set, subnet branches that are not displayed
1206  // are ignored.
1207  int getNetworkLock(bool relaxedlockcheck = false,
1208  const OP_Node *inputNode=nullptr) const;
1209  // The Model lock is similar to the normal lock but will also cause
1210  // the node data to be saved.
1211  virtual int setModelLock(int on_off,
1212  void *modeler = 0,
1213  int allow_softlock_promotion=0,
1214  UT_Undo *undo = 0);
1215  int getModelLock() const;
1216 
1217  // The unload flag triggers whether we keep the ops data around
1218  // after a cook or discard it as soon as its not needed. Its currently
1219  // only implemented in CHOPs.
1220  int setUnload(int on_off);
1221  int getUnload() const;
1223  // Returns whether this node has data loaded into it.
1224  virtual bool isLoaded() const { return true; }
1225 
1226  // This will explicitly delete all data associated with the OP
1227  // false is returned if no data was deleted (ie, OP is in use, etc)
1228  // Only works with SOPs now.
1229  virtual bool unloadData();
1230 
1231  // Take control for flags
1232  void takeActivateFlag(uchar flag, bool enable=true,
1233  bool send_flag_event=true);
1234  void takeDeactivateFlag(uchar flag)
1235  { takeActivateFlag(flag, false); }
1236  bool takeIsActiveFlag(uchar flag) const;
1237  void setHasTakeData(int onoff);
1238 
1239  bool canAccessFlag(unsigned mask, uchar flag) const;
1240 
1241  // The template flag indicates that the node date should be displayed
1242  // The display & render flags indicate that the node is turned on
1243  // for display purposes or for rendering purposes, which may take
1244  // on different meanings per node type.
1245  // Setting save data only has meaning for some node types.
1246  virtual int setPicked(int on_off,
1247  bool propagate_parent_event = true);
1248 
1249  /// The edit flag is used whenever something is picked
1250  /// from the viewport. This causes the pane paths to
1251  /// be changed to the first writable parent of the
1252  /// node being picked.
1253  int setEditPicked(int on_off,
1254  bool propagate_parent_event = true);
1255 
1256  // The Autoscope flag on OP_Node is used to temporary turn-off the Auto-Add to Channel List
1257  // behavior when selecting nodes.
1258  // This is used when setting selected nodes from selected channels in the channel list
1259  void setAutoscope(bool on_off) { myAutoscope = on_off; }
1260  bool isAutoscope() { return myAutoscope; }
1261 
1262  int setCurrent(int on_off);
1263  int setExpose(int on_off);
1264  int setBypass(int on_off);
1265  int setTemplate(int on_off);
1266  int setFootprint(int on_off);
1267  int setXray(int on_off);
1268  int setDisplay(int on_off);
1269  int setRender(int on_off);
1270  int setHighlight(int on_off);
1271  int setModified(int on_off);
1272  int setSaveBypass(int on_off);
1273  int setSaveData(int on_off);
1274  // these are for subclasses to implement, they do nothing by default
1275  virtual int setPickable(int on_off)
1276  { return 0; }
1277  virtual int setAudio(int on_off)
1278  { return 0; }
1279  virtual int setExport(int on_off)
1280  { return 0; }
1281  virtual int setDebug(int on_off)
1282  { return 0; }
1283  virtual int setDisplayOrigin(int on_off_unchanged)
1284  { return 0; }
1285 
1286  /// The user has set the template flag. If we are turning on the template
1287  /// flag, we do the same as setTemplate(). If we are turning it *off*,
1288  /// we also turn off the selectable template (footprint) flag.
1289  void userSetTemplate(bool onoff);
1290 
1291  /// The user has set the selectable template flag. If we are making a node
1292  /// into a selectable template, we turn on the template flag as well.
1293  /// If we are turning off selectable template, we leave template alone.
1294  void userSetSelectableTemplate(bool onoff);
1295 
1296  // Here are the generalised versions, they add a bit of overhead to
1297  // the code because of the big switch statement.
1298  virtual int setFlag(char tag, int on_off);
1299  virtual int getFlag(char tag) const;
1301  virtual int getPicked() const {return flags().getPicked(); }
1302  virtual int getEditPicked() const
1303  { return flags().getEditPicked(); }
1304  int getCurrent() const;
1305  int getDisplay() const {return flags().getDisplay(); }
1306  int getRender() const {return flags().getRender(); }
1307  int getHighlight()const {return flags().getHighlight();}
1308  int getBypass() const {return flags().getBypass(); }
1309  int getTemplate() const {return flags().getTemplate(); }
1310  int getFootprint() const {return flags().getFootprint(); }
1311  int getXray() const {return flags().getXray(); }
1312  int getExpose() const {return flags().getExpose(); }
1313  int getModified() const {return flags().getModified(); }
1314  int getSaveBypass() const{return flags().getSaveBypass(); }
1315  int getSaveData() const {return flags().getSaveData(); }
1316  virtual int getHasTakeData() const
1317  { return flags().getHasTakeData(); }
1318  virtual int getPickable()
1319  { return 0; }
1320  virtual int getAudio() const
1321  { return 0; }
1322  virtual int getExport() const
1323  { return 0; }
1324  virtual int getDebug() const
1325  { return 0; }
1326  virtual int getDisplayOrigin() const
1327  { return 0; }
1328  virtual bool getItemExpose() const { return getExpose(); }
1329  virtual void setItemExpose(bool expose) { setExpose(expose); }
1330  virtual bool getUseBypassLook(const OP_EditorContext &ctx) const;
1331 
1332  int getDisplayDescriptiveName() const
1333  {return flags().getDisplayDescriptiveName();}
1334  int setDisplayDescriptiveName(int state);
1335  int getDisplayComment() const
1336  {return flags().getDisplayComment();}
1337  int setDisplayComment(int state);
1338  int getOutputForView() const
1339  { return flags().getOutputForView(); }
1340  int setOutputForView(int output);
1341 
1342  OP_Node *getPickableSelfOrParent();
1343 
1344  // The compress flag indicates that the OP connector should be displayed
1345  // in a compressed UI. In ICE this means don't display the mini raster
1346  // image.
1347  int setCompress(int on_off);
1348  int getCompress() const;
1349 
1350  // This method sets this node as the current and picked node and correctly
1351  // adjusts the picked states of the other sibling nodes.
1352  void setCurrentAndPicked();
1353 
1354  // setVisible() simply calls setDisplay() at this level but subclasses
1355  // override this to perform smarter behaviour. Objects for example will
1356  // try to set the display flag on parent subnets and change visible object
1357  // parameters as necessary.
1358  // Returns true if it was successful, false if there were not sufficient
1359  // permissions.
1360  virtual bool setVisible(int onoff);
1361  virtual bool getVisible() const;
1362 
1363  const OP_NodeFlags &flags() const
1364  { return myFlags; }
1365  OP_NodeFlags &flags()
1366  { return myFlags; }
1367 
1368  virtual void getSaveFlagsString(UT_String &cmd,
1369  const char *flags,
1370  bool save_to_hip) const;
1371  virtual void getPreParmSaveFlagsString( UT_String &cmd ) const;
1372  virtual void getPostParmSaveFlagsString( UT_String &cmd ) const;
1373 
1374  int hasOpInterest(void *data, OP_EventMethod m) const
1375  { return myEventValue.hasOpInterest(data, m); }
1376  void addOpInterest(void *data, OP_EventMethod m)
1377  { myEventValue.addOpInterest(data, m); }
1378  void removeOpInterest(void *data, OP_EventMethod m)
1379  { myEventValue.removeOpInterest(data, m); }
1380  int isBeingDeleted() const
1381  { return myBeingDeleted; }
1382  void setNodeBeingDeleted(int beingdeleted);
1383 
1384  /// Sets the flag that prevents consolidation of variable inputs.
1385  /// Returns previous value of the flag;
1386  bool setInhibitInputConsolidation(bool value);
1387 
1388  /// Move the upper-left most node in 'ops' to x-coordinate 'x' and to have
1389  /// its TOP border at y-coordinate 'y', and move all other nodes in 'ops'
1390  /// by the same amount. All netboxes in 'netboxes' will also be moved that
1391  /// amount. If a netbox's top border is higher than any node's top border,
1392  /// everything will be moved down accordingly. Note that the repositioning
1393  /// calculation does not include the nodes contained in the network boxes
1394  /// in 'netboxes'.
1395  static void repositionOpsMaxY(OP_NetworkBoxItemList &items,
1396  fpreal x, fpreal y);
1397 
1398  /// Minimum inputs that must be connected to a node for it to cook.
1399  virtual unsigned minInputs() const;
1400 
1401  /// Maximum inputs that can be connected to a node.
1402  virtual unsigned maxInputs() const;
1403 
1404  /// Number of input connectors that should be visible on a node. This is
1405  /// only used by VOPs and DOPs. All other OPs return maxInputs() here.
1406  virtual unsigned getNumVisibleInputs() const;
1407 
1408  /// Returns the number of ordered inputs on a node with unordered inputs.
1409  /// Even nodes with unordered inputs can have a few ordered inputs before
1410  /// the unordered inputs start. If hasUnorderedInputs returns false, this
1411  /// function is meaningless.
1412  virtual unsigned orderedInputs() const;
1413 
1414  /// Maximum number of output connectors on a node. Only VOPs and DOPs ever
1415  /// return a value other than 1 here.
1416  virtual unsigned maxOutputs() const;
1417 
1418  /// Number of output connections that should be visible on a node tile.
1419  /// Only used by VOPs and DOPs.
1420  virtual unsigned getNumVisibleOutputs() const;
1421 
1422  /// Returns true if the operator type says we have unordered inputs.
1423  bool hasUnorderedInputs() const;
1424 
1425  /// Returns the index of the last connected input incremented by one.
1426  /// If there are no inputs connected, returns 0. This means that the
1427  /// function behaves as if the lasted connected input was always the
1428  /// last entry in the inputs array. Note that other array entries up
1429  /// to the index of the one returned may contain null entries, so this
1430  /// is not necessarily the same as the number of connections. Also note
1431  /// that there may be more null entries at indices beyond the returned
1432  /// one.
1433  virtual unsigned nInputs() const;
1434 
1435  /// The number of nodes actually connected to this node. This function
1436  /// goes through the myInputs array and counts non-null entries.
1437  /// @param check_subnet_inside If true, the (vopnet) subnet node will check
1438  /// if a corresponding connector is connected inside, and count it in
1439  /// if so.
1440  unsigned nConnectedInputs(bool check_subnet_inside=true) const;
1441 
1442  unsigned getActiveInputIndex() const
1443  { return myActiveInputIndex; }
1444  void setActiveInputIndex(unsigned idx);
1445 
1446  /// Returns the node connected to a particular input (may be null).
1447  OP_Node *getInput(unsigned idx, bool mark_used=false) const;
1448 
1449  /// Returns the connected input, may be null. If it is a SOP & subnet,
1450  /// and not primary output, will chase to the child output node.
1451  /// This may induce flag dependencies, the provided micronode
1452  /// can accumulate them.
1453  OP_Node *getInputFollowingOutputs(int input,
1454  DEP_MicroNode *depnode=0) const;
1455 
1456  /// Returns the first non-null input beyond the specified starting index.
1457  /// This function can be used to easily loop through all connected inputs.
1458  int getConnectedInputIndex(int startAt = -1) const;
1459 
1460  /// Gets the index of the Nth non-null connection to this node.
1461  int getNthConnectedInput(int n) const;
1462 
1463  /// Override this to specify the inputs which are needed for cooking this
1464  /// node which can be executed in parallel.
1465  virtual void getParallelInputs(OP_Context &context,
1466  OP_NodeList &nodes) const;
1467 
1468  /// Forcibly clear an input. Used when deleting the input.
1469  void forceClearInput(int idx);
1470 
1471  /// Sets a given input to connect to an output of a particular node.
1472  virtual OP_ERROR setInput(unsigned idx, OP_Node *op,
1473  unsigned outputIdx = 0);
1474 
1475  /// Connects an input to an indirect input of our parent subnet.
1476  virtual OP_ERROR setIndirectInput(unsigned idx,
1478 
1479  /// Connects an input to particular node by name in the network.
1480  virtual OP_ERROR setInputReference(unsigned idx, const char *label,
1481  int keeppos, unsigned outputIdx = 0);
1482 
1483  /// Returns the index of the first connection from node "who" to this node,
1484  /// or -1 if "who" is not an input.
1485  int whichInputIs(const OP_Node *who) const;
1486 
1487  /// Returns the index of the first connection of an indirect input.
1488  int whichInputIs(const OP_IndirectInput *who) const;
1489 
1490  // Returns the index of the Nth connection of an idirect input.
1491  int whichInputIs(const OP_IndirectInput *whoi,
1492  int cnt) const;
1493 
1494  // Returns an index of the output which goes out from this node to
1495  // the target_node, and connects to the target_node at the specified
1496  // input index. Returns -1 if the connection doesn't exist.
1497  // Use whichOutputIsFollowingIndirect for a more robust solution.
1498  int whichOutputIs(const OP_Node* target_node,
1499  int input_on_target_node) const;
1500 
1501  // Computes the output, but handles the case that target_node's input
1502  // is an indirect input. This will then follow the indirect chain
1503  // up until a node's real input.
1504  int whichOutputIsFollowingIndirect(
1505  const OP_Node* target_node,
1506  int input_on_target_node) const;
1507 
1508  // Returns the index of an input into which source_node is connected
1509  // on this node. counter determines the Nth such connection from
1510  // source node to this particular node.
1511  int whichInputIs(const OP_Node* source_node,
1512  int counter) const;
1513 
1514  // Compacts the inputs array, removing all null entries.
1515  void consolidateInputs();
1516  virtual void clearUnreferencedInputs();
1517  virtual bool allowConsolidatingInput(int idx);
1518 
1519  // Returns a pointer to an input given an input index. If the input index
1520  // is less than nInputs() it will always return a valid input. If the grow
1521  // flag is set to true, then any inputs between nInputs and the index
1522  // given will be created, up to maxInputs().
1523  virtual OP_Input *getInputReference(unsigned idx, bool grow);
1524 
1525  // As before, except missing inputs are not created. NULL is returned for
1526  // non-existent inputs.
1527  virtual OP_Input *getInputReferenceConst(unsigned idx) const;
1528 
1529  virtual int doDeleteRewire() const { return 1; }
1530  // This moves the input at srcidx to dstidx. forcesubnet will enable
1531  // modificatio of subnet inputs and outputs even when inside a
1532  // blockModify().
1533  virtual void moveInput(int srcidx, int dstidx,
1534  bool forcesubnet = false);
1535  OP_ERROR insertInput(unsigned idx, OP_Node *op,
1536  unsigned outputIdx);
1537  OP_ERROR insertIndirectInput(unsigned idx,
1539 
1540  // For nodes with editable input names, this function is used to set the
1541  // default name for a new input.
1542  virtual UT_Options getInputDataDefault(int idx) const
1543  { return UT_Options(); }
1544 
1545  /// The following methods are used for nodes that allow reordering inputs.
1546  /// Returns the number of inputs that editor should display.
1547  virtual int getInputEditorInputs();
1548  /// Returns true if editor should display parameter option menu button.
1549  virtual bool allowInputEditorInputParm();
1550  /// Returns true if editor should display delete input button.
1551  virtual bool allowInputEditorInputDelete();
1552  /// Gets the input label to display in editor and returns true. Otherwise,
1553  /// returns false if editor should use backward-compatible labeling scheme.
1554  virtual bool getInputEditorInputLabel(UT_String &label, int idx);
1556  virtual const OP_DataMicroNode &
1557  dataMicroNodeConst() const
1558  { return myDataMicroNode; }
1559  OP_DataMicroNode & dataMicroNode()
1560  {
1561  return const_cast<OP_DataMicroNode &>(
1562  dataMicroNodeConst());
1563  }
1564 
1565  /// Subclasses should override this to customize the micro-node dependency
1566  /// of their parameter list. The default is just dataMicroNode().
1567  virtual const OP_DataMicroNode &
1568  parmListMicroNodeConst() const
1569  { return dataMicroNodeConst(); }
1570  OP_DataMicroNode & parmListMicroNode()
1571  {
1572  return const_cast<OP_DataMicroNode &>(
1573  parmListMicroNodeConst());
1574  }
1575 
1576  bool hasIndepParmListMicroNode() const
1577  {
1578  return (&parmListMicroNodeConst()
1579  != &dataMicroNodeConst());
1580  }
1581 
1582  DEP_MicroNode & flagMicroNode()
1583  { return myFlagMicroNode; }
1584  DEP_MicroNode & parmMicroNode(int parm_idx, int vi)
1585  { return getParmList()->parmMicroNode(
1586  parm_idx, vi); }
1588  /// Accessors to event micro nodes.
1589  const DEP_MicroNode &eventMicroNodeConst(OP_EventType e) const
1590  {
1591  return SYSconst_cast(this)->eventMicroNode(e);
1592  }
1593  DEP_MicroNode & eventMicroNode(OP_EventType e);
1594 
1595  bool hasEventMicroNode(OP_EventType e) const
1596  {
1597  return myEventMicroNodes[e] != nullptr;
1598  }
1599 
1600  /// Subclasses should override this provide any additional micronodes that
1601  /// they own. This list is used in places such as node deletion so that
1602  /// dependents are dirtied.
1603  virtual void getOwnedMicroNodes(
1604  DEP_MicroNodeList &micronodes);
1605 
1606  /// Explicitly propagate dirtiness for a particular micronode owned by
1607  /// some node.
1608  void propagateDirtyMicroNode(
1609  DEP_MicroNode &micronode,
1610  OP_EventType reason,
1611  void *data,
1612  bool send_root_event);
1613 
1614  /// Declares that this node's data depends on the @c op for the given
1615  /// reason (OP_INTEREST_DATA, OP_INTEREST_FLAG).
1616  /// @note There are no other acceptable values for type.
1617  virtual void addExtraInput(OP_Node *op, OP_InterestType type);
1618 
1619  /// Declares that this node's data depends on @c op channel. If vec_i is
1620  /// -1, then this node depends on all the channels of the parameter.
1621  void addExtraInput(OP_Node &op, int parm_i, int vec_i);
1622 
1623  /// Generic version of addExtraInput() which adds a dependency from an
1624  /// source ref to this node's data micronode.
1625  void addExtraInput(const OP_InterestRef &source_ref);
1626 
1627  /// Generic version of addExtraInput() which adds a dependency from an
1628  /// source micronode to this node's data micronode.
1629  void addExtraInput(DEP_MicroNode &source_micronode);
1630 
1631  /// Marks this to be dependent on all the parameters inside of the
1632  /// multiparm.
1633  void addMultiparmInterests(OP_Node *srcnode, PRM_Parm &parm);
1634 
1635 
1636  static DEP_MicroNode *getEvalChannelMicroNode(int thread);
1637 
1638  /// Declare from an expression callback that the current evaluation channel
1639  /// is dependent on the given source.
1640  // @{
1641  static void addExtraInputToEvalChannel(
1642  int thread,
1644  {
1645  addExtraInputToEvalChannel(
1646  thread,
1647  OP_InterestRef(op, type));
1648  }
1649  static void addExtraInputToEvalChannel(
1650  int thread,
1651  OP_Node &op, int parm_i, int vec_i)
1652  {
1653  addExtraInputToEvalChannel(
1654  thread,
1655  OP_InterestRef(op,parm_i,vec_i));
1656  }
1657  static void addExtraInputToEvalChannel(
1658  int thread,
1659  const OP_InterestRef &source_ref)
1660  {
1661  DEP_MicroNode *
1662  target = getEvalChannelMicroNode(thread);
1663  if (target)
1664  OP_Node::addExtraInput(*target, source_ref);
1665  }
1666  static void addExtraInputToEvalChannel(
1667  int thread,
1668  DEP_MicroNode &src_micronode)
1669  {
1670  DEP_MicroNode *
1671  target = getEvalChannelMicroNode(thread);
1672  if (target)
1673  target->addExplicitInput(src_micronode);
1674  }
1675  // @}
1676 
1677  /// Generic versions of addExtraInput() used by the others. In particular,
1678  /// the static version of addExtraInput() allows you to define channel to
1679  /// channel dependencies.
1680  // @{
1681  static void addExtraInput(
1682  const OP_InterestRef &target_ref,
1683  const OP_InterestRef &source_ref);
1684  static void addExtraInput(
1685  const OP_InterestRef &target_ref,
1686  DEP_MicroNode &source_micronode);
1687  static void addExtraInput(
1688  DEP_MicroNode &target_micronode,
1689  const OP_InterestRef &source_ref);
1690  // @}
1691 
1692  static void addMultiparmInterests(const OP_InterestRef &target_ref,
1693  OP_Node *srcnode,
1694  PRM_Parm &parm);
1695  static void addMultiparmInterests(DEP_MicroNode &target,
1696  OP_Node *srcnode,
1697  PRM_Parm &parm);
1698 
1699  void getExtraInputNodes(
1700  OP_NodeList &extras,
1701  bool remove_duplicates = true,
1702  bool data_interest = true,
1703  bool parm_interest = true,
1704  bool flag_interest = true,
1705  bool include_parmlist = true,
1706  bool follow_simulation_inputs = false) const;
1707  void getExtraOutputNodes(
1708  OP_NodeList &extras,
1709  bool remove_duplicates = true,
1710  bool data_interest = true,
1711  bool parm_interest = true,
1712  bool flag_interest = true) const;
1713 
1714  int getNumExtraInputs() const;
1715 
1716  void dumpExtraInputs(
1717  std::ostream &os,
1718  bool as_DOT,
1719  int indent_level = 0) const;
1720 
1721  // addExprOpDependency is a helper function for building dependencies for
1722  // the expression library callback functions.
1723  static void addExprOpDependency(const char *arg_str,
1724  const PRM_RefId &ref_id,
1725  OP_InterestType interest_type);
1726  static void addExprOpDependency1From2(const char *arg_str1,
1727  const char *arg_str2,
1728  const PRM_RefId &ref_id,
1729  OP_InterestType interest_type);
1730  static void addExprOpParmDependency(const char *arg_str,
1731  const PRM_RefId &ref_id,
1732  OP_InterestType interest_type);
1733  // NB: is reponsible for freeing new_arg!
1734  static void changeExprOpRef(const char *arg_str,
1735  char *&new_arg,
1736  const char *new_fullpath,
1737  const char *old_fullpath,
1738  const char *old_cwd);
1739  // NB: is reponsible for freeing new_arg!
1740  static void changeExprOpRef1From2(const char *arg_str1,
1741  const char *arg_str2,
1742  char *&new_arg1,
1743  char *&new_arg2,
1744  const char *new_fullpath,
1745  const char *old_fullpath,
1746  const char *old_cwd);
1747  // NB: is reponsible for freeing new_arg!
1748  static void changeExprOpParmRef(const char *arg_str,
1749  char *&new_arg,
1750  const char *new_fullpath,
1751  const char *old_fullpath,
1752  const char *old_cwd,
1753  const char *chan_name,
1754  const char *old_chan_name);
1755 
1756  void addGenericOpNameReference( const UT_String &oppath );
1757  void addGenericOpNameReference( const PRM_RefId &ref_id,
1758  OP_Node *node );
1759  void addGenericOpInputReference( const PRM_RefId &ref_id,
1760  OP_Node *node );
1761 
1762  static void moveAndUpdateDependencies(
1763  const OP_NodeList &src_nodes,
1764  const OP_NodeList &dest_nodes );
1765 
1766  static void updateChannelPtrs( CH_CollectionList &parents );
1767 
1768  bool getParmBaseNodePath(
1769  UT_String &path,
1770  int parm_index,
1771  int thread) const;
1772 
1773  // Make this function public so it can be called by OPUI_EditSubnet
1774  // and possibly others. Note that it is defined in PRM_ParmOwner so
1775  // that it can be called from the PRM library.
1776  virtual void rebuildParmDependency( int parm_index );
1777 
1778  // Clear op name dependencies
1779  virtual void clearParmDependency( int parm_index );
1780  // decrementOpReference() should only be called by clearParmDependency()
1781  void decrementOpReference(int node_id);
1782 
1783  virtual void dumpDependencies(std::ostream &os);
1784  void dumpOpDependents(OP_Node *ref, int brief,
1785  std::ostream &os);
1786  const OP_DependencyList
1787  &getOpDependents() const { return myOpDependents; }
1788 
1789 
1790  // INTERNAL: Do NOT use outside of OP_Node! Will be made private.
1791  int countReferences(int op_id);
1792 
1793  // Get the existing node *NAME* references (eg. expr references)
1794  // NB: This function assumes that refs is sorted without duplicate entries!
1795  void getExistingOpReferences(OP_NodeList &refs,
1796  bool recurse) const;
1797 
1798  // Get the as complete list of data references as possible for this node.
1799  // This combines getExistingOpReferences() which exist without cooking, and
1800  // getExtraInputNodes() which are the current references since the last
1801  // cook of its refernces.
1802  void getFullOpReferences(OP_NodeList &refs,
1803  bool include_descendants) const;
1804 
1805  // Get the existing node *NAME* dependents (eg. expr references)
1806  // NB: This function assumes that deps is sorted without duplicate entries!
1807  void getExistingOpDependents(OP_NodeList &deps,
1808  bool include_descendants) const;
1809 
1810  // Get the as complete list of data dependents as possible for this node.
1811  // This combines getExistingOpDependents() which exist without cooking, and
1812  // getExtraOutputNodes() which are the current dependents since the last
1813  // cook.
1814  void getFullOpDependents(OP_NodeList &deps,
1815  bool include_descendants) const;
1816 
1817  // Gets a list of parms that reference one of our channels/parms.
1818  void getParmsThatReference(const char *channame,
1819  UT_ValArray<PRM_Parm *> &parms,
1820  UT_IntArray &parmsubidxs);
1821 
1822  virtual void inputConnectChanged(int which);
1823 
1824  // Returns the number of output entries in the output array. Note
1825  // that this done regardless of which entries have any outputs connected.
1826  unsigned nOutputEntries() const;
1827  // Get access to the raw network items connected to our outputs.
1828  // These functions can focus on a single output connector, or treat
1829  // all outputs as a flat array by passign output_idx = -1.
1830  int nOutputItems(int output_idx = -1) const;
1831  OP_NetworkBoxItem *getOutputItem(int idx, int output_idx = -1) const;
1832  // Quick check if this node has any node outputs.
1833  bool hasAnyOutputNodes(bool through_dots = true,
1834  int output_idx = -1) const;
1835  // Fills a node list with all outputs from this node. This function can
1836  // search through dots, and dive into subnets. It can also run on a
1837  // single output connector or all of them.
1838  void getOutputNodes(UT_Array<OP_Node*> &outputs,
1839  bool into_subnets = false,
1840  bool through_dots = true,
1841  int output_idx = -1) const;
1842  // Quick function to return the first output node, searching depth first
1843  // through dots if requested.
1844  OP_Node *getFirstOutputNode(bool through_dots = true,
1845  int output_idx = -1) const;
1846 
1847  // obtains an output node that leads to a target node (e.g., during network
1848  // traversal). Null if target is not a descendent.
1849  OP_Node *getOutputTowardsNode(const OP_Node *target);
1850 
1851  /// Fill in 'tree' with details that are common to all node types. Then call
1852  /// fillInfoTreeNodeSpecific() to get specific details about this specific
1853  /// node (be it a SOP, CHOP, etc)
1854  void fillInfoTree(UT_InfoTree &tree,
1855  const OP_NodeInfoTreeParms &parms);
1856 
1857  /// Triggered by 'fillInfoTree()', this virtual function adds all node-
1858  /// specific info to 'tree'. All child classes must create their own
1859  /// branches under 'tree' to place their info
1860  virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree,
1861  const OP_NodeInfoTreeParms &parms);
1862 
1863  /// Optionally called on parent from fillInfoTreeNodeSpecific() to provide
1864  /// some information about node that only parent network can provide.
1865  /// @return True if parent added info specific to that child.
1866  virtual bool fillInfoTreeChildSpecific(UT_InfoTree &tree,
1867  const OP_NodeInfoTreeParms &parms,
1868  OP_Node *child);
1869 
1870  /// This method has to do with 'fillInfoTree()' above. When the call to
1871  /// fillInfoTree() completes, the UT_InfoTree 'tree' will be parsed and
1872  /// displayed in a dialog box by OPUI_OpInfoDialog, at which point, that
1873  /// class will want to ask us - which branch of the tree would you like to
1874  /// be selected by default when the dialog is displayed for the first time?
1875  virtual const char *getDefaultSelectedInfoTreeBranchName() const;
1876 
1877  // These methods get input data for the OP. If they return an error code
1878  // >= UT_ERROR abort, then the errno should be set, and there may be a
1879  // further local error message. There is no error checking to ensure that
1880  // each locked source is only released once, so it's up to the user. The
1881  // standard method is to call lockInputs(), then call unlockInputs() on
1882  // exit. However, in some cases (i.e. switch SOP) only some sources need
1883  // to be cooked.
1884  //
1885  // lockInput() will return an error code >= UT_ERROR iff idx <
1886  // minInputs(). Otherwise, it's considered to be an optional input, so no
1887  // data will be returned. A simple rule of thumb: If lockInput() returns
1888  // ok, the source has to be unlocked, otherwise it shouldn't be unlocked!
1889  // If lockInputs() detects an error, it will automatically unlock the
1890  // inputs so that unlockInputs() should NOT be called!
1891  virtual OP_ERROR lockInput(unsigned idx, OP_Context &context);
1892  virtual void unlockInput(unsigned idx);
1893  virtual OP_ERROR lockInputs(OP_Context &context);
1894  virtual void unlockInputs(void);
1895 
1896  // This "serial" number refers to the number of times that the geometry
1897  // had been changed. Note, only the "modeller" should bump the cook count,
1898  // the OP cook method does this also, but has privilaged access.
1899  int getCookCount(void) const { return myCookCount; }
1900  void triggerOutputChanged();
1901 
1902  void triggerUIChanged(
1905  // Returns the index of cooked input to a SOP switch
1906  virtual int cookedInputIndex() const { return -1; }
1907 
1908  /// For nodes which simply pass-through their data from some other node,
1909  /// this returns the node whose data will used transparently as this node's
1910  /// output. This function can give different values depending on its
1911  /// parameters. Used by node traversal algorithms.
1912  ///
1913  /// The default implementation returns the first input if it's bypassed, so
1914  /// subclasses should only do something different if this function returns
1915  /// NULL.
1916  ///
1917  /// @param t Eval time
1918  /// @param mark_used Mark this node is using the returned node (if
1919  /// non-NULL).
1920  ///
1921  virtual OP_Node *getPassThroughNode(
1922  fpreal t,
1923  bool mark_used = false);
1924 
1925  bool setMinimumCacheSize(int min_size);
1926 
1927  OP_VERSION getVersionParms() const
1928  { return dataMicroNodeConst().modVersion(); }
1929 
1930  // This will be called if the timeInterest flag is set.
1931  // This will return true if the node needs to be dirtied for cooking
1932  virtual bool handleTimeChange(fpreal /* t */) { return false; }
1933 
1934  /// Returns true if the OP depends on time at the given time. This
1935  /// is sensitive to handleTimeChange's overrides.
1936  bool isTimeDependent(OP_Context &context);
1937 
1938  static int getGlobbedNodes(OP_Node *cwd, UT_String &holder,
1939  const char *pattern, UT_WorkArgs &argv,
1941 
1942  static int getGlobbedNetworkBoxes(OP_Node *cwd, UT_String &holder,
1943  const char *pattern, UT_WorkArgs &argv,
1945 
1946  static int getGlobbedPostIts(OP_Node *cwd, UT_String &holder,
1947  const char *pattern, UT_WorkArgs &argv,
1949 
1950 
1951  /// Obtains additional nodes that should be copied or deleted when this
1952  /// node is copied or deleted. It applies to situations, such as, where
1953  /// an hidden input node feeds only to this node and serves only that
1954  /// purpose, so it should be coppied/deleted along with the master.
1955  virtual void getExtraNodesForCopyOrDelete(OP_NodeList &extras)const;
1956 
1957  // Runs the creation script (if there is one). The return value is false
1958  // if the node was deleted while running the script. In this case
1959  // obviously the node pointer becomes invalid and should not be used
1960  // any more. It returns true if the node still exists.
1961  virtual bool runCreateScript();
1962  // Go through all our parms to match the values to the current hip file
1963  // units settings.
1964  void updateParmsToMatchCurrentUnits();
1965 
1966  /// Matches the node to the current HDA definition, loading the contents
1967  /// section if ncecessary and setting the match flag.
1968  virtual void matchOTLDefinition();
1969 
1970  /// Unmatches (unlocks) the node from the current HDA definition.
1971  virtual void unmatchOTLDefinition();
1972 
1973  /// Method that is invoked when the HDA index file has been cleared
1974  /// because the underlying HDA definition has changed.
1975  virtual void handleOTLIndexFileCleared();
1976 
1977  /// Returns the error string where we keep all errors generated during
1978  /// our most recent synchronization attempt.
1979  const UT_String &getSyncErrors() const
1980  { return mySyncErrors; }
1981  /// Returns the error level generated in our last synchronization attempt.
1982  OP_ERROR getSyncErrorLevel() const
1983  { return mySyncErrorLevel; }
1984 
1985  /// Interface to flag that specifies whether or not we match our definition.
1986  int getMatchesOTLDefinition() const;
1987 
1988  /// Utility function for syncing/unsyncing all uncestor nodes.
1989  static void propagateMatchOTLDefinitionToAncestors(OP_Node *node,
1990  bool sync_flag);
1991 
1992  // Some extra functions for dealing with access rights as they relate
1993  // to matching the OTL definition.
1994  int getCanDeviateFromOTLDefinition() const;
1995  void setAllChildAssetPermissions(int permission);
1996  // Recompute the asset permissions because something changed like the node
1997  // was locked or unlocked.
1998  void computeAllChildAssetPermissions();
1999  // Returns true if this node is contained inside a locked HDA, but
2000  // is marked as an editable node within that HDA.
2001  bool getIsEditableAssetSubNode() const;
2002 
2003  // Turn off our export flag and the export flags of our children.
2004  void turnOffAllChildExports(void);
2005 
2006  // Collection of methods for working with licensed assets.
2007  bool haveLicenseToAccessContents(
2008  OP_Node* opt_specific_child = nullptr) const;
2009  bool haveLicenseToAccessParentContents() const;
2010  bool haveAncestorWithoutFullLicense(bool ignore_self) const;
2011  OP_OTLLicenseType getLicense() const;
2012  // Get the first (oldest) ancestor without a license to access contents.
2013  OP_Node *getFirstExecLicenseOnlyAncestor(
2014  bool ignore_self = true) const;
2015  // Get the last (youngest) ancestor without a license to access contents.
2016  OP_Node *getLastExecLicenseOnlyAncestor(
2017  bool ignore_self = true) const;
2018 
2019  bool isCompiled() const;
2020 
2021  // Save as a series of ASCII commands.
2022  void saveWires(std::ostream &os, const char *name,
2023  int dogeneral = 0);
2024  void saveOutputWires(std::ostream &os, const char *name,
2025  int dogeneral = 0);
2026  virtual void saveIntrinsicCommand(std::ostream &os,
2027  const char *name);
2028 
2029  /// Writes to 'os' a string of hscript commands to recreate this node.
2030  virtual OP_ERROR saveCommand(std::ostream &os,
2031  const char *name,
2032  fpreal x,
2033  fpreal y,
2034  const char *netboxname,
2035  const OP_SaveCommandOptions &options);
2036 
2037  // This method saves a chlock style command for this node's parameters.
2038  // name - the name of the node to print on the command;
2039  // command - the name of the command;
2040  // flag_method - a PRM_Parm method that can be queried for the flag to
2041  // output;
2042  // defaultstoo - prints a default "-*" or "+*" as the first parameter
2043  // reverse - normally the default is "-*" followed by the list of
2044  // parameters that result true for flag_method(). If
2045  // reverse is true, then the default is "+*" followed by
2046  // the parameters where flag_method() is false. Only useful
2047  // when defaultstoo is true.
2048  // parm_array - an optional array of parameters whose values should be
2049  // printed. If this array is NULL, then the entire node
2050  // is searched.
2051  void saveParameterFlags(std::ostream &os, const char *name,
2052  const char *command,
2053  bool (PRM_Parm::*flag_method)(int) const,
2054  bool defaultstoo, bool reverse,
2055  UT_Array<opParmData> *parm_array);
2056 
2057  void saveUserDataCommand(
2058  std::ostream &os, const char *node_name,
2059  bool omit_version = false);
2060 
2062  {
2063  RAMP_ERR_SUCCESS,
2064  RAMP_ERR_NOT_FOUND,
2065  RAMP_ERR_ONLY_KEY
2066  };
2067  virtual RampError rampCommand(bool remove, fpreal pos, float rgba[4]);
2068  RampError rampCommand(bool remove, fpreal pos, float rgba[4],
2069  UT_Ramp &ramp);
2070 
2071  virtual bool loadRamp(UT_IStream &is, const char *path=0);
2072 
2073  bool loadRamp(UT_IStream &is, UT_Ramp &ramp,
2074  const char *path=0);
2075  OP_ERROR saveRamp(std::ostream &os, UT_Ramp &ramp,
2076  const char *name = 0, int command = 0);
2077 
2078  bool getUserData(const UT_StringRef &key,
2079  UT_StringHolder &result) const;
2080  void setUserData(const UT_StringRef &key,
2081  const UT_StringHolder &data,
2082  bool save_undo);
2083  bool hasUserData(const UT_StringRef &key) const;
2084  bool deleteUserData(const UT_StringRef &key,
2085  bool save_undo);
2086  const UT_Options &userData() const
2087  { return myUserData; }
2088  bool loadUserData(UT_IStream &is, const char *path=nullptr);
2089  OP_ERROR saveUserData(std::ostream &os, const char *path);
2090  void clearUserData(bool save_undo);
2091  virtual void userDataChanged(const UT_StringHolder &key);
2093  /// Prefix to use for internally used user data.
2094  static const char *internalUserDataPrefix() { return "sidefx::"; }
2095 
2096  /// Returns a shared pointer to a previously stored blind data. If no
2097  /// blind data exists with the given key, an empty shared pointer is
2098  /// returned.
2099  UT_SharedPtr<void> getBlindData(const char *key) const;
2100 
2101  /// Return a pointer to a previously stored blind data, statically cast
2102  /// to the type given. If the cast fails, or if there's no data of that
2103  /// type, a NULL pointer is returned. To distinguish between the two cases
2104  /// call hasBlindData().
2105  template<typename T>
2106  UT_SharedPtr<T> getBlindData(const char *key) const
2107  { return UTstatic_pointer_cast<T>(getBlindData(key)); }
2108 
2109  /// Stores a blind data pointer on this OP_Node object. Any entry that
2110  /// previously existed will be erased, and, if it is the last reference,
2111  /// the object itself deleted. The \c void type can convert from any other
2112  /// shared pointer type, while storing the deleter function, allowing
2113  /// OP_Node to delete the data without knowing anything about the class.
2114  /// Blind data is *not* stored with the class.
2115  void setBlindData(const char *key, UT_SharedPtr<void> ptr);
2116 
2117  /// Returns true if this object stores a blind data with the given key.
2118  bool hasBlindData(const char *key) const;
2119 
2120  /// Remove any reference to the blind data of the given key from this
2121  /// object.
2122  bool deleteBlindData(const char *key);
2123 
2124  void getDataBlockKeys(UT_StringArray &keys,
2125  const UT_StringHolder &type =
2126  UT_StringHolder()) const;
2127  OP_DataBlockPtr getDataBlock(const char *key) const;
2128  void setDataBlock(const char *key, OP_DataBlockPtr ptr);
2129  OP_ERROR saveDataBlocksPacket(std::ostream &os,
2130  const char *path_prefix,
2131  const UT_String &node_name);
2132  bool loadDataBlocks(UT_IStream &is, const char *path);
2133  virtual void dataBlockChanged(const UT_StringHolder &key);
2134 
2135  // deleteNodeData is called when the OP_Cache wants to delete some data.
2136  // This method should return 1 if you want change events to be propagated
2137  // to the extra inputs when data is deleted from the cache.
2138  virtual int deleteNodeData(void *);
2139  void propagateNodeDataDeleted();
2140 
2141  // getCachedPythonObject returns NULL if no object exists with the given
2142  // key.
2143  PY_OpaqueObject *getCachedPythonObject(const char *key) const;
2144  // Call setCachedPythonObject with a PyObject * cast to a void *, not with
2145  // a PY_OpaqueObject * cast to a void *. The pointer must not be null.
2146  void setCachedPythonObject(
2147  const char *key, void *opaque_py_object);
2148  // deleteCachedPythonObject returns false if no value exists with that key.
2149  bool deleteCachedPythonObject(const char *key);
2150  // cachedPythonObjects returns a UT_SymbolMap containing pointers to
2151  // PY_OpaqueObjects. The pointers are not null.
2152  const OP_PythonObjectCache &cachedPythonObjects() const
2153  { return myCachedPythonObjects; }
2154 
2155  bool loadExtraInputs(UT_IStream &is, const char *path=0);
2156 
2157  void saveOverrides(std::ostream &os);
2158  void saveOverrides(std::ostream &os, OP_Node *root,
2159  const UT_String &rootpath,
2160  bool &added);
2161  void saveChildOverrides(std::ostream &os, OP_Node *root,
2162  const UT_String &rootpath,
2163  bool &added);
2164  bool loadOverride(UT_IStream &is);
2165  virtual UT_ErrorSeverity
2166  prmCookOverrides(fpreal t, int thread,
2167  const char *parm_name, int vec_idx);
2168  virtual bool isParmPendingOverride(const char *parm_name,
2169  int vec_idx) const;
2170  OP_ERROR cookOverrides(OP_Context &c);
2172  virtual void removeOverrideDestination(OP_Node * /*dest*/) {}
2173  virtual void removeOverrideDestination(OP_Node * /*dest*/,
2174  int /*parm_idx*/) {}
2175 
2176  // Overriding virtual function in PRM_ParmOwner to run a command.
2177  virtual void executeCommand(const char *command,
2178  std::ostream *out,
2179  std::ostream *err) const;
2180  virtual void pushAsPwdAndRunPython(
2181  PY_CompiledCode &compiled_code,
2182  PY_Result::Type desired_result_type,
2183  PY_Result &result,
2184  PY_EvaluationContext *context=nullptr) const;
2185 
2186  OP_ERROR executeHscriptScript(UT_String &script,
2187  const OP_Context &context);
2188  OP_ERROR executePythonScript(UT_String &script,
2189  const OP_Context &context);
2190 
2191  void addPythonNodeError(const PY_Result &py_result);
2192 
2193  void saveInputs(std::ostream &os, bool compile_basic);
2194  bool loadInputs(UT_IStream &is, const char *path=0,
2195  bool named = false);
2196  void saveNamedInputs(std::ostream &os, bool compile_basic);
2197  void saveNamedOutputs(std::ostream &os);
2198  bool loadNamedOutputs(UT_IStream &is, const char *path=0);
2199 
2200  // These methods provide access to the options that can be stored on each
2201  // input of a node, if the node type enables this feature.
2202  void getEditableInputDataKeys(int idx,
2203  UT_StringArray &keys) const;
2204  const UT_OptionEntry*getEditableInputData(int idx,
2205  const UT_StringRef &key) const;
2206  void setEditableInputData(int idx,
2207  const UT_StringHolder &key,
2208  const UT_OptionEntry &value);
2209  void saveEditableInputData(std::ostream &os) const;
2210  bool loadEditableInputData(UT_IStream &is,
2211  const char *path);
2212  // Special case functions for getting and setting the input "name", which
2213  // just call the generic InputData functions.
2214  UT_StringHolder getEditableInputString(int idx,
2215  const UT_StringRef &key) const;
2216  void setEditableInputString(int idx,
2217  const UT_StringRef &key,
2218  const UT_StringHolder &str);
2219 
2220  /// @{ If a subclass is interested in the saved input or output names, then
2221  /// it should override this method. The array will be filled during load.
2222  virtual UT_StringArray * getArrayForLoadedInputNames();
2223  virtual UT_StringArray * getArrayForLoadedOutputNames();
2224  /// @}
2225 
2226  void checkInputs(); // this method will check the
2227  // node references in all the inputs
2228 
2229  // Saves out extra information for this node to be included in a dialog
2230  // script that defines an operator type created from this one.
2231  virtual void saveDialogScriptExtraInfo(std::ostream &os);
2232 
2233  // Fills in the supplied default gallery entry with info from this node.
2234  virtual void createGalleryEntry(OP_GalleryEntry &entry);
2235 
2236  // When a string parameter can have the syntax: 'op:/...', use these
2237  // evaulate methods to do the approprate checking and reference building.
2238  // These methods will return a reference to the OP_Node if one is
2239  // referenced. If the syntax is something like:
2240  // op:/foo/bar[32]
2241  // Then the optime will be (32-1)/$FPS rather than the evaluation time.
2242  void evalOpPathString(UT_String &val, int pi, int vi,
2243  fpreal t, int &op_id, fpreal &op_time,
2244  int expanded = 1);
2245  void evalOpPathString(UT_String &val, const char *pn,
2246  int &pi, int vi, fpreal t,
2247  int &op_id, fpreal &op_time,
2248  int expanded=1);
2249  static int findOpFramePair(const char *path, int &op_id,
2250  fpreal &frame);
2251 
2252  /// Build a UT_XformOrder out of TRS and XYZ parameter values
2253  static void buildXformOrder(int trs, int xyz,
2254  UT_XformOrder &order);
2255 
2256  static const UT_XformOrder& buildXformOrder(int trs, int xyz );
2257 
2258  /// Translate a TRS parameter menu index into the UT_XformOrder type
2259  static UT_XformOrder::rstOrder getMainOrder( int trs );
2260  /// Translate a UT_XformOrder type into a TRS parameter menu index
2261  /// (inverse of getMainOrder())
2262  static int getMainOrderMenuIndex(UT_XformOrder::rstOrder order);
2263  /// Translate a XYZ parameter menu index into the UT_XformOrder type
2264  static UT_XformOrder::xyzOrder getRotOrder( int xyz );
2265  /// Translate a UT_XformOrder type into a XYZ parameter menu index
2266  /// (inverse of getRotOrder())
2267  static int getRotOrderMenuIndex(UT_XformOrder::xyzOrder order);
2268 
2269  /// NB: None of the getXformPivot() or getPivotParmValue() methods take
2270  /// any pivot compensation transform into account. It is up to the
2271  /// caller to account for any such transform.
2272  static UT_Vector3R getXformPivot(int trs,
2273  fpreal tx, fpreal ty, fpreal tz,
2274  fpreal px, fpreal py, fpreal pz);
2275  static UT_Vector3R getXformPivot(int trs,
2276  fpreal tx, fpreal ty, fpreal tz,
2277  fpreal px, fpreal py, fpreal pz,
2278  fpreal pivot_rx, fpreal pivot_ry,
2279  fpreal pivot_rz, bool inverse = false);
2280  static UT_Vector3R getPivotParmValue(int trs,
2281  fpreal tx, fpreal ty, fpreal tz,
2282  fpreal px, fpreal py, fpreal pz);
2283  static UT_Vector3R getPivotParmValue(int trs,
2284  fpreal tx, fpreal ty, fpreal tz,
2285  fpreal px, fpreal py, fpreal pz,
2286  fpreal pivot_rx, fpreal pivot_ry,
2287  fpreal pivot_rz, bool inverse = false);
2288 
2289  static void buildXform(int trs, int xyz,
2290  float tx, float ty, float tz,
2291  float rx, float ry, float rz,
2292  float sx, float sy, float sz,
2293  float px, float py, float pz,
2294  UT_Matrix4 &mat);
2295  static void buildXform(int trs, int xyz,
2296  double tx, double ty, double tz,
2297  double rx, double ry, double rz,
2298  double sx, double sy, double sz,
2299  double px, double py, double pz,
2300  UT_DMatrix4 &mat);
2301  static void buildXform(int trs, int xyz,
2302  float tx, float ty, float tz,
2303  float rx, float ry, float rz,
2304  float sx, float sy, float sz,
2306  UT_Matrix4 &mat);
2307  static void buildXform(int trs, int xyz,
2308  double tx, double ty, double tz,
2309  double rx, double ry, double rz,
2310  double sx, double sy, double sz,
2312  UT_DMatrix4 &mat);
2313  static void buildXform(int trs, int xyz,
2314  float tx, float ty, float tz,
2315  float rx, float ry, float rz,
2316  float sx, float sy, float sz,
2317  float s_xy, float s_xz, float s_yz,
2318  float px, float py, float pz,
2319  UT_Matrix4 &mat);
2320  static void buildXform(int trs, int xyz,
2321  double tx, double ty, double tz,
2322  double rx, double ry, double rz,
2323  double sx, double sy, double sz,
2324  double s_xy, double s_xz, double s_yz,
2325  double px, double py, double pz,
2326  UT_DMatrix4 &mat);
2327  static void buildXform(int trs, int xyz,
2328  float tx, float ty, float tz,
2329  float rx, float ry, float rz,
2330  float sx, float sy, float sz,
2331  float s_xy, float s_xz, float s_yz,
2333  UT_Matrix4 &mat);
2334  static void buildXform(int trs, int xyz,
2335  double tx, double ty, double tz,
2336  double rx, double ry, double rz,
2337  double sx, double sy, double sz,
2338  double s_xy, double s_xz, double s_yz,
2340  UT_DMatrix4 &mat);
2341  static void buildXform(
2342  const UT_Matrix4F::FullTransformModel &parms,
2343  UT_Matrix4F &mat);
2344  static void buildXform(
2345  const UT_Matrix4D::FullTransformModel &parms,
2346  UT_Matrix4D &mat);
2347  static void buildXform(int trs,
2348  float tx, float ty, float rz,
2349  float sx, float sy, float px, float py,
2350  UT_Matrix3 &mat);
2351  static void buildXform(int trs,
2352  double tx, double ty, double rz,
2353  double sx, double sy, double px, double py,
2354  UT_DMatrix3 &mat);
2355  static void buildXform(int trs,
2356  float tx, float ty, float rz,
2357  float sx, float sy, float s_xy,
2358  float px, float py,
2359  UT_Matrix3 &mat);
2360  static void buildXform(int trs,
2361  double tx, double ty, double rz,
2362  double sx, double sy, double s_xy,
2363  double px, double py,
2364  UT_DMatrix3 &mat);
2365 
2366  virtual int getTranslateParmIndex();
2367 
2368  // This is done only after a load to make sure that
2369  // all inputs have been resolved correctly.
2370  void resolveInputReferences();
2371 
2372  static void clearAllPendingUndoFlags();
2373 
2374  virtual void clearUndoFlags();
2375  virtual void setAnyUndoFlag();
2376  void saveForUndoInput();
2377 
2378  void blockModify(int on_off, int propagate = 1);
2379  int isBlockModify(void) const;
2380  bool isModifyWaiting() const;
2381  virtual void propagateEndBlockModify();
2382 
2383  // Only returns anything in the case of chops
2384  virtual const CL_Clip *getClip(OP_Context *context = 0);
2385 
2386  /// Returns the a chop network path suitable for storing motion effects
2387  /// associated with this node.
2388  void getMotionEffectsNetworkPath(UT_String &path);
2389 
2390  /// Return the cook information as a formatted string.
2391  void getCookInfo(UT_String &info) const;
2392  /// Return the cook information in a UT_InfoTree.
2393  void getCookInfoTree(UT_InfoTree &tree) const;
2394 
2395  // Query color for Net Overview rendering
2396  virtual int getNetOverviewColor( UT_Color &color );
2397 
2398  // Those operators which need a ramp editor must define this method.
2399  virtual UT_Ramp *getRamp();
2400 
2401  virtual int isCookingRender() const { return 0; }
2402  virtual void setCookingRender(int val);
2403 
2404  virtual void clearInterrupted()
2405  { clearInterruptedImpl(/*allow_recook*/true); }
2406  int wasInterrupted() const
2407  { return flags().getInterrupted(); }
2408 
2409  // work-around to display warning message when export src or destination
2410  // are renamed. OP_Node::cook clears the error messages when a node export
2411  // changes so we had to save the fact that a rename conflict is pending
2412  void setRenameConflict()
2413  { myRenameConflict = 1; }
2414  void setRunningCreateScript(int onoff);
2415 
2416  // Base class methods to output code to a file or a stream:
2417  virtual int outputCode(OP_OutputCodeParms &, OP_Context &);
2418 
2419  virtual fpreal getTimeTransform(int input, fpreal t);
2420  virtual void getInputRes(int input, fpreal t,
2421  const OP_Context &context,
2422  OP_Context &input_context);
2423 
2424  // Utility methods:
2425  UT_TokenString & getHashCode(OP_Context &context, int group_mask =1);
2426  virtual UT_TokenString & getParmHashCode(OP_Context &context,
2427  int group_mask = 1);
2428 
2429  virtual int getNumInputsToHash();
2430  virtual OP_Node *getInputToHash(int i);
2432  void clearHashCodeFlags();
2433  bool isHashCodeBuilt() const { return myBuiltHashCode;}
2434  void builtHashCode(bool b = true) { myBuiltHashCode = b; }
2435  void buildInputHashCode(UT_TokenString &string,
2437  int group_mask,
2438  int level);
2440  // If an interactive state was used to create this node, set it here.
2441  void setCreatorState(const char *s)
2442  { myCreatorState.harden(s); }
2443  const UT_String &getCreatorState() const { return myCreatorState; }
2444  void builtExplicitly(int yn) { myBuiltExplicitly = yn; }
2445  int wasBuiltExplicitly() const{ return myBuiltExplicitly; }
2446 
2447  bool matchesState(const char *state) const;
2448 
2449  /// Some nodes (VOPs and SHOPs) represent shaders, so this method
2450  /// returns node parameters that are used as shader parameters.
2451  virtual const PRM_Template *getShaderParmTemplates();
2452 
2453  // Don't even think about calling changeParmTemplate if you aren't
2454  // OP_Operator.
2455  virtual void changeParmTemplate(PRM_Template *new_template);
2456 
2457  // Deletes any input or output connections in excess of maximum allowed.
2458  virtual void ensureInputsAndOutputsAreValid();
2459 
2460  // Connect the node to an input. If branch_off is false and the input node
2461  // currently has outputs, the node will be inserted before the outputs.
2462  void connectToInputNode(OP_Node &inputnode, int input_idx,
2463  int branch_off=0);
2464 
2465  // This method should be called when the user edits an overridden channel
2466  virtual int editCallback(CL_Track *track, fpreal t,
2467  fpreal newValue);
2468 
2469  // This mechanism allows users to communicate editing changes
2470  static OP_EditCallback getEditCallback(void *&data);
2471  //static void setEditCallback(OP_EditCallback func,
2472  //void *data);
2473 
2474  // These build an xform matrix based upon the given parameters.
2475  // The axis is the axis around which to rotate by 90 degrees. If
2476  // it is lower case, it will be rotated by +90, if it is upper case,
2477  // by -90. To not rotate at all, use '-'.
2478  static void buildQuadricXform(UT_Matrix4 &mat,
2479  float tx, float ty, float tz,
2480  float sx, float sy, float sz,
2481  char axis = 'y',
2482  float rx = 0.0f, float ry = 0.0f,
2483  float rz = 0.0f);
2484 
2485  static void buildQuadricXform(UT_DMatrix4 &mat,
2486  double tx, double ty, double tz,
2487  double sx, double sy, double sz,
2488  char axis = 'y',
2489  double rx = 0.0, double ry = 0.0,
2490  double rz = 0.0);
2491 
2492  static int buildOpMenu(OP_Network *net, PRM_Name *theMenu,
2493  int theMenuSize, int (*doAdd)(OP_Node *) = 0,
2494  int startItem = 0, const PRM_Parm *parm = 0,
2495  int showSubnets = 1, int expandSubnets = 1,
2496  bool recurse = false);
2497 
2498  // Build the "Predefined Rules" menu that is common to several OPs
2499  // including Event and Group POPs. This is built from the text file table
2500  // OP<name>Rules, where name is the OP type (ie Event).
2501  static void buildPreDefRulesMenu(PRM_Name *menu,
2502  OP_PreDefRules &pdr);
2503 
2504  // Allows operators to use their own local table for variables and build
2505  // structures on demand... Implement the syntax highlight version only
2506  // if you need to resolve variables for syntax highlighting that are not
2507  // normally resolved by the generic resolveVariable() method.
2508  virtual const CH_LocalVariable *resolveVariable(const char *name);
2509  virtual const CH_LocalVariable *resolveExtraVariableForSyntaxHighlight(
2510  const char *name);
2511 
2512  // This value bumps whenever nodes are created/deleted/renamed.
2513  static int getNameSerialIndex();
2514 
2515  // export mapping techniques
2516  virtual void setMapping(int idx, int type, const char *label = 0);
2517  virtual int getMapping(int idx, const char *&label) const;
2518 
2519  // drag-n-drop receive methods
2520  virtual int acceptDragDrop(DD_Source &src, const char *label);
2521  virtual int testDragDrop(DD_Source &src);
2522  virtual void getDragDropChoice(DD_Source &src, DD_ChoiceList &c);
2523 
2524  // These methods are used to give quick overview information about a node
2525  bool hasComment() const;
2526  bool hasParmsNotAtFactoryDefault() const;
2527  bool hasAnimatedParms() const;
2528  bool hasChopOverriddenParms() const;
2529 
2530  /// traverseInputs calls 'callback' on this node and all its inputs.
2531  /// If callback returns true for any node, it will stop and return
2532  /// true, otherwise it will return false;
2533  /// @param callback Callback function
2534  /// @param data User data passed to the callback function
2535  /// @param opts A set of flags to configure the traversal:
2536  /// TRAVERSE_INTO_SUBNETS If input is a subnet, we continue
2537  /// traversing from its display node.
2538  /// TRAVERSE_REF_INPUTS Follow inputs marked as reference inputs
2539  /// TRAVERSE_ONLY_USED_INPUTS Follow only inputs used in the last cook
2540  /// TRAVERSE_PASSTHROUGH_INPUTS Use the getPassThroughNode to traverse
2541  /// through nodes that directly steal their
2542  /// input node's data.
2543  /// TRAVERSE_EXTRA_INPUTS Follow nodes which this node implicitly
2544  /// depends on.
2545  /// TRAVERSE_SIMULATION_INPUTS For nodes that are DOP parents, grab extra
2546  /// inputs from the simulation.
2547  /// TRAVERSE_COOKED_INPUT_INDEX_INPUTS
2548  /// Uses the cookedInputIndex method to
2549  /// traverse "passthrough"-type inputs for
2550  /// nodes that might trigger a cook when
2551  /// calling getPassThroughNode, but where we
2552  /// want to avoid triggering a cook.
2553  /// @param extra_interest_mask For extra inputs, this mask allows one to
2554  /// restrict which of those dependency types
2555  /// follow.
2556  //@{
2558  TRAVERSE_DEFAULT = 0x0000,
2559  TRAVERSE_INTO_SUBNETS = 0x0001,
2560  TRAVERSE_REF_INPUTS = 0x0002,
2561  TRAVERSE_ONLY_USED_INPUTS = 0x0004,
2562  TRAVERSE_PASSTHROUGH_INPUTS = 0x0008,
2563  TRAVERSE_EXTRA_INPUTS = 0x0010,
2564  TRAVERSE_SIMULATION_INPUTS = 0x0020,
2565  TRAVERSE_COOKED_INPUT_INDEX_INPUTS = 0x0040,
2566  };
2567  bool traverseInputs(bool (*callback)(OP_Node &, void *),
2568  void *data,
2569  TraverseOptions opts,
2570  OP_InterestType extra_interest_mask =
2571  OP_INTEREST_ALL);
2572  bool traverseInputs(bool (*callback)(const OP_Node &, void*),
2573  void *data,
2574  TraverseOptions opts,
2575  OP_InterestType extra_interest_mask =
2576  OP_INTEREST_ALL) const;
2577  //@}
2578 
2579  /// Traverses children of this node, calling 'callback' on all children.
2580  /// If callback returns true, the traversal stops at that node.
2581  bool traverseChildren(bool (*callback)(OP_Node &, void*),
2582  void *data,
2583  bool recurse_into_subnets);
2584 
2585  // Very specialized to see if this node (and optionally, any input
2586  // ancestors are also cooking.
2587  bool isCooking(bool include_ancestors) const;
2588 
2589  // This method returns true if the OP_Node makes use of its footprint
2590  // flag and false otherwise.
2591  virtual bool usesFootprint() const { return false; }
2592 
2593  void getExternalReferences(UT_StringArray &reflist,
2594  UT_StringArray *nodelist = 0,
2595  bool from_children_too = true,
2596  bool collapse = false,
2597  bool check_missing = false,
2598  bool show_missing_only = false);
2599  virtual bool getSaveWithVopnets();
2600  virtual void runDelScript();
2601  /// Overriden in VOPs to remove any channel refrences we may have
2602  /// to the node being deleted.
2603  virtual void preDelete() { }
2604 
2605  // Two functions for upcasting this node to a DOP_Parent. DOP_Parent
2606  // is a class which owns a simulation and has DOP_Nodes as children.
2607  virtual DOP_Parent *castToDOPParent() { return 0; }
2608  virtual const DOP_Parent *castToDOPParent() const { return 0; }
2610  // These provide a version which you can query without being above DOP.
2612  { return (OP_DopParent *) castToDOPParent(); }
2613  const OP_DopParent *castToOpDopParent() const
2614  { return (const OP_DopParent *) castToDOPParent(); }
2615 
2616  // This function upcasts this node to a VOP_CodeGenerator.
2617  // VOP_CodeGenerator is a class which generates VEX code from the VOPs
2618  // contained inside the node.
2619  virtual VOP_CodeGenerator *getVopCodeGenerator() { return 0; }
2620  virtual VOP_CodeGenerator *getVopAutoCodeGenerator() { return 0; }
2621 
2622  // Return the manager that handles exported parameters from contained
2623  // Parameter VOPs. Only certain kinds of VOP nodes can have such a manager
2624  // (i.e. Subnet VOPs, VOP HDAs). Note that a node cannot have both a code
2625  // generator AND a parms manager because the code generator already has its
2626  // own parms manager.
2627  virtual VOP_ExportedParmsManager *getVopExportedParmsManager(
2628  bool create_if_needed=false)
2629  { return nullptr; }
2630 
2631  /// @{
2632  /// Methods to postpone the update of the code generator until ending
2633  /// the last (level zero) update. This avoids recalculation of parameters
2634  /// and vop signatures, which can be quite costly.
2635  // TODO: remove these two virtuals in farour of getVopCodeGenerator()
2636  // returning OP_VopCodeGenerator from which VOP_CodeGenerator
2637  // derives and which has these two virtuals available at OP level.
2638  virtual int beginVopCodeGeneratorUpdate() { return 0; }
2639  virtual void endVopCodeGeneratorUpdate(int update_level) {}
2640  /// @}
2641 
2642  // Build a command line for a VEX script to be called with. This does all
2643  // the channel evaluation and string expansion required. If there is an
2644  // error, 0 is returned (otherwise 1).
2645  int buildVexCommand(UT_String &result,
2646  const PRM_Template *templatelist,
2647  fpreal now,
2648  int start_parm = 0,
2649  int end_parm = INT_MAX,
2650  bool use_parmvop_tag=true
2651  );
2652  int buildVexCommandWithDependencies(OP_Node *owner,
2653  DEP_MicroNode *depnode,
2654  UT_String &result,
2655  const PRM_Template *templatelist,
2656  fpreal now,
2657  int start_parm = 0,
2658  int end_parm = INT_MAX,
2659  bool use_parmvop_tag=true
2660  );
2661 
2662  // Builds a VEX script using standardized parameter names.
2663  // "vexsrc": int for myself, shop, or script.
2664  // "script": raw vex script
2665  // "soppath": for the shop path.
2666  static PRM_ChoiceList theVexSrcParmMenu;
2667  static PRM_Name theVexSrcParmName;
2668  static PRM_Name theVexScriptParmName;
2669  static PRM_Name theVexNodePathParmName;
2670  static PRM_Name theVexClearParmName;
2671  static PRM_Name theVexCWDName;
2672  virtual void buildVexScript(UT_String &script, fpreal t,
2673  OP_Node *owner,
2674  UT_Map<int, bool> *visitlist = 0);
2675  virtual void buildVexScript(UT_String &script, fpreal t,
2676  DEP_MicroNode *depnode,
2677  UT_Map<int, bool> *visitlist = 0);
2678 
2679 
2680  // Returns true if vex shader has parameter by a given name.
2681  virtual bool hasVexShaderParameter(const char *parm_name);
2682 
2683 
2684  /// This function returns a string that encodes all the necessary
2685  /// information about a node-based material that helps the script-based
2686  /// materials to function properly. The string usually encodes info stored
2687  /// on child nodes, such as rendering properties or procedurals. Then
2688  /// the script node can use that info to provide necessary data
2689  /// for rendering.
2690  /// Returns true if the method provides usable information.
2691  virtual bool getScriptMaterialInfo( UT_String & mat_info,
2692  VOP_ScriptMaterialCodeMapper * mapper )
2693  { return false; }
2694 
2695  /// Returns the sub type name, if the node's operator wants to be
2696  /// saved as an HDA in a special way (ie, other than the regular
2697  /// scripted operator handling). The sub type name is then used
2698  /// to distinguish how to handle the HDA creation.
2699  virtual const char *getHDASubType()
2700  { return 0; }
2701 
2702  // Set the channel alias for a channel (or parm subindex). Returns true
2703  // if successful and false otherwise.
2704  bool setChannelAlias(PRM_Parm &parm, int subindex,
2705  const char *alias_name);
2706 
2707  void disconnectAllInputsOutputs(bool keepSelected,
2708  bool forceDisconnectOutputs = false);
2709 
2710  void disconnectAllInputs(void);
2711  void disconnectAllOutputs(void);
2712 
2713  // Notify dependents that a parm name has changed.
2714  virtual void notifyParmRenameDependents(
2715  const UT_String &chan_name,
2716  const UT_String &old_chan_name );
2717 
2718  void writeChannel(CH_Channel *channel, std::ostream &os,
2719  const char *name, bool frames);
2720  void writeAllChannels(std::ostream &os, const char *name,
2721  bool frames, bool dochblock,
2722  bool dospareparms);
2723 
2724  // Run the callback function for a particular parm, and the callbacks
2725  // of any parms linked to this parm. Returns false if the node is
2726  // deleted while running the callback.
2727  virtual bool triggerParmCallback(PRM_Parm *parmptr, fpreal now,
2728  int value, void *data,
2729  const UT_Options *options=0);
2730 
2731  virtual int64 getMemoryUsage(bool inclusive) const;
2732  int64 getExtraInputMemoryUsage() const;
2733  static void printOpMemoryUsageStats(std::ostream &os);
2734 
2735  /// This method will unscope all the channels belonging to this op.
2736  /// If the recurse flag is set it will recurse through the children
2737  /// (at this level the recurse flag is ignored).
2738  virtual void unscopeChannels(bool recurse);
2739 
2740  /// This method will undisplay all the channels belonging to this op.
2741  /// If the recurse flag is set it will recurse through the children
2742  /// (at this level the recurse flag is ignored).
2743  virtual void undisplayChannels(bool recurse);
2744 
2745  /// This method will unpin all the channels belonging to this op.
2746  /// If the recurse flag is set it will recurse through the children
2747  /// (at this level the recurse flag is ignored).
2748  virtual void unpinChannels(bool recurse);
2749 
2750  /// This method takes a pattern string and will perform the ch_scope_op
2751  /// on each of our paramaeters that match the pattern. This method
2752  /// primarily supports the chscope command.
2753  virtual void setChannelScope(const char *pattern,
2754  OP_ScopeOp scope_op,
2755  const OP_ScopeOptions &scope_opts);
2756 
2757  /// A simple wrapper around getName() to allow us to abstract its
2758  /// functionality up to OP_NetworkBoxItem.
2759  virtual const UT_String &getItemName() const
2760  { return getName(); };
2761  virtual bool setItemName(const UT_String &name);
2762 
2763  /// Caches the descriptive name to member data, and returns that. The
2764  /// cache is automatically dirtied in opChanged.
2765  const UT_StringHolder &getCachedDescriptiveName();
2766 
2767  // This function is called when our spare parm definition is changing.
2768  virtual bool changeSpareParms(UT_IStream &istream,
2769  UT_String &errors);
2770  // This function is called during the changeSpareParms operation when
2771  // one of our parameters is being removed.
2772  virtual void spareParmRemoved(const char *parmname);
2773 
2774  // This is a secondary parm list where all obsolete parameters are
2775  // placed (if any)
2777  virtual void resolveAndDeleteObsoleteParmList(
2778  PRM_ParmList *&obsolete_parms);
2779 
2780  virtual unsigned referenceAllParameters(OP_Parameters *from,
2781  bool relative_references = true);
2782 
2783  void clearVersionUserData();
2784  void updateVersionUserData();
2785 
2786  /// After the nodes parameter list is loaded, syncNodeVersionIfNeeded() is
2787  /// called to perform any necessary upgrades if the version number of
2788  /// the loaded node (taken from user data) is different from the node
2789  /// type's version number (getOperator()->getVersion()). Use the
2790  /// from_version parameter to override the node current version.
2791  /// If needed, this will call syncNodeVersion(). After synching, the node's
2792  /// version user data will be set to the current version if
2793  /// update_node_version is true.
2794  void syncNodeVersionIfNeeded(
2795  bool *node_deleted,
2796  const char *from_version = nullptr,
2797  bool update_node_version = false);
2798 
2799  /// Sync the node assuming that it is currently at old_version to the
2800  /// current_version. By default, this will call the corresponding
2801  /// OTL_SYNCNODEVERSION section if it exists.
2802  virtual void syncNodeVersion(
2803  const char *old_version,
2804  const char *current_version,
2805  bool *node_deleted);
2806 
2807  // Sets the given stamping parameter.
2808  // Returns true if the param was changed. Note that we may return false
2809  // even if this was a valid operation as param might have already been
2810  // set to the given value.
2811  // If the warned variable is given, then we only warn if its contents
2812  // is false. Then in that case, we will set it to true when needed.
2813  bool setGlobalFloatParam(const char *param,
2814  fpreal value,
2815  bool *warned);
2816  bool setGlobalStringParam(const char *param,
2817  const char *strvalue,
2818  bool *warned);
2819 
2820  // This allows one to prevent chop cooking due to parameter modifications
2821  // until the outermost block is done.
2822  void beginPropagateModification();
2823  void endPropagateModification();
2824 
2825  // Add any OTL-defined operators used by this node to the specified table.
2826  virtual void getActiveOperatorsDefinedByOTL(
2827  UT_Set<OP_Operator *> &active_operators) const;
2828 
2829  // Returns true if we are in the middle of a call to sendBulkNotifications,
2830  // Or doing some other operation that involves sending out a whole bunch
2831  // of change notifications all at once. This allows VOP Networks to avoid
2832  // over-cooking.
2833  static bool getDoingBulkNotification();
2834  static bool isDirectorDoingBulkNotification();
2835 
2836  /// Returns whether multi-inputs on this particular op might have different
2837  /// names for each of the inputs, or if the name will always be the same for
2838  /// all the inputs.
2839  virtual bool hasDifferentMultiInputs() const;
2840 
2841 
2842  virtual bool canCreateNewOpType() const;
2843  static bool createNewOpType
2844  (OP_Node *node,
2845  UT_String &errors,
2846  const char *typeName=nullptr,
2847  const char *typeLabel=nullptr,
2848  const char *otlFile=nullptr,
2849  const char *metaSource=nullptr,
2850  const char *comment=nullptr,
2851  const char *version=nullptr,
2852  const char *newName=nullptr,
2853  int minimumInputs=-1,
2854  int maximumInputs=-1,
2855  bool ignore_external_references=false,
2856  bool compress_contents=false,
2857  bool force=false,
2858  int *newNodeId=nullptr,
2859  bool compile_contents = false,
2860  bool change_node_type = true,
2861  bool create_backup = true);
2863  virtual UT_String *getMaterialIconFilename() { return 0; }
2864  virtual void setMaterialIconFilename(const char * /*icon_file*/) {}
2865  virtual IMG_Raster *getMaterialIconImage() { return 0; }
2866  virtual bool getMaterialIconAllowRegenerateFlag() { return true; }
2867  virtual void setMaterialIconAllowRegenerateFlag(bool) {}
2868 
2869  // Call these functions when making a lot of calls to opChanged on a
2870  // list of nodes. These functions make sure that VOP Networks only get
2871  // one change notification no matter how many child nodes are about
2872  // to send any number of change events.
2873  // @parm caller The node that starts the bulk notifications, if applicable.
2874  static void startBulkNotifications(
2875  const OP_NodeList &changed,
2876  OP_Node *caller = nullptr);
2877  static void endBulkNotifications(
2878  const OP_NodeList &changed);
2879 
2880  /// This is overriden in VOPs. It returns true if the input at input_idx
2881  /// will need *and* can perform autoconversion of its input type to the
2882  /// type it needs. If autoconversion is not needed, or is impossible,
2883  /// this will return false.
2884  virtual bool willAutoconvertInputType(int input_idx);
2885 
2886  bool isDependentOn(OP_Node* other_node, PRM_Parm* parm);
2887 
2888  // Gets whether the input at idx is collapsed. Currently this is only used
2889  // in VOPs.
2890  virtual bool getIsInputVisibleDefault(int idx);
2891 
2892  // Debugging function to confirm that all PRM_Template's are consistent
2893  // with their parameters.
2894  bool verifyTemplatesWithParameters() const;
2895 
2896  // Same as getInputReference, except using a named reference.
2897  OP_Input *getNamedInputReference(
2898  const OP_ConnectorId& input_name, bool grow);
2899  OP_Input *getNamedInputReferenceConst(
2900  const OP_ConnectorId& input_name) const;
2901 
2902  OP_Node *getNamedInput(const OP_ConnectorId& input_name,
2903  bool mark_used=false) const;
2904  /// Note that this function only looks through currently connected
2905  /// inputs for the name, not through all possible input names on
2906  /// this node. mapInputNameToIndex does that instead.
2907  virtual int getInputFromName(const UT_String &in) const;
2908  virtual int getOutputFromName(const UT_String &out) const;
2909  virtual void getInputName(UT_String &in, int idx) const;
2910  virtual void getOutputName(UT_String &out, int idx) const;
2911 
2912  int getInputFromUniqueName(
2913  const OP_ConnectorId& id) const;
2914  int getOutputFromUniqueName(
2915  const OP_ConnectorId& id) const;
2916 
2917  // Returns the unique name of the input at index idx. Creates the input if
2918  // grow is set to true.
2919  void getUniqueInputName(
2920  OP_ConnectorId& id_out, int idx, bool grow);
2921  bool getUniqueInputNameConst(
2922  OP_ConnectorId& id_out, int idx) const;
2923 
2924  void getUniqueOutputName(OP_ConnectorId& id_out, int idx);
2925  bool getUniqueOutputNameConst(
2926  OP_ConnectorId& id_out, int idx) const;
2927 
2928  /// New input functions that use names instead of indices.
2929  virtual OP_ERROR setNamedInput(const OP_ConnectorId& input_name,
2930  OP_Node *op,
2931  const OP_ConnectorId* output_name = nullptr);
2932 
2933  virtual OP_ERROR setNamedIndirectInput(
2934  const OP_ConnectorId& input_name,
2936  virtual OP_ERROR setNamedInputReference(
2937  const OP_ConnectorId& input_name,
2938  const char *label, int,
2939  const OP_ConnectorId* output_name = nullptr);
2940 
2941  OP_ERROR insertNamedInput(
2942  const OP_ConnectorId& input_name, OP_Node *op,
2943  const OP_ConnectorId* output_name);
2944  OP_ERROR insertNamedIndirectInput(
2945  const OP_ConnectorId& input_name,
2948  /// Overriden in VOPs.
2949  virtual void onCreated(void) { }
2950 
2951  virtual bool isOrderedInput(const OP_ConnectorId& input_name) const;
2952 
2953  /// Returns the name of the first connection from node "who" to this node,
2954  /// or an empty string if "who" is not an input.
2955  OP_ConnectorId whichNamedInputIs(const OP_Node *who) const;
2956 
2957  /// Returns the index of the first connection of an indirect input.
2958  OP_ConnectorId whichNamedInputIs(const OP_IndirectInput *who) const;
2959  virtual bool willAutoconvertNamedInputType(
2960  const OP_ConnectorId& input_name);
2961 
2962  /// Note: Use these carefully, since they assume that no inputs are actually
2963  /// added or removed (or renamed) during the traversal.
2964  OP_ConnectorInputIter traverseInputs(OP_ConnectorInputIter* prev_iter);
2965  OP_ConnectorInputIter traverseConnectedInputs(OP_ConnectorInputIter* prev_iter);
2966  OP_ConnectorInputIter getTraverseEndIterator(void);
2967 
2968  unsigned getInputsArraySize()
2969  { return myInputs.entries(); }
2970  /// Deprecated in favour of getInputsArraySize()
2971  SYS_DEPRECATED(17.0) unsigned isInput(unsigned idx)
2972  { return (getInputsArraySize() > idx) ? 1 : 0; }
2973 
2974  /// Retrieve a sorted list of local variables visible to this OP_Node.
2975  void getLocalVarNames(UT_StringArray &out_vars);
2976 
2977  // Forcibly enable evaluation of local variables outside of cooking code
2978  // paths so that the last cooked value can be used for things like
2979  // pivot values for handles.
2980  bool setLocalVarActive(bool f)
2981  {
2982  bool old = myLocalVarActive;
2983  myLocalVarActive = f;
2984  return old;
2985  }
2987  /// Get the myLocalVarActive flag
2988  bool isLocalVarActive() const
2989  { return myLocalVarActive; }
2990 
2991  /// Return a UT_AttributeEvaluator for dealing with the evaluation of
2992  /// local variables designated by an "@" prefix.
2993  virtual UT_AttributeEvaluator *createAttributeEvaluator(const char *name);
2994 
2995  void recomputeCompiledHash();
2996 
2997  /// Clears the compiled hash (needed when switching from a compiled library
2998  /// definition to one that is not compiled).
2999  void clearCompiledHash()
3000  { myCompHash = DEFAULT_COMP_HASH_VALUE; }
3001 
3002  /// You should use opChanged() instead. This is only for very special
3003  /// cases. If you don't know you are a special case, you aren't.
3004  void directSendEvent(OP_EventType type, void *data=0)
3005  { sendEvent(type, data); }
3006 
3007  virtual bool scopedChannelsDirty();
3008 
3009  /// This mechanism allows users to evaluate active layer contribution
3010  /// without needing to link against CHOP.
3011  virtual bool getActiveLayerContribution(const UT_String &track_name,
3013  { return false; }
3014 
3015  /// Try to resolve exports on CHOP Channel Nodes from a value parameter
3016  /// within the array.
3017  virtual bool resolveExport(const PRM_Parm* p, int subindex,
3018  CH_ChannelRef& out_export )
3019  { return false; }
3020 
3021  /// Creates or moves an existing visualizer in this network to
3022  /// this nodes output.
3023  virtual bool addOrMoveVisualizerToOutput(int outputidx)
3024  { return false; }
3025 
3026  virtual const PRM_Parm *traverseRef(int *sub_idx, fpreal time,
3027  int parm_idx, int vec_idx) const;
3028 
3029  OP_Bundle * getParmBundle(const char* parm_name, int vector_index,
3030  UT_String &pattern, OP_Network *creator,
3031  const char *filter, bool subnet_inclusion);
3032 
3033  /// For node types with no other default color override, this is the
3034  /// final fallback default color for all nodes.
3035  static const UT_Color &getGlobalDefaultColor();
3036 
3037  /// The following methods are to be used to implement getW() and getH() in
3038  /// sub-classes. They are in absolute, pan-and-scale independent UI units.
3039 
3040  /// Get the width of flags.
3041  static fpreal getFlagWidth();
3042  /// Get the default node height.
3043  static fpreal getNodeHeight();
3044  /// Get the default width of the "node button" (the part of the node
3045  /// that you can drag and click on that isn't flags).
3046  static fpreal getNodeButtonWidth();
3047  /// Get the default connector height.
3048  static fpreal getConnectorHeight();
3049 
3050  /// Returns true if we are allowed to destroy the specified nodes. If
3051  /// nodes is non-null, we test those nodes. If nodes is null, we test
3052  /// the picked nodes of the src_net. The return value assumes that all
3053  /// specified nodes will be destroyed, which is important because it
3054  /// may be safe to delete node A iff node B is also going to be deleted.
3055  static bool canDestroyNodes(OP_Network *src_net,
3056  const OP_NodeList *nodes);
3057 
3058  /// Add an error to the given error manager, collapsing chains
3059  /// of invalid sources.
3060  static void addInputNodeErrorToManager(UT_ErrorManager *error,
3061  OP_Node *src);
3062 
3063  /// Must be implemented to associate this node to a viewer state.
3064  /// @parm default_state_name should be set with the viewer state type name.
3065  virtual void getDefaultState(UT_String &default_state_name);
3066 
3067  // If this node sets a context option to a specific value, we can clear
3068  // this option dependency for this node (and its outputs), because we
3069  // know that changing this option value past this node won't affect the
3070  // cooking of our input nodes, even if they use this context option. One
3071  // exception to this is if this node sets the context option as a
3072  // function of the option value handed to it. This exception is dealt with
3073  // when transferring option dependencies from our inputs to this node.
3074  //
3075  // Another exception is when the context used to cook this node has a
3076  // non-default (i.e. set by a node) value for the option. Because our
3077  // context option change may get "popped" by a node higher up the chain,
3078  // we must assume that nodes above this "pop" node depend on this option
3079  // set by one of our outputs, so we need to recook when that node changes
3080  // option value (even though we overwrite it). This isn't a problem when
3081  // the option is set to a default value because dependencies on default
3082  // values are tracked by micro nodes, so changing the default will force
3083  // a recook from the top of the chain. Testing for this case is why we
3084  // need to be passed the context passed to this nodes cook method.
3085  void clearInputContextOptionDepIfSafe(
3086  const UT_StringHolder &opt,
3087  const OP_Context &context);
3089  // CHOP Transform Tracks
3090  virtual bool hasTransformTracks() const { return false; }
3091  virtual bool evaluateTransformTracks( OP_Context &context, OP_EvaluateTransformTracksArgs &args ) { return false; }
3092  virtual bool evaluateTransformTracksTargets( OP_Context &context, OP_NodeList &nodes, OP_Node *caller) { return false; }
3093 
3094 
3095 protected:
3096 
3097  OP_Node(OP_Network *parent, const char *name, OP_Operator *entry);
3098  virtual ~OP_Node();
3099 
3100  /// Implement the method from PRM_ParmOwner
3101  virtual void doGetFullPath(UT_WorkBuffer &str) const;
3102 
3103  /// Retrieve a list of the local variables visible to this OP_Node.
3104  /// This list is unsorted and may contain duplicates.
3105  virtual void buildLocalVarNames(UT_StringArray &out_vars);
3106 
3108  const UT_StringRef &function) const;
3109 
3110  /// Called when loadNetwork finishes loading the whole parent network of
3111  /// this node.
3112  void finishedLoadingParentNetwork(void);
3113 
3114  void setNewParent( OP_Network *new_parent );
3115 
3116  static void bumpNameSerialIndex();
3117 
3118  /// @{
3119  /// Methods to disallow node deletion during the execution of a script.
3120  void beginScriptBlockingDel()
3121  { myScriptsBlockingDelCount += 1; }
3122  void endScriptBlockingDel()
3123  { myScriptsBlockingDelCount -= 1; }
3124  /// @}
3125 
3126  void setLegacyConnectingInputIndex(int index)
3127  { myLegacyConnectingInputIndex = index; }
3128 
3129  // All external references must be removed by the time this function
3130  // returns!
3131  virtual void clearAndDestroy(void);
3132 
3133  // invalidate any cached data
3134  virtual void clearCache();
3135 
3136  void clearInterruptedImpl(bool allow_recook);
3137 
3138  // "cookMe" is where the actual work is done.
3139  // The error is returned (OP_ERR_NONE on success).
3140  virtual OP_ERROR cookMe(OP_Context &context) = 0;
3141 
3142  // "bypassMe" is used to cook the op when the bypass flag is set.
3143  // The copied_input parameter should be set to indicate which input was
3144  // copied. Use -1 if no input was copied.
3145  // The error is returned (OP_ERR_NONE on success).
3146  virtual OP_ERROR bypassMe(OP_Context &context, int &copied_input) = 0;
3147 
3148  // The following two functions are called from evaluateAllParms() so that
3149  // subclasses may hook into it to do some work before and after evaluating
3150  // all the parameters.
3151  virtual void doOverridePreCook() { }
3152  virtual void doOverridePostCook() { }
3153 
3154  // These "serial" numbers are used for keeping track of how many sources
3155  // are accessing us. Only call getSourceCount() when locked inside
3156  // getCookLock()!
3157  int getSourceCount(void) const;
3158  virtual int bumpSourceCount(int d);
3159 
3160  // This is what you should override to do your own OP specific cooking.
3161  // This should not be called other than from pubCookInputGroups.
3162  virtual OP_ERROR cookInputGroups(OP_Context &context, int alone = 0);
3163 
3164  // I/O methods
3165  virtual OP_ERROR saveIntrinsic(std::ostream &os,
3166  const OP_SaveFlags &flags);
3167  virtual OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags,
3168  const char *path_prefix = "",
3169  const UT_String &name_override = UT_String());
3170  OP_ERROR saveUserDataPacket(std::ostream &os,
3171  const char *path_prefix,
3172  const UT_String &node_name);
3173 
3174  bool loadIntrinsicParentUneditable(UT_IStream &is,
3175  const char *path=0);
3176  bool loadIntrinsic(UT_IStream &is, const char *path=0);
3177  virtual bool loadPacket(UT_IStream &is, short class_id,
3178  short sig, const char *path=0);
3179  virtual bool loadPacket(UT_IStream &is, const char *token,
3180  const char *path=0);
3181  virtual bool load(UT_IStream &is,
3182  const char *ext="",
3183  const char *path = 0);
3184 
3185  // load only things that that an uneditable parent deems uneditable, e.g.
3186  // input/output connections. This is so that it can be matched to the OTL
3187  // rather than the editable contents of a node.
3188  bool loadParentUneditable(UT_IStream &is,
3189  const char *ext="",
3190  const char *path = 0);
3191 
3192  // this called when the entire network is done loading
3193  virtual void loadStart();
3194  virtual void loadFinished();
3195 
3196  // Loads the OTL_CONTENTS_SECTION for our OTL definition, if it exists,
3197  // using the syncContents method.
3198  void loadContentsSection();
3199 
3200  // This is a dummy virtual that just exists to be overridden by
3201  // OP_Network. See that class for more description.
3202  virtual bool syncContents(UT_IStream &is);
3203 
3204  /// Sets the flag idicating if the node is synced (matched) to the HDA.
3205  void setMatchesOTLDefinition(int matches);
3206 
3207  virtual const char *getFileExtension(int binary) const = 0;
3208  virtual const char *getDataFileExtension(int binary) const;
3209 
3210  // This will set the time dependent flag based on parms, inputs and/or
3211  // extra (non-graph) inputs.
3212  virtual void checkTimeDependencies(int do_parms=1,
3213  int do_inputs=1,
3214  int do_extras=1);
3215  // This will gather context option dependencies based on parms,
3216  // inputs and extra (non-graph) inputs. These dependencies are
3217  // applied to the data micro node and the node itself.
3218  virtual void checkContextOptionDependencies(int do_parms);
3219 
3220  // To allow our sub-classes to send events, we make this protected.
3221  void sendEvent(OP_EventType type, void *data=0);
3222 
3223  // haveSeenDataModification() can be used by sub-classes to decide if they
3224  // need to respond to a particular modification notice.
3225  int haveSeenDataModification(exint modification_id);
3226 
3227  // If you sub-class propagateModification, then be sure to call this
3228  // OP_Node base class method *last*.
3229  //
3230  // This routine will return TRUE if the modification is a new one for this
3231  // node. FALSE will be returned if the modification has been seen before.
3232  //
3233  // Note that "by_whom" is the immediate input node that caused the
3234  // propagation to "this" node.
3235  virtual int propagateModification(OP_Node *by_whom,
3236  OP_EventType reason,
3237  int parm_index,
3238  OP_PropagateData &prop_data);
3239 
3240  // Use this to obtain the cook cache.
3241  // @pre The caller has locked myCookLock if it is currently being cooked.
3242  OP_Cache * getCookCache() { return &myCache; }
3243 
3244  static void cmd_locate(CMD_Args &);
3245 
3246  virtual void saveFlagsForUndo();
3247  void saveForUndoLayout();
3248 
3249  static void saveForUndoDelete(OP_NodeList &nodes);
3250 
3251  /// Clears all cook dependencies (i.e., items that may cause it to cook)
3252  void clearDependency();
3253 
3254  /// This function will dirty our data if the given time is different from
3255  /// our last cooked time.
3256  ///
3257  /// This function is normally called from cook() but subclasses can prevent
3258  /// this with flags().setClearDependency(false). In that case, subclasses
3259  /// are responsible for calling this function at the appropriate time. This
3260  /// is primarily for nodes which cache their data across time. In that
3261  /// case, if they did _not_ reuse their cached data, then
3262  /// dirtyForTimeChange() needs to be called.
3263  ///
3264  /// @returns true if node was dirtied, false otherwise.
3265  bool dirtyForTimeChange(fpreal t)
3266  {
3267  if (isCookedTime(t))
3268  return false;
3269 
3270  OP_DataMicroNode &dm = dataMicroNode();
3271  OP_DataMicroNode &pm = parmListMicroNode();
3272  dm.setDirty(true);
3273  if (&dm != &pm)
3274  pm.setDirty(true);
3275 
3276  return true;
3277  }
3278 
3279  // clone dependencies from the proxy. proxy is no longer valid
3280  // after the clone!
3281  virtual void cloneFromProxyRefNode( OP_Network *proxy );
3282  // clone a new proxy node. this node is no longer valid after this!
3283  virtual OP_Network * cloneToProxyRefNode();
3284  void stealDependents( OP_Node *other );
3285 
3286  bool hasOpDependents()
3287  { return !myOpDependents.isEmpty(); }
3288  virtual int hasProxyRefNodes() const
3289  { return 0; }
3290  virtual void moveProxyRefNodes( OP_Network * /*dest */ ) { }
3291  void clearOpReferences();
3292  virtual void rebuildOpDependents( bool proxy_only );
3293 
3294  /// removeOpDependent() returns the number of dependents removed
3295  virtual int removeOpDependent(
3296  int op_id, const PRM_RefId &ref_id,
3298  virtual int removeOpDependent(
3299  int op_id, OP_InterestType mask = OP_INTEREST_ALL );
3300 
3301  // new method for dependencies: use the PRM_TYPE_OP_REF_*
3302  // in your parm template to add your dependency.
3303  // override this to do special cases, make sure you call the base class
3304  // first before adding your own dependencies!
3305  virtual void buildOpDependencies();
3306  virtual void checkChannelDependencies( CH_Channel *ch,
3307  CH_CHANGE_TYPE reason );
3308 
3309  void notifyOpDependents( OP_InterestType interest,
3310  bool recurse );
3311  virtual void moveDependencies( OP_Node *from_node );
3312  // Two functions for notifying dependent nodes of name changes. The
3313  // non-virtual function is the one that should be called to do the
3314  // update. It calls the virtual function to do the actual updating,
3315  // and generate a list of dependent nodes that were changed. Then it
3316  // forces a recook on the changed nodes.
3317  void notifyRenameDependents( const UT_String &full_from );
3318  virtual void notifyRenameDependents( const UT_String &full_from,
3319  OP_NodeList &cook_nodes );
3320  // Two functions for notifying referencing nodes of name changes. The
3321  // non-virtual function is the one that should be called to do the
3322  // update. It calls the virtual function to do the actual updating,
3323  // and generate a list of dependent nodes that were changed. Then it
3324  // forces a recook on the changed nodes.
3325  void notifyRenameReferences( const UT_String &full_from );
3326  virtual void notifyRenameReferences( const UT_String &full_from,
3327  OP_NodeList &cook_nodes );
3328  // this method is called to alert this op that its dependency has
3329  // changed. if it's a name interest, then the old full path is given
3330  virtual void handleOpDependency( int referenced_op_id,
3331  const OP_Dependency &op_dep,
3332  OP_InterestType interest_type,
3333  bool &need_cook,
3334  const char *old_fullpath,
3335  const char *old_cwd,
3336  const char *old_chan_name );
3337  virtual void buildParmDependency( int parm_index );
3338 
3339  void addOpNameReference(
3340  const PRM_RefId &ref_id, const UT_String &op_path,
3342  // chan_name must be real channel name not an alias
3343  void addChannelNameReference(
3344  const PRM_RefId &ref_id,
3345  const UT_StringRef &op_path,
3346  const UT_StringRef &chan_name,
3348 
3349  OP_Node *getNodeOrCreateProxy(const UT_StringRef &op_path);
3350 
3351  void addOpReference( const PRM_RefId &ref_id, OP_Node *node,
3352  const PRM_RefId &source_ref_id,
3354 
3355  /// This function takes the given parm string value containing an op path
3356  /// and does a search and replace given the old and new op paths.
3357  ///
3358  /// value_str - the old parm value to modify
3359  /// new_fullpath - the new path value to change to
3360  /// old_fullpath - the old path that needs changing
3361  /// old_cwd - the old path that the parm value was relative to
3362  /// new_cwd - the new path that the parm value is to be relative to
3363  ///
3364  /// The reason for old_cwd & new_cwd is when collapsing a node into a
3365  /// subnet. We need to figure out the new path references of the collapsed
3366  /// subnet since it has changed location. We match using the old_cwd but
3367  /// take the new path relative to new_cwd. Note that in this situation,
3368  /// old_fullpath is the same as new_fullpath.
3369  bool changeOpPathRef( UT_String &value_str,
3370  const char *new_fullpath,
3371  const char *old_fullpath,
3372  const char *old_cwd,
3373  const char *new_cwd );
3374 
3375  // handy functions for dealing with string parms that can have the
3376  // op:/path[frame] syntax
3377  static bool getStringParmOpPath(
3378  PRM_Parm &parm, int vi, UT_String &oppath,
3379  int thread );
3380  void handleStringParmOpPathDependency(
3381  int parm_index, int vi,
3382  const char *new_fullpath,
3383  const char *old_fullpath, const char *old_cwd );
3384 
3385  // Only OP_Network should call notifyNodeDeletion()
3386  void notifyNodeDeletion();
3387 
3388  // Only notifyNodeDeletion() should call nodeDeleted().
3389  // nodeDeleted() - gets called every time a node is deleted
3390  virtual void nodeDeleted(OP_Node *op, int propagate=1);
3391 
3392  void startCookTimer(const OP_Context &context);
3393  void stopCookTimer(const OP_Context &context);
3394 
3395  virtual const char *getCookTimerLabel(const OP_Context &context) const;
3396 
3397  // Overrides permission errors so that we don't have problems when cooking.
3398  virtual void permissionError(const char *chname = 0);
3399 
3400  // Add an error for the invalid input given by input_idx
3401  void addInputError(unsigned input_idx);
3402 
3403  // Add an error for the given node having failed to load.
3404  void addInputNodeError(OP_Node *src);
3405 
3406 protected:
3407  /// This function is currently only used by VOPs. It checks if an input
3408  /// on the subnet is connected inside the subnet. The default implementation
3409  /// here simply returns false to preserve existing behaviour for all other
3410  /// contexts.
3411  virtual bool isInputConnectedInsideSubnet(int input_idx) const;
3412  virtual bool isNamedInputConnectedInsideSubnet(
3413  const OP_ConnectorId& input_name) const;
3415  // notifier when this node is unlocked
3416  virtual void nodeUnlocked() { ; }
3417 
3418  // These functions must be used with care!
3419  virtual void setUniqueId(int id);
3420  void changeOpDependentUniqueId( int old_id, int new_id );
3421  void changeOpReferenceUniqueId( int old_id, int new_id );
3422  virtual void clearUniqueId();
3423 
3424  void setAllowBuildDependencies( int yesno )
3425  { myAllowBuildDependencies = yesno; }
3426  int allowBuildDependencies() const
3427  { return myAllowBuildDependencies; }
3428 
3429  /// Evaluate all parameters for this operator. This is used for scripted
3430  /// Ops to make sure that our dependencies get set up properly.
3431  void evaluateAllParms(fpreal t);
3432 
3433  /// Override and assign any external (file) references to the reflist,
3434  /// and if nodelist is non-null, the full pathname of the node with the
3435  /// reference.
3436  virtual void getMyExternalReferences(UT_StringArray &reflist,
3437  UT_StringArray *nodelist =0,
3438  bool collapse = false,
3439  bool check_missing = false,
3440  bool show_missing_only=false);
3441 
3442  void getExternalFiles(UT_StringArray &files,
3443  const char *stringparm,
3444  int framestart, int frameend,
3445  bool collapse,
3446  bool check_missing,
3447  bool show_only_missing,
3448  UT_KnownPath path);
3449 
3450  /// Rather than overloading the descriptive name, you can instead
3451  /// just provide a parameter name that will be evaluated to
3452  /// become the descriptive name.
3453  virtual void getDescriptiveParmName(UT_String &str) const;
3454 
3455  /// Additonal information that should be provided at the network
3456  /// level in addition to the name.
3457  /// By default will inspect the getDescriptiveParmName.
3458  virtual void getDescriptiveName(UT_String &str) const;
3459 
3460  /// Marks our cached descriptive name as dirty.
3461  void dirtyDescriptiveNameCache();
3462 
3463  /// Return true if it is safe at this time to destroy this node.
3464  virtual bool canDestroyNode();
3465 
3466  /// Override this to return true in an operator type that wants its
3467  /// cooked data to rely on all its parameter values but doesn't actually
3468  /// evaluate any parameters in its cook function (the prototypical
3469  /// example of this is SHOPs).
3470  virtual bool cookedDataUsesAllParameters() const
3471  { return false; }
3472  /// If the cook method relies on the base class cook to evaluate parameters
3473  /// (like in SHOPs), we need to trap the errors during this evaluation.
3474  virtual bool cookedDataNeedsErrors() const
3475  { return false; }
3476  /// If this node should be cooked for any output connected to it, return
3477  /// true here. Otherwise we only cook a node if something is connected to
3478  /// it's primary output. This does not let the node cook differently for
3479  /// each output, since the cook method doesn't know what output is being
3480  /// cooked for. So this should only be used if the cook is unaffected by
3481  /// the specific connected output.
3482  virtual bool cookDataForAnyOutput() const
3483  { return false; }
3484 
3485  // Returns true if we are running our creation script, or any parent
3486  // node of us is running its creation script.
3487  bool getIsRunningInCreateScript() const;
3488 
3489  /// This method is called whenever something in the network changes
3490  /// that may have an impact on the representative node this network may
3491  /// have. It is used at this level to notify parents, and at the OBJ level
3492  /// to actually refresh the representative object.
3493  virtual void refreshRepresentativeNode(OP_Node &changed_child);
3494 
3495  /// Sets up the inputs and outputs after all nodes have been loading
3496  /// from file (in case it needs its children to determine inputs/oututs).
3497  virtual void setupConnectorsAfterLoad();
3498 
3499  /// Converts opdef and oplib format paths from opdef:nodepath to
3500  /// opdef:tablename/optype.
3502 
3503  bool isCookedTime(fpreal t) const
3504  {
3505  return dataMicroNodeConst()
3506  .isEqualToLastUpdateTime(t);
3507  }
3508 
3509  /// Subclasses should override this to dump extra micronodes that they own
3510  /// for debugging purposes.
3511  virtual void dumpMicroNodes(
3512  std::ostream &os,
3513  bool as_DOT,
3514  int indent_level) const;
3517  UT_TokenString myHashCode; // Generates a unique
3518  UT_TokenString myParmHashCode; // parameters & inputs.
3519  int myLastGroupMask;
3520  OP_VERSION myHashVersion;
3521  fpreal myHashTime;
3522  int myParmLastGroupMask;
3523  OP_VERSION myParmHashVersion;
3524  fpreal myParmHashTime;
3525  UT_String mySyncErrors;
3526  OP_ERROR mySyncErrorLevel;
3527  int mySyncDepth;
3528 
3529  /// Deletes an input completely if it is disconnected. If the input
3530  /// is connected, does nothing.
3531  void deleteInput(int idx);
3532  void deleteInput(const OP_ConnectorId& input_name);
3533 
3534  /// Performs actual removal from the member input array.
3535  virtual void doDeleteInput(int idx);
3536 
3537  /// Update the error severity of this node.
3538  void updateErrorSeverity();
3540  /// Overriden in VOPs.
3541  virtual void onInputAllocated(OP_Input* new_input, int index) { }
3542 
3543  /// Debug method for checking connector consistency.
3544  void checkConnectorsConsistency(void);
3545 
3546  /// Use these to collect all inputs/outputs in cases where they will
3547  /// need to be modified.
3548  void gatherInputs(UT_Array<OP_InputPair> &input_pairs);
3549  void gatherOutputs(UT_Array<OP_OutputPair> &output_pairs);
3550 
3551  void renameInput(OP_Input* input, int new_id);
3552  void renameOutput(OP_Output* output, int new_id);
3553 
3554  void notifyChannelOpDependents(PRM_Parm * in_parm, int vecid);
3555  // Compiled hash code
3556  uint32 myCompHash;
3557 
3558 private:
3559 
3560  virtual void updateSpareParmTemplates(PRM_Template *newtemplates,
3561  bool leavedefaultsunchanged);
3562 
3563  bool doDebugConsistencyCheck();
3564  void createCollection( OP_Operator *entry );
3565 
3566  // these are extra private. only to be called from saveIntrinsic and save
3567  // respectively
3568  OP_ERROR saveIntrinsicError();
3569  OP_ERROR saveError();
3570  OP_ERROR saveGroupMemberships(std::ostream &os,
3571  const OP_SaveFlags &flags,
3572  const char *path_prefix);
3573  bool loadGroupMemberships(UT_IStream &is,const char*path=0);
3574 
3575  ///Make a note of which network box we're in
3576  OP_ERROR saveNetworkBox(std::ostream &os,
3577  const OP_SaveFlags &flags,
3578  const char *path_prefix);
3579 
3580  ///Put ourselves into a network box if we saved ourselves as being in one
3581  bool loadNetworkBox(UT_IStream &is, const char *path=0);
3582 
3583  bool loadNodeFlags(UT_IStream &is, const char *path);
3584 
3585  void saveForUndoComment();
3586  void saveForUndoDelScript();
3587 
3588  UT_BitArray &getGroups() { return myGroups; }
3589  const UT_BitArray &getGroups() const { return myGroups; }
3590  // Only OP_Input should call setOutput() and delOutput() functions.
3591  bool setOutput(OP_NetworkBoxItem *item, int outputIdx);
3592  bool delOutput(OP_NetworkBoxItem *item, int outputIdx);
3593  bool setNamedOutput(OP_NetworkBoxItem *item,
3594  const OP_ConnectorId& output_name);
3595  bool delNamedOutput(OP_NetworkBoxItem *item,
3596  const OP_ConnectorId& output_name);
3597 
3598  void setInterrupted();
3599 
3600  int findAncestor(const OP_Node *node) const;
3601  int findDataAncestor(const OP_Node *node) const;
3602  void clearRecursionBit() const;
3603 
3604  void initializeExpressions() const;
3605  void clearInputs();
3606  void clearOutputs();
3607 
3608  virtual PRM_ParmMicroNode
3609  *createParmMicroNodes(PRM_Parm &parm) const;
3610 
3611  static bool getMicroNodesFromRef(
3612  const OP_InterestRef &ref,
3613  DEP_MicroNodeList &micronodes,
3614  bool data_target);
3615  static void traverseInputsAddInputs(
3616  opNodeOutput &output,
3618  UT_Set<opNodeOutput> &visited,
3619  TraverseOptions opts,
3620  OP_InterestType extra_interest_mask,
3621  bool include_parmlist);
3622 
3623  // new method: dependencies get created from parm template and only
3624  // gets updated when necessary. only buildOpDependencies()
3625  // needs to call this
3626  void removeOpReference(
3627  const PRM_RefId &ref_id,
3629  void removeOpReference(
3630  const PRM_RefId &ref_id,
3631  int op_id,
3633  // ref_chan_name must be the real channel name and not an alias
3634  int addOpDependent( int op_id,
3635  const PRM_RefId &source_ref,
3636  const PRM_RefId &ref_id,
3638 
3639  void updateRenameDependent( OP_Node *dependent,
3640  const char *old_cwd,
3641  OP_NodeList &cook_nodes );
3642 
3643  void notifyInputOpDependents(int input_i);
3644 
3645  void getExistingOpReferencesImpl(
3646  OP_NodeList &refs, bool include_descendants) const;
3647  void getExistingOpDependentsImpl(
3648  OP_NodeList &deps, bool include_descendants) const;
3649 
3650  void buildScriptOpDependencies();
3651  void changeScriptOpRef( const char *new_fullpath,
3652  const char *old_path,
3653  const char *old_cwd );
3654  static void changeScriptCB( UT_String &str,
3655  const char *token_start,
3656  const char *&ch, void *userdata );
3657 
3658  // Go through and find all nodes which have time interest and requires
3659  // cooking. If the update_cook flag is true, then we will call force
3660  // recook on the node as long as node != this. 'interests' if non-null,
3661  // stores the path of nodes that has time interest and will set the time
3662  // interest cook flag on those nodes.
3663  bool findTimeInterests(OP_Context &context, OP_Node *node,
3664  bool update_cook,
3665  OP_NodeCycleDetect &cycle,
3666  OP_NodeList *interests = nullptr);
3667 
3668  /// Helper method for 'completePath()'
3669  bool attemptPrefixMatch(const OP_NetworkBoxItem *item,
3670  char *childpref, int childpreflen,
3671  UT_String &maxprefix) const;
3672 
3673  /// Helper for propagateModification()
3674  void findUsedDataInterests(OP_NodeList &nodes, OP_Node *op);
3675 
3676  /// Helper function for the setGlobal*Param functions. This function
3677  /// interprets the return value from CH_Manager::setGlobal*Param.
3678  bool internalSetGlobalParam(const char *param,
3679  int setreturned,
3680  bool *warned);
3681 
3682  int internalSetPicked(int on_off,
3683  bool propagate_parent_event,
3684  bool edit);
3685 
3686  OP_ERROR internalCookInput(OP_Context &context, int input_idx,
3687  OP_Node &input_node);
3688 
3689  virtual void removeInputFromMapping(int idx);
3690  void removeOutputFromMapping(int idx);
3691 
3692  /// Helper function to skip until the next closing brace in a stream
3693  /// (including the brace itself).
3694  void skipUntilClosingBrace(UT_IStream &is);
3695 
3696  /// Resolves any inputs for which the names were not found during
3697  /// actual loading.
3698  void resolveUnresolvedLoadedInputs(void);
3699 
3700  void generateConnectorUniqueId(OP_ConnectorId& id_out);
3701  OP_Output *getOrCreateOutput(int array_index, bool create,
3702  int id_to_use);
3703 
3704  uint32 computeCompiledHash() const;
3705 
3706  // Adds a warning to the current error manager if this node has been
3707  // marked as deprecated.
3708  void addDeprecationWarningsIfAny();
3709 
3710  // Find an unused connectorId to assign to the next input/output
3711  int getConnectorNextId() const;
3712 
3713  bool computeCompiledStatus() const;
3714 
3715  bool isOperatorThreadSafe() const;
3716 public:
3717  /// SOP, OBJ, and SOP Solver DOP nodes can be a selection owner,
3718  /// but other nodes cannot.
3719  /// This replaces the previous inheritance from SOP_SelectionOwner.
3720  virtual bool isSelectionOwnerType() const
3721  { return false; }
3722 
3723  /// Add many extra inputs in one call. See addExtraInput
3724  void addExtraInputs(const UT_Array<OP_InterestRef> &source_refs);
3725  void addExtraInputs(const DEP_MicroNodeList &deps);
3726 
3727  static void addExtraInputs(
3728  const UT_Array<OP_InterestRef> &target_refs,
3729  const UT_Array<OP_InterestRef> &source_refs);
3730 
3731  /// Optimized version of addExtraInput that doesn't create OP_InterestRef
3732  static void addExtraInput(OP_Node &source, int source_pi, int source_vi,
3733  OP_Node &target, int target_pi, int target_vi
3734  );
3735 
3736  static bool getMicroNodesFromRef(
3738  DEP_MicroNodeList &micronodes, bool data_target);
3739 
3740  static bool getMicroNodesFromRef(
3741  OP_Node &op, int parm_i, int vec_i,
3742  DEP_MicroNodeList &micronodes);
3743 
3744  void addExtraInput(OP_Node *op, OP_InterestType type, DEP_MicroNodeList &sources_cache);
3745 
3746  /// Optimized version of addExtraInput that doesn't create OP_InterestRef
3747  static void addExtraInput(OP_Node &source, PRM_Parm &source_parm, int source_vi,
3748  OP_Node &target, PRM_Parm &target_parm, int target_vi
3749  );
3750 
3751  void addExtraInputs(const UT_Array<OP_Node*> &nodes, OP_InterestType type, DEP_MicroNodeList &sources_cache);
3752 
3753  virtual bool isUsingCurrentFrameForVexTransformContext() const {return true;}
3754 private:
3755  OP_Cache myCache;
3756 
3757  OP_ERROR myLastErrorSeverity;
3758  OP_Network *myParent;
3759  OP_Network *myRootCompiledParent;
3760  UT_ValArray<OP_Input *> myInputs;
3761  // This is a map of names to inputs.
3762  OP_ConnectorInputMap myInputsMap;
3763  mutable UT_BitArray myUsedInputs;
3765  myOutputs;
3766  // This is a map of names to outputs.
3767  OP_ConnectorOutputMap myOutputsMap;
3768 
3769  // Default data micro node.
3770  OP_DataMicroNode myDataMicroNode;
3771  DEP_MicroNode myFlagMicroNode;
3772  UT_StringArray myClearInputContextOptionDeps;
3773 
3774  // Micro nodes for OP events.
3775  UT_UniquePtr<DEP_MicroNode *[]> myEventMicroNodes;
3776 
3777  UT_String myComment;
3778  UT_String myDelScript;
3779  UT_String myCreatorState;
3780  UT_BitArray myGroups;
3781  OP_Value myEventValue;
3782  fpreal myPosX;
3783  fpreal myPosY;
3784  exint myCookCount;
3785  SYS_AtomicInt32 mySourceCount;
3786  int myBlockModify;
3787  int myScriptsBlockingDelCount;
3788  int myUniqueId;
3789  int myNextIdOverride;
3790  unsigned myActiveInputIndex;
3791  // Indicates which input is currently being connected,
3792  // -1 if none.
3793  int myLegacyConnectingInputIndex;
3794 
3795  bool myAutoscope;
3796 
3797  fpreal myCookDuration; // time spent cooking
3798  unsigned int myRenameConflict : 1,
3799  myCookedForRender : 1,
3800  myModifyWaiting : 1,
3801  myBuiltExplicitly : 1,
3802  myAllowBuildDependencies : 1,
3803  myBeingDeleted : 1,
3804  myRunningCreateScript : 1,
3805  myRunningDelScript : 1,
3806  myAlreadyRunDelScript : 1,
3807  myMatchesOTLDefinition : 1,
3808  myLoadCookedDataError : 1,
3809  myBuiltHashCode : 1,
3810  myIsProxyRefNode : 1,
3811  myInhibitInputConsolidation : 1,
3812  // Tracks if we have engaged our local variables, true from the
3813  // SOP_Node::setupLocalVars() until the SOP_Node::resetLocalVarRefs(). Any
3814  // attempt to evaluate local vars outside of here will redflag. This
3815  // flag is here instead of SOP_Node so that PI_OpHandleLink has access
3816  // to temporarily enable it.
3817  myLocalVarActive : 1;
3818 
3819  mutable bool myRecursionFlag;
3820 
3821  // Tracks the nesting level of the modification propagation chains
3822  static int thePropagateLevel;
3823 
3824  // ops that we have a reference to
3825  OP_ReferenceList myOpReferences;
3826  // ops that depend on us
3827  OP_DependencyList myOpDependents;
3828 
3829  // bundles that we have a reference to
3830  OP_BundleReferences myBundleRefs;
3831 
3832  // Locking for cooking and adding extra inputs
3833  mutable OP_CookLock myCookLock;
3834  UT_TaskState myTaskState;
3835 
3836  // Arbitrary string data that users can attach to nodes that gets saved
3837  // with the hip file.
3838  UT_Options myUserData;
3839  // Cached value for the node shape.
3840  UT_StringHolder myNodeShape;
3841 
3842  // Arbitrary blind data that users can attach to nodes. These do not get
3843  // saved with the hip file.
3844  UT_StringMap<UT_SharedPtr<void> > myBlindData;
3845 
3846  // Arbitrary data blocks that, unlike blind data, are saved with the node.
3847  // This obviously implies the data must be self contained (no pointers).
3848  UT_StringMap<OP_DataBlockPtr> myDataBlocks;
3849 
3850  // Arbitrary data (in the form of Python objects) the users can attach to
3851  // nodes that does not get saved with the hip file.
3852  OP_PythonObjectCache myCachedPythonObjects;
3853 
3854  // During load, not all of our input names are known. This stores
3855  // unresolved input names until OP_Node::loadFinished() is called,
3856  // where they are resolved.
3857  UT_Array<OP_UnresolvedConnection *> *myUnresolvedInputs;
3858 
3859  OP_NodeFlags myFlags;
3860 
3861  /// Cached evaluation of the node's descriptive name.
3862  UT_StringHolder myCachedDescriptiveName;
3863  bool myCachedDescriptiveNameDirty;
3864 
3865  /// Only used during loading. Set to false initially, it is set to true
3866  /// once we load inputsNamed intrinsic section. If we do, the regular
3867  /// inputs section will then be ignored.
3868  bool myLoadedNamedInputs;
3869 
3870  /// Used for caching the compiled status of the node. Initially undefined,
3871  /// gets set on first isCompiled() call.
3872  mutable OP_CompileStatusType myCachedCompileStatus;
3873 
3874  OP_ERROR myChildErrorSeverity;
3875  int myChildErrorSeverityTimestamp;
3876 
3877  // Maintenance of node id's
3878  static int makeUniqueId(OP_Node *node);
3879 
3880  static bool *theCheckConnectionConsistency;
3881  static int theUniqueId;
3882  static int theUniqueSize;
3883  static OP_Node **theUniqueNodes;
3884  static bool theDoingBulkNotification;
3885  static OP_Node *theBulkNotificationCaller;
3887  friend class OP_Channels;
3888  friend class OP_DataMicroNode;
3889  friend class OP_EventMicroNode;
3890  friend class OP_Group;
3891  friend class OP_IndirectInput;
3892  friend class OP_Input;
3893  friend class OP_Network;
3894  friend class OP_ParmMicroNode;
3895  friend class OP_UndoCreate;
3896  friend class OP_UndoDelete;
3897  friend class OP_UndoInput;
3898  friend class OP_UndoSpareParm;
3899  friend class OP_UndoUserData;
3900 
3901  friend class op_MicroNodeDirtied;
3902 };
3903 
3904 // helper function
3905 // should always return a valid pointer
3907 
3908 // Link a Node to a Channel for SOP Channels
3909 OP_API void OPlinkNodeToChannel( const OP_Node *node, const CH_Channel *chp );
3911 
3912 // Replaces CH_Manager::getUniqueCollections() as it needs access to OP.
3914  const CH_ChannelList &channels,
3915  CH_CollectionList &collections );
3916 
3917 // UTformat support.
3918 static inline size_t
3919 format(char *buffer, size_t buffer_size, const OP_Node &v)
3920 {
3921  UT_StringHolder s = v.getFullPath();
3922  if (!buffer)
3923  return s.length();
3924  else
3925  {
3926  size_t len = std::min(size_t(s.length()), buffer_size);
3927  ::memcpy(buffer, s.c_str(), len);
3928  return len;
3929  }
3931 
3933 {
3934 public:
3937 };
3938 
3939 #define CAST_INSTANTIATE(PREFIX) \
3940 inline static PREFIX##_Node *CAST_##PREFIX##NODE(OP_Node *op) \
3941 { \
3942  return ((op) ? (op)->castTo##PREFIX##Node() : 0); \
3943 } \
3944  \
3945 inline static const PREFIX##_Node *CAST_##PREFIX##NODE(const OP_Node *op) \
3946 { \
3947  return ((op) ? (op)->castTo##PREFIX##Node() : 0); \
3948 } \
3949 
3950 /// @anchor OP_Node_CAST_FOONODE
3951 /// These convenience functions let you do the cast without worrying if the
3952 /// underlying pointer is null or not. They aren't macros because this way we
3953 /// avoid double evaluating the op.
3954 /// CAST_OBJNODE()
3955 /// CAST_SOPNODE()
3956 /// CAST_CHOPNETNODE()
3957 /// CAST_CHOPNODE()
3958 /// CAST_ROPNODE()
3959 /// CAST_SHOPNODE()
3960 /// CAST_COP2NODE()
3961 /// CAST_COPNETNODE()
3962 /// CAST_VOPNODE()
3963 /// CAST_VOPNETNODE()
3964 /// CAST_DOPNODE()
3965 /// CAST_TOPNODE()
3966 /// CAST_TOPNETNODE()
3967 /// CAST_LOPNODE()
3968 //@{
3970 //@}
3971 
3972 #undef CAST_INSTANTIATE
3973 
3974 // We don't want anyone to conflict with this..
3975 #undef INSTANTIATE_FINDNODE_FUNCTIONS
3976 #undef INSTANTIATE_CASTNODE_FUNCTIONS
3977 #undef INSTANTIATE_FOR_ALL_NODE_TYPES
3978 
3979 //___________________________________________________________________________
3981 /// Simple class that makes it easy to write loops that iterate over all the
3982 /// outputs from a node. The parameters are passed on to getOutputNodes.
3983 class OP_API OP_OutputIterator : private UT_SmallArray<OP_Node*>
3984 {
3986 
3987 public:
3989  const OP_Node &node,
3990  bool into_subnets = false,
3991  bool through_dots = true,
3992  int output_idx = -1)
3993  {
3994  node.getOutputNodes(*this, into_subnets, through_dots, output_idx);
3995  }
3996 
3997  using Parent::begin;
3998  using Parent::end;
3999 
4000  using Parent::rbegin;
4001  using Parent::rend;
4002 
4003  using Parent::operator();
4004  using Parent::entries;
4005  using Parent::size;
4006 
4007  using Parent::sort;
4008 };
4010 /// Same as OP_OutputIterator, but with the iterators all swapped around so a
4011 /// range loop will go backwards (without having to mess with reverse adaptors)
4012 class OP_API OP_OutputReversedIterator : private UT_SmallArray<OP_Node*>
4013 {
4015 
4016 public:
4018  const OP_Node &node,
4019  bool into_subnets = false,
4020  bool through_dots = true,
4021  int output_idx = -1)
4022  {
4023  node.getOutputNodes(*this, into_subnets, through_dots, output_idx);
4024  }
4026  const_reverse_iterator begin() const { return Parent::rbegin(); }
4027  const_reverse_iterator end() const { return Parent::rend(); }
4028  reverse_iterator begin() { return Parent::rbegin(); }
4029  reverse_iterator end() { return Parent::rend(); }
4031  const_iterator rbegin() const { return Parent::begin(); }
4032  const_iterator rend() const { return Parent::end(); }
4033  iterator rbegin() { return Parent::begin(); }
4034  iterator rend() { return Parent::end(); }
4035 
4036  using Parent::operator();
4037  using Parent::entries;
4038  using Parent::size;
4039 
4040  using Parent::sort;
4041 };
4042 
4043 #endif
GLdouble s
Definition: glew.h:1390
OP_API const UT_StringHolder OP_USERDATA_NODESHAPE
The change type wasn't set, so it could be any of them.
Definition: OP_DataTypes.h:80
virtual void executeCommand(const char *command, std::ostream *out, std::ostream *err) const =0
virtual bool setColor(const UT_Color &color)
void adoptFromString(UT_String &str)
unsigned char uchar
Definition: SYS_Types.h:42
#define CAST_INSTANTIATE(PREFIX)
Definition: OP_Node.h:3937
GLenum GLenum GLenum input
Definition: glew.h:13879
Definition: UT_Set.h:58
OP_API void OPgetUniqueCollections(const CH_ChannelList &channels, CH_CollectionList &collections)
GT_API const UT_StringHolder filename
OP_InputPair(OP_Input *p, OP_ConnectorId n)
Definition: OP_Node.h:143
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
const PRM_Parm * myParmRef
Definition: OP_Node.h:176
virtual UT_ErrorSeverity prmCookOverrides(fpreal, int, const char *, int)
GLenum GLint ref
Definition: glew.h:1845
virtual OP_ItemType getItemType() const =0
Our children should implement this and return what type of item they are.
OP_ConnectorInputMap::iterator OP_ConnectorInputIter
Definition: OP_Node.h:139
#define SYS_DEPRECATED(__V__)
GLuint const GLchar * name
Definition: glew.h:1814
virtual void checkChannelDependencies(CH_Channel *, CH_CHANGE_TYPE)
Unsorted map container.
Definition: UT_Map.h:83
uint64 OP_VERSION
Definition: OP_Version.h:6
const UT_String & getName() const
int64 getMemoryUsage(bool inclusive) const
UT_String myInputName
Definition: OP_Node.h:182
OP_CompileStatusType
Definition: OP_Node.h:317
GLenum mode
Definition: glew.h:2163
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
Definition: format.h:251
virtual int changeString(const char *from, const char *to, bool fullword)
const Args & args
Definition: printf.h:628
OP_API void OPlinkNodeToChannel(const OP_Node *node, const CH_Channel *chp)
UT_CycleDetect< OP_Node * > OP_NodeCycleDetect
Definition: OP_Node.h:228
GT_API const UT_StringHolder time
GLenum target
Definition: glew.h:2865
GLuint index
Definition: glew.h:1814
virtual int setPicked(int on_off, bool propagate_parent_event=true)=0
void addExplicitInput(DEP_MicroNode &inp, bool check_dup)
Methods for manipulating explicit edges.
TraverseOptions
Definition: OP_Node.h:2555
A task node for managing which thread is currently working on a given task.
Definition: UT_TaskState.h:42
GLuint const GLfloat * val
Definition: glew.h:2794
virtual void opChanged(OP_EventType type, void *dataptr=0)=0
GLuint GLuint GLfloat weight
Definition: glew.h:13609
const UT_StringHolder myTableName
Definition: OP_Node.h:353
UT_LockedRawPtr< OP_NodeList, OP_Lock > OP_LockedNodeList
Definition: OP_Node.h:231
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2864
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
Definition: SYS_Types.h:131
base_iterator< const OP_Node *, false > const_reverse_iterator
Definition: UT_Array.h:782
#define INSTANTIATE_CASTNODE_FUNCTIONS(PREFIX)
Definition: OP_Node.h:456
virtual void setXY(fpreal x, fpreal y)=0
virtual fpreal getY() const =0
void reverse(I begin, I end)
Definition: pugixml.cpp:7190
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual fpreal getX() const =0
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
OP_API const UT_StringHolder OP_USERDATA_BGIMAGES
const OP_DopParent * castToOpDopParent() const
Definition: OP_Node.h:2611
std::pair< const OP_Node *, int > opNodeOutput
Definition: OP_Node.h:234
const GLdouble * m
Definition: glew.h:9124
GLdouble l
Definition: glew.h:9122
const GLdouble * v
Definition: glew.h:1391
virtual OP_Network * getParentNetwork() const =0
Returns the network that is our parent.
GLenum GLint GLuint mask
Definition: glew.h:1845
OP_ConnectorId myName
Definition: OP_Node.h:146
virtual void clearParmDependency(int parmidx)=0
int(* OP_EditCallback)(void *data, OP_Node *src, CL_Track *track, fpreal t, fpreal value)
Definition: OP_Node.h:134
GLfloat param
Definition: glew.h:1530
virtual UT_StringHolder evaluateDisableExpression(const PRM_Parm &prm, const UT_StringRef &function) const
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:3446
int myIndex
Definition: OP_Node.h:416
UT_SymbolMap< PY_OpaqueObject * > OP_PythonObjectCache
Definition: OP_Node.h:233
virtual int findString(const char *str, bool fullword, bool usewildcards) const
base_iterator< OP_Node *, false > reverse_iterator
Definition: UT_Array.h:781
const OP_Node * myEvalNode
Definition: OP_Node.h:175
void setDirty(bool flag, bool allow_clear=true)
Flag accessors.
virtual void setAnyUndoFlag()
PivotSpaceT< fpreal32 > PivotSpace
Definition: UT_Matrix4.h:813
fpreal myValue
Definition: OP_Node.h:413
virtual int64 getItemUniqueId() const =0
Functions to get hip-file-unique ids for any item type.
OP_OutputPair(OP_Output *p, OP_ConnectorId n)
Definition: OP_Node.h:151
OP_ItemType
Definition: OP_ItemId.h:28
GLdouble GLdouble GLdouble GLdouble q
Definition: glew.h:1414
PRM_ParmList * createObsoleteParmList() override
long long int64
Definition: SYS_Types.h:111
A utility class to do read-only operations on a subset of an existing string.
Definition: UT_StringView.h:32
const char * getFullPath(UT_String &str) const
Definition: PRM_ParmOwner.h:48
virtual void pushAsPwdAndRunPython(PY_CompiledCode &compiled_code, PY_Result::Type desired_result_type, PY_Result &result, PY_EvaluationContext *context=NULL) const =0
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glew.h:2981
virtual fpreal getW() const =0
const UT_StringHolder myScriptDir
Definition: OP_Node.h:354
#define INSTANTIATE_FOR_ALL_NODE_TYPES(MACRO_FUNC)
This macro allows us to run another macro for all node types.
Definition: OP_Node.h:473
int mySubIndex
Definition: OP_Node.h:417
OP_InterestType
Definition: OP_DataTypes.h:45
UT_ValArray< const CL_Track * > CL_TrackListC
Definition: OP_Node.h:129
reverse_iterator rbegin()
Begin iterating over the array in reverse.
Definition: UT_Array.h:812
CH_CHANGE_TYPE
GLclampf f
Definition: glew.h:3499
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
exint length() const
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
Mapper that provides an HDA section name for a given shader node.
GLuint in
Definition: glew.h:11510
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
OP_OpTypeId myOptypeId
Definition: OP_Node.h:351
int64 exint
Definition: SYS_Types.h:120
void(* OP_EventMethod)(OP_Node *caller, void *callee, OP_EventType type, void *data)
Definition: OP_Value.h:153
GLuint buffer
Definition: glew.h:1680
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
const GLuint GLenum const void * binary
Definition: glew.h:3502
void resolveAndDeleteObsoleteParmList(PRM_ParmList *&obsolete_parms) override
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
GLuint GLuint end
Definition: glew.h:1253
#define INVALID_TABLE_NAME
Definition: OP_Node.h:245
GLsizei n
Definition: glew.h:4040
OP_Network * getRootCompiledParent() const
Definition: OP_Node.h:506
const GLfloat * c
Definition: glew.h:16296
virtual ~OP_TransformCallback()
Definition: OP_Node.h:190
UT_KnownPath
Definition: UT_PathSearch.h:52
Wrapper around hboost::intrusive_ptr.
iterator begin()
Definition: UT_Array.h:787
virtual bool triggerParmCallback(PRM_Parm *parmptr, fpreal now, int value, void *data, const UT_Options *options=0)=0
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
DEP_MicroNode & parmMicroNode(int parm_idx, int vi)
SYS_FORCE_INLINE const char * c_str() const
OP_OpTypeId
Definition: OP_OpTypeId.h:18
*Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
HUSD_API bool eval(VtValue &val, T &ret_val)
#define INSTANTIATE_FINDNODE_FUNCTIONS(PREFIX)
Definition: OP_Node.h:447
UT_ArrayMap< OP_ConnectorId, OP_Input * > OP_ConnectorInputMap
Definition: OP_Node.h:137
virtual void doGetFullPath(UT_WorkBuffer &str) const override
Compute the full path of the node.
OP_UIChangeType
Definition: OP_DataTypes.h:77
virtual void setItemExpose(bool expose)
virtual void buildOpDependencies()
GLuint color
Definition: glew.h:7902
Definition: OP_Dot.h:24
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
virtual bool getItemExpose() const
UT_ArrayMap< OP_ConnectorId, OP_Output * > OP_ConnectorOutputMap
Definition: OP_Node.h:138
int myVectorIndex
Definition: OP_Node.h:177
reverse_iterator rend()
End reverse iterator.
Definition: UT_Array.h:818
virtual bool changeSpareParms(UT_IStream &ds, UT_String &errors)
virtual int getPicked() const =0
GLuint GLsizei GLsizei GLchar * label
Definition: glew.h:8986
OP_API void OPclearNodeToChannelLinks()
GT_API const UT_StringHolder version
OP_TransformCallback * myParentXfo
Definition: OP_Node.h:223
GLsizei const GLchar *const * path
Definition: glew.h:6461
IFDmantra py
Definition: HDK_Image.dox:266
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
GLfloat GLfloat p
Definition: glew.h:16321
virtual void rebuildParmDependency(int parmidx)=0
unsigned int OP_ItemTypeMask
Definition: OP_ItemId.h:43
const UT_StringHolder myOptypeName
Definition: OP_Node.h:352
OP_API const char * OPtypeIdLabels[NUM_MANAGERS]
Nice label names used by network view, corresponding to OP_OpTypeId.
double fpreal
Definition: SYS_Types.h:276
A map of string to various well defined value types.
Definition: UT_Options.h:42
OP_EvaluateTransformTracksArgs(const UT_StringHolder name, UT_Matrix4D *w, UT_Matrix4D *l=nullptr, OP_TransformCallback *parent_cb=nullptr, int *timedep=nullptr)
Definition: OP_Node.h:197
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
bool operator==(const OP_NodeParmRef &other)
Definition: OP_Node.h:168
virtual short * getInput(int size)
virtual const UT_String & getItemName() const =0
GLuint counter
Definition: glew.h:2740
virtual void addExtraInput(OP_Node *op, OP_InterestType type)
virtual bool setItemName(const UT_String &name)=0
const void * ptr(const T *p)
Definition: format.h:3292
virtual void permissionError(const char *chname=0)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1254
typename set_type::iterator iterator
Inherit iterator and const_iterator.
Definition: UT_ArrayMap.h:103
#define OP_API
Definition: OP_API.h:10
OP_OTLLicenseType
OP_Output * myOutput
Definition: OP_Node.h:153
virtual unsigned referenceAllParameters(OP_Parameters *from, bool relative_references=true)
TransformMode
Definition: OP_Node.h:1110
OP_Node * myNode
Definition: OP_Node.h:415
void getOutputNodes(UT_Array< OP_Node * > &outputs, bool into_subnets=false, bool through_dots=true, int output_idx=-1) const
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
GA_API const UT_StringHolder pivot
base_iterator< const OP_Node *, true > const_iterator
Definition: UT_Array.h:780
OP_DataType
Definition: OP_DataTypes.h:28
OP_API const UT_StringHolder OP_USERDATA_WIRESTYLE
GLuint64EXT * result
Definition: glew.h:14007
UT_CycleDetect< OP_NodeParmRef > OP_NodeParmRefCycle
Definition: OP_Node.h:229
OP_Network * getParent() const
Definition: OP_Node.h:504
virtual void clearUndoFlags()
virtual UT_Color getColor() const
Accessors for color used in the network view.
virtual void convertOpdefToAbsolutePath(UT_String &str) const =0
This is the base class for all DOP nodes.
Definition: DOP_Node.h:77
virtual OP_Node * castToOPNode()
Definition: PRM_ParmOwner.h:45
virtual void spareParmRemoved(const char *parmname)=0
virtual fpreal getH() const =0
OP_NodeParmRef(const OP_Node *eval_node=0, const PRM_Parm *parm_ref=0, int vi=-1)
Definition: OP_Node.h:159
void lockedExecute(const F &functor)
Definition: UT_TaskLock.h:295
EXPR_API EXPR_GlobalStaticLock & ev_GlobalEvalLock()
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int operator==(const opParmData &v) const
Definition: OP_Node.h:419
#define const
Definition: zconf.h:214
GLubyte * pattern
Definition: glew.h:5711
virtual void syncNodeVersion(const char *old_version, const char *current_version, bool *node_deleted)
Options class for use with OP_Node::saveCommand()
Definition: OP_Node.h:358
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
#define DEFAULT_COMP_HASH_VALUE
Definition: OP_Node.h:242
OP_ScopeOp
Definition: OP_Parameters.h:58
bool wasInterrupted(T *i, int percent=-1)
OP_Input * myInput
Definition: OP_Node.h:145
OP_NodeFlags & flags()
Definition: OP_Node.h:1363
SYS_FORCE_INLINE PRM_ParmList * getParmList()
Definition: PRM_ParmOwner.h:67
GLsizei const GLfloat * value
Definition: glew.h:1849
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:7334
virtual PRM_ParmMicroNode * createParmMicroNodes(PRM_Parm &parm) const
#define UTstatic_pointer_cast
Definition: UT_SharedPtr.h:35
OP_EvaluateTransformTracksArgs(int index, UT_Matrix4D *w, UT_Matrix4D *l=nullptr, OP_TransformCallback *parent_cb=nullptr, int *timedep=nullptr)
Definition: OP_Node.h:207
GLint level
Definition: glew.h:1252
OP_API const UT_StringHolder OP_USERDATA_DESCRIPTIVE_PARM
GLboolean enable
Definition: glew.h:2745
GLdouble GLdouble t
Definition: glew.h:1398
OP_Input * mySavedInput
Definition: OP_Node.h:183
UT_LockedRawPtr< const OP_NodeList, OP_Lock > OP_LockedConstNodeList
Definition: OP_Node.h:232
virtual int getHasTakeData() const
Definition: OP_PostIt.h:42
iterator end()
End iterator.
Definition: UT_Array.h:792
OP_API OP_Node * OPgetNodeFromChannel(const CH_Channel *chp)
virtual bool isParmPendingOverride(const char *, int) const
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
OP_ConnectorId myName
Definition: OP_Node.h:154
GLboolean GLuint group
Definition: glew.h:2745
UT_StringHolder myTrackName
Definition: OP_Node.h:217
GLenum GLsizei len
Definition: glew.h:7752
unsigned int uint32
Definition: SYS_Types.h:40
virtual const PRM_Parm * traverseRef(int *sub_idx, fpreal time, int parm_idx, int vec_idx) const =0
UT_String myLabel
Definition: OP_Node.h:414