00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __OP_Node_h__
00020 #define __OP_Node_h__
00021
00022 #include "OP_API.h"
00023 #include "OP_BundleReferences.h"
00024 #include "OP_Cache.h"
00025 #include "OP_ConnectorId.h"
00026 #include "OP_Context.h"
00027 #include "OP_DataMicroNode.h"
00028 #include "OP_DataTypes.h"
00029 #include "OP_Dependency.h"
00030 #include "OP_Error.h"
00031 #include "OP_InterestRef.h"
00032 #include "OP_Lock.h"
00033 #include "OP_NetworkBoxItem.h"
00034 #include "OP_NetworkBoxItemFlags.h"
00035 #include "OP_NodeFlags.h"
00036 #include "OP_OTLLicenseType.h"
00037 #include "OP_Output.h"
00038 #include "OP_Parameters.h"
00039 #include "OP_PropagateData.h"
00040 #include "OP_TaskState.h"
00041 #include "OP_Version.h"
00042
00043 #include <DEP/DEP_MicroNode.h>
00044 #include <IMG/IMG_Raster.h>
00045 #include <UT/UT_Algorithm.h>
00046 #include <UT/UT_BitArray.h>
00047 #include <UT/UT_BoundingBox.h>
00048 #include <UT/UT_Color.h>
00049 #include <UT/UT_Error.h>
00050 #include <UT/UT_IntArray.h>
00051 #include <UT/UT_Options.h>
00052 #include <UT/UT_PathSearch.h>
00053 #include <UT/UT_PtrArray.h>
00054 #include <UT/UT_RefArray.h>
00055 #include <UT/UT_String.h>
00056 #include <UT/UT_TokenString.h>
00057 #include <UT/UT_Vector3.h>
00058 #include <UT/UT_VectorTypes.h>
00059 #include <UT/UT_XformOrder.h>
00060 #include <UT/UT_Performance.h>
00061 #include <SYS/SYS_AtomicInt.h>
00062 #include <SYS/SYS_Math.h>
00063 #include <SYS/SYS_Types.h>
00064
00065 #include <map>
00066 #include <string>
00067 #include <vector>
00068 #include <iostream.h>
00069
00070 class UT_Ramp;
00071 class UT_WorkArgs;
00072 class UT_WorkBuffer;
00073 class UT_StringArray;
00074 class UT_InfoTree;
00075 class UT_Undo;
00076 class PY_CompiledCode;
00077 class PY_OpaqueObject;
00078 class PY_Result;
00079 class DD_Source;
00080 class DD_ChoiceList;
00081 class CL_Clip;
00082 class CL_Track;
00083 class EV_SYMBOL;
00084 class CMD_Args;
00085 class PRM_BatchList;
00086 class PRM_Parm;
00087 class PRM_RefId;
00088 class OP_Operator;
00089 class OP_OutputCodeParms;
00090 class OP_InputIndirect;
00091 class OP_NodeInfoParms;
00092 class OP_Input;
00093 class OP_Output;
00094 class OP_Node;
00095 class OP_Network;
00096 class OP_Group;
00097 class OP_Bundle;
00098 class OP_PreDefRules;
00099 class OP_GalleryEntry;
00100 class OP_SaveFlags;
00101 class OP_GlobContext;
00102 class DOP_Parent;
00103 class VOP_CodeGenerator;
00104 class VOP_ScriptMaterialCodeMapper;
00105
00106
00107 typedef UT_PtrArray<const CL_Track *> CL_TrackListC;
00108
00109 typedef int (*OP_EditCallback)(void *data, OP_Node *src,
00110 CL_Track *track, fpreal t, fpreal value);
00111
00112 typedef std::map < OP_ConnectorId, OP_Input* > TStringInputMap;
00113 typedef std::map < OP_ConnectorId, OP_Output* > TStringOutputMap;
00114
00115
00116 #define TInputsIterator TStringInputMap::iterator
00117
00118 struct OP_InputPair
00119 {
00120 OP_Input *myInput;
00121 OP_ConnectorId myName;
00122 };
00123 typedef std::vector < OP_InputPair > TInputPairs;
00124
00125 struct OP_OutputPair
00126 {
00127 OP_Output *myOutput;
00128 OP_ConnectorId myName;
00129 };
00130 typedef std::vector < OP_OutputPair > TOutputPairs;
00131
00132
00133 typedef UT_CycleDetect<OP_Node *> OP_NodeCycleDetect;
00134 struct OP_NodeParmRef
00135 {
00136 OP_NodeParmRef(const OP_Node *eval_node = 0,
00137 const PRM_Parm *parm_ref = 0,
00138 int vi = -1)
00139 : myEvalNode(eval_node)
00140 , myParmRef(parm_ref)
00141 , myVectorIndex(vi)
00142 {
00143 }
00144
00145 bool operator==(const OP_NodeParmRef &other)
00146 {
00147 return (myEvalNode == other.myEvalNode
00148 && myParmRef == other.myParmRef
00149 && myVectorIndex == other.myVectorIndex);
00150 }
00151
00152 const OP_Node * myEvalNode;
00153 const PRM_Parm * myParmRef;
00154 int myVectorIndex;
00155 };
00156 typedef UT_CycleDetect<OP_NodeParmRef> OP_NodeParmRefCycle;
00157
00158 typedef UT_LockedRawPtr<OP_NodeList, OP_Lock>
00159 OP_LockedNodeList;
00160 typedef UT_LockedRawPtr<const OP_NodeList, OP_Lock>
00161 OP_LockedConstNodeList;
00162
00163 struct OP_UnresolvedConnection
00164 {
00165 UT_String myInputName;
00166 OP_Input* mySavedInput;
00167 };
00168 typedef std::vector < OP_UnresolvedConnection* > TUnresolvedInputs;
00169
00170
00171 #define OPREF_PREFIX "op:"
00172 #define OPREF_PREFIX_LEN 3
00173
00174 #define DEFAULT_COMP_HASH_VALUE (17*19)
00175
00176
00177
00178
00179
00180
00181 #define OP_INVALID_NODE_ID -999
00182
00183
00184 #define INVALID_TABLE_NAME "Node"
00185 #define OBJ_TABLE_NAME "Object"
00186 #define SOP_TABLE_NAME "Sop"
00187 #define POPNET_TABLE_NAME "Particle"
00188 #define POP_TABLE_NAME "Pop"
00189 #define CHOPNET_TABLE_NAME "ChopNet"
00190 #define CHOP_TABLE_NAME "Chop"
00191 #define ROP_TABLE_NAME "Driver"
00192 #define SHOP_TABLE_NAME "Shop"
00193 #define COP2_TABLE_NAME "Cop2"
00194 #define COPNET_TABLE_NAME "CopNet"
00195 #define VOP_TABLE_NAME "Vop"
00196 #define VOPNET_TABLE_NAME "VopNet"
00197 #define DOP_TABLE_NAME "Dop"
00198
00199
00200 #define MGR_TABLE_NAME "Manager"
00201 #define DIR_TABLE_NAME "Director"
00202
00203
00204
00205 #define INVALID_SCRIPT_NAME "node"
00206 #define OBJ_SCRIPT_NAME "obj"
00207 #define SOP_SCRIPT_NAME "sop"
00208 #define POPNET_SCRIPT_NAME "part"
00209 #define POP_SCRIPT_NAME "pop"
00210 #define CHOPNET_SCRIPT_NAME "ch"
00211 #define CHOP_SCRIPT_NAME "chop"
00212 #define ROP_SCRIPT_NAME "out"
00213 #define SHOP_SCRIPT_NAME "shop"
00214 #define COPNET_SCRIPT_NAME "img"
00215 #define COP2_SCRIPT_NAME "cop2"
00216 #define VOP_SCRIPT_NAME "vop"
00217 #define VOPNET_SCRIPT_NAME "vex"
00218 #define DOP_SCRIPT_NAME "dop"
00219
00220
00221 #define MGR_SCRIPT_NAME "mgr"
00222 #define DIR_SCRIPT_NAME "dir"
00223
00224
00225 #define INVALID_OPTYPE_NAME "NODE"
00226 #define OBJ_OPTYPE_NAME "OBJ"
00227 #define SOP_OPTYPE_NAME "SOP"
00228 #define POPNET_OPTYPE_NAME "PART"
00229 #define POP_OPTYPE_NAME "POP"
00230 #define CHOPNET_OPTYPE_NAME "CHOPNET"
00231 #define CHOP_OPTYPE_NAME "CHOP"
00232 #define ROP_OPTYPE_NAME "ROP"
00233 #define SHOP_OPTYPE_NAME "SHOP"
00234 #define COP2_OPTYPE_NAME "COP2"
00235 #define COPNET_OPTYPE_NAME "IMG"
00236 #define VOP_OPTYPE_NAME "VOP"
00237 #define VOPNET_OPTYPE_NAME "VOPNET"
00238 #define DOP_OPTYPE_NAME "DOP"
00239
00240
00241
00242
00243
00244 #define MGR_OPTYPE_NAME "MGR"
00245 #define DIR_OPTYPE_NAME "DIR"
00246
00247 #define OP_DEFAULT_COLOR_R 0.8F
00248 #define OP_DEFAULT_COLOR_G 0.8F
00249 #define OP_DEFAULT_COLOR_B 0.8F
00250 #define OP_DEFAULT_COLOR UT_RGB, \
00251 OP_DEFAULT_COLOR_R, \
00252 OP_DEFAULT_COLOR_G, \
00253 OP_DEFAULT_COLOR_B
00254
00255 enum OP_OpTypeId
00256 {
00257 INVALID_OPTYPE_ID = -1,
00258 OBJ_OPTYPE_ID = 0,
00259 SOP_OPTYPE_ID,
00260 POPNET_OPTYPE_ID,
00261 POP_OPTYPE_ID,
00262 CHOPNET_OPTYPE_ID,
00263 CHOP_OPTYPE_ID,
00264 ROP_OPTYPE_ID,
00265 SHOP_OPTYPE_ID,
00266 COP2_OPTYPE_ID,
00267 COPNET_OPTYPE_ID,
00268 VOP_OPTYPE_ID,
00269 VOPNET_OPTYPE_ID,
00270 DOP_OPTYPE_ID,
00271 MGR_OPTYPE_ID,
00272 DIR_OPTYPE_ID,
00273 NUM_MANAGERS
00274 };
00275
00276
00277
00278 enum OP_CompileStatusType
00279 {
00280 OP_COMPILE_STATUS_UNDEFINED = 0,
00281 OP_COMPILE_STATUS_COMPILED,
00282 OP_COMPILE_STATUS_UNCOMPILED
00283 };
00284
00285
00286
00287
00288 #define VOP_OUTPUT_NODE_NAME "output"
00289 #define VOP_SUBNET_OUTPUT_NODE_NAME "suboutput"
00290 #define VOP_SUBNET_INPUT_NODE_NAME "subinput"
00291
00292
00293
00294 #define SHOP_MANAGEMENT_OPTYPE "shopnet"
00295 #define POP_MANAGEMENT_OPTYPE "popnet"
00296 #define COP2_MANAGEMENT_OPTYPE "cop2net"
00297 #define ROP_MANAGEMENT_OPTYPE "ropnet"
00298 #define CHOP_MANAGEMENT_OPTYPE "chopnet"
00299 #define SOP_MANAGEMENT_OPTYPE "sopnet"
00300 #define OBJ_MANAGEMENT_OPTYPE "objnet"
00301 #define VOP_MANAGEMENT_OPTYPE "vopnet"
00302 #define DOP_MANAGEMENT_OPTYPE "dopnet"
00303
00304
00305
00306
00307
00308 class OP_API OP_TypeInfo
00309 {
00310 public:
00311 OP_OpTypeId myOptypeId;
00312 const char *myOptypeName;
00313 const char *myTableName;
00314 const char *myScriptDir;
00315 };
00316
00317
00318
00319 struct OP_API OP_SaveCommandOptions
00320 {
00321
00322 OP_SaveCommandOptions
00323 ( bool values_only_ = false
00324 , bool defaultstoo_ = true
00325 , bool docreate_ = true
00326 , bool doparms_ = true
00327 , bool doflags_ = true
00328 , bool dowires_ = true
00329 , bool dowiresout_ = true
00330 , bool frames_ = false
00331 , bool dogeneral_ = false
00332 , bool dochblock_ = true
00333 , bool dospareparms_ = true
00334 , bool omit_version_info_ = false
00335 )
00336 : values_only(values_only_)
00337 , defaultstoo(defaultstoo_)
00338 , docreate(docreate_)
00339 , doparms(doparms_)
00340 , doflags(doflags_)
00341 , dowires(dowires_)
00342 , dowiresout(dowiresout_)
00343 , frames(frames_)
00344 , dogeneral(dogeneral_)
00345 , dochblock(dochblock_)
00346 , dospareparms(dospareparms_)
00347 , omit_version_info(omit_version_info_)
00348 {
00349 }
00350
00351 bool values_only;
00352 bool defaultstoo;
00353 bool docreate;
00354 bool doparms;
00355 bool doflags;
00356 bool dowires;
00357 bool dowiresout;
00358 bool frames;
00359 bool dogeneral;
00360 bool dochblock;
00361 bool dospareparms;
00362 bool omit_version_info;
00363 };
00364
00365
00366
00367
00368
00369
00370
00371
00372 class OP_API opParmData
00373 {
00374 public:
00375 fpreal myValue;
00376 UT_String myLabel;
00377 OP_Node *myNode;
00378 int myIndex;
00379 int mySubIndex;
00380
00381 int operator==(const opParmData &v) const
00382 {
00383 return (myValue == v.myValue &&
00384 myLabel == v.myLabel &&
00385 myNode == v.myNode &&
00386 myIndex == v.myIndex &&
00387 mySubIndex == v.mySubIndex
00388 );
00389 }
00390 };
00391
00392
00393
00394 class OBJ_Node;
00395 class SOP_Node;
00396 class POP_Node;
00397 class POPNET_Node;
00398 class CHOPNET_Node;
00399 class CHOP_Node;
00400 class COP2_Node;
00401 class COPNET_Node;
00402 class ROP_Node;
00403 class SHOP_Node;
00404 class VOP_Node;
00405 class VOPNET_Node;
00406 class DOP_Node;
00407
00408 #define INSTANTIATE_FINDNODE_FUNCTIONS(PREFIX) \
00409 PREFIX##_Node *find##PREFIX##Node(const char *path) const \
00410 { \
00411 OP_Node *node; \
00412 \
00413 node = findNode(path); \
00414 if (node) return node->castTo##PREFIX##Node(); \
00415 return 0; \
00416 }
00417 #define INSTANTIATE_CASTNODE_FUNCTIONS(PREFIX) \
00418 PREFIX##_Node *castTo##PREFIX##Node() const \
00419 { \
00420 \
00421 \
00422 \
00423 UT_ASSERT(this); \
00424 if (!this) return 0; \
00425 if (getOpTypeID() == PREFIX##_OPTYPE_ID) \
00426 { \
00427 return (PREFIX##_Node *) this; \
00428 } \
00429 return 0; \
00430 }
00431
00432
00433 #define INSTANTIATE_FOR_ALL_NODE_TYPES(MACRO_FUNC) \
00434 MACRO_FUNC(OBJ) \
00435 MACRO_FUNC(SOP) \
00436 MACRO_FUNC(POPNET) \
00437 MACRO_FUNC(POP) \
00438 MACRO_FUNC(CHOPNET) \
00439 MACRO_FUNC(CHOP) \
00440 MACRO_FUNC(ROP) \
00441 MACRO_FUNC(SHOP) \
00442 MACRO_FUNC(COP2) \
00443 MACRO_FUNC(COPNET) \
00444 MACRO_FUNC(VOP) \
00445 MACRO_FUNC(VOPNET) \
00446 MACRO_FUNC(DOP)
00447
00448 class OP_API OP_Node : public OP_Parameters, public OP_NetworkBoxItem
00449 {
00450 public:
00451
00452 static const OP_TypeInfo *getOpInfoFromOpTypeID(OP_OpTypeId opid);
00453 static const OP_TypeInfo *getOpInfoFromOpTypeName(const char *name);
00454 static const OP_TypeInfo *getOpInfoFromTableName(const char *name);
00455 static const OP_TypeInfo *getOpInfoFromScriptDir(const char *dir);
00456
00457 OP_Network *getParent() const { return myParent; }
00458 OP_Network *getRootCompiledParent() const { return myRootCompiledParent; }
00459
00460
00461
00462
00463 virtual OP_Network *getParentNetwork() const;
00464
00465
00466
00467 bool getIsContainedBy(const OP_Node *testparent) const;
00468
00469
00470 const UT_String &getNetName() const;
00471
00472
00473
00474
00475 virtual OP_OpTypeId getOpTypeID() const = 0;
00476
00477
00478
00479
00480
00481 virtual const char *getOpType() const = 0;
00482
00483 virtual OP_ItemType getItemType() const;
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 INSTANTIATE_FOR_ALL_NODE_TYPES(INSTANTIATE_FINDNODE_FUNCTIONS)
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504 INSTANTIATE_FOR_ALL_NODE_TYPES(INSTANTIATE_CASTNODE_FUNCTIONS)
00505
00506
00507
00508 const UT_String &getDelScript(void) const { return myDelScript; }
00509
00510
00511
00512 bool setDelScript(const char *str);
00513
00514
00515
00516 const UT_String &getComment(void) const { return myComment; }
00517 bool setComment(const char *str);
00518
00519
00520
00521
00522
00523
00524
00525 virtual const UT_Color *getColor() const { return &myColor; }
00526 virtual bool setColor(const UT_Color &col);
00527
00528
00529
00530
00531
00532
00533 virtual void setXY(fpreal x, fpreal y);
00534 virtual fpreal getX() const { return myPosX; }
00535 virtual fpreal getY() const { return myPosY; }
00536 virtual fpreal getW() const;
00537 virtual fpreal getH() const;
00538
00539
00540
00541
00542
00543 bool setXYWithBoundsChecks(fpreal x, fpreal y);
00544
00545 void pickRequest(int shift);
00546
00547
00548 static int isValidOpName(const char *s,
00549 bool allow_rel_paths = false,
00550 bool ignore_node_names_env_var = false);
00551 static int isValidOpPath(const char *s);
00552 static bool forceValidOpName(UT_String &name);
00553
00554
00555
00556
00557 virtual int findString(const char *str, bool fullword,
00558 bool usewildcards) const;
00559 virtual int changeString(const char *from, const char *to,
00560 bool fullword);
00561
00562
00563
00564
00565
00566
00567 bool notifyVarChange(
00568 const char *varname,
00569 OP_NodeList *changed_nodes = NULL);
00570
00571
00572 virtual int getNchildren() const;
00573 virtual OP_Node *getChild(const char *name, int *hint=0) const;
00574 virtual OP_Node *getChild(int index) const;
00575 void getPickedChildren(OP_NodeList &picked,
00576 bool include_hidden=false) const;
00577 void getAllChildren(OP_NodeList &children) const;
00578 virtual OP_Node *matchChild(const char *pattern, OP_Node *prevmatch=0,
00579 const char *optype=0,
00580 int casesensitive = 0) const;
00581 virtual OP_Node *matchChildBackwards(const char *pattern,
00582 OP_Node *prevmatch=0,
00583 const char *optype=0,
00584 int casesensitive = 0) const;
00585 virtual OP_Network *createProxyRefNode( const char *path );
00586
00587
00588 static OP_Node *lookupNode(int unique_id, bool include_proxy=false)
00589 {
00590 if( unique_id >= 0 && unique_id <= theUniqueId
00591 && theUniqueNodes[unique_id] )
00592 {
00593 if( include_proxy || !theUniqueNodes[unique_id]
00594 ->isProxyRefNode() )
00595 return theUniqueNodes[unique_id];
00596 }
00597 return 0;
00598 }
00599 static int getNumUniqueIds()
00600 {
00601 return theUniqueId + 1;
00602 }
00603
00604 static void getAllNodes(OP_NodeList &nodes);
00605
00606 int getUniqueId() const
00607 { return myUniqueId; }
00608
00609
00610
00611
00612 bool expandGroupPattern(const char *pattern,
00613 UT_String &result,
00614 bool expandToFullPaths = false);
00615
00616
00617
00618 bool patternContainsBundle(const char *pattern,
00619 const OP_Bundle *bundle) const;
00620 bool patternContainsGroup(const char *pattern,
00621 const OP_Group *group) const;
00622
00623 virtual int isManager() const;
00624
00625
00626
00627 virtual int isManagementNode() const;
00628
00629
00630
00631
00632 bool isEffectivelyAManagementNode() const;
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642 virtual int isSubNetwork(bool includemanagementops) const;
00643 virtual int isNetwork() const;
00644 virtual int isInSubNetwork() const;
00645
00646 bool isProxyRefNode() const
00647 { return myIsProxyRefNode; }
00648 void setProxyRefNode(bool f)
00649 { myIsProxyRefNode = f; }
00650
00651
00652
00653
00654 int isNetworkWithKids() const;
00655
00656 virtual int isVex() const;
00657
00658
00659
00660
00661
00662 OP_Bundle * getParmBundle(const char* parm_name, int vector_index,
00663 UT_String &pattern, OP_Network *creator,
00664 const char *filter);
00665 void markBundleRefsAsUnused();
00666 void cleanUnusedBundleRefs();
00667 void cleanAllBundleRefs();
00668
00669
00670
00671
00672
00673
00674 virtual bool bundleChanged(const OP_Bundle *bundle);
00675
00676
00677 void touchBundleParm(const char *name);
00678 void touchBundleParm(int parm_index);
00679
00680
00681 virtual int getDandROpsEqual() { return 1; }
00682
00683
00684 virtual int updateDandROpsEqual(int = 1) { return 1; }
00685
00686 int isAncestor(const OP_Node *node,
00687 int checkextra=1) const
00688 { return isInputAncestor(node, checkextra); }
00689
00690
00691
00692
00693
00694 bool isInputAncestor(const OP_Node *parent,
00695 bool check_extra=true) const;
00696
00697
00698
00699
00700 bool isParentAncestor(const OP_Node *parent) const;
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710 const char *getInfoText(OP_Context &context,
00711 OP_NodeInfoParms &parms);
00712
00713 virtual void getNodeSpecificInfoText(OP_Context &context,
00714 OP_NodeInfoParms &parms);
00715
00716
00717 OP_Node *findNode(const char *path) const;
00718
00719
00720
00721
00722 OP_Node *findSubNode(const char *path) const;
00723
00724
00725
00726 virtual OP_NetworkBox *findNetworkBox(const char * )
00727 { return NULL; }
00728
00729
00730
00731 virtual OP_PostIt* findPostItNote(const char * )
00732 { return NULL; }
00733
00734
00735
00736
00737 virtual OP_NetworkBoxItem *findItem(const char *const_path,
00738 OP_ItemTypeMask item_type =
00739 OP_ITEMTYPE_ALL);
00740
00741
00742
00743
00744
00745
00746 SOP_Node *getSOPNode(const char *path, int addextra = 0) const;
00747
00748
00749 COP2_Node *getCOP2Node(const char *path, int addextra = 0) const;
00750
00751
00752 POP_Node *getPOPNode(const char *path, int addextra = 0) const;
00753
00754
00755 DOP_Node *getDOPNode(const char *path, int addextra = 0) const;
00756 ROP_Node *getROPNode(const char *path, int addextra = 0) const;
00757
00758 virtual OP_Node *castToOPNode() { return this; }
00759 virtual const OP_Node *castToOPNode() const { return this; }
00760
00761
00762 virtual void getPathWithSubnet(UT_String &str) const;
00763
00764
00765 void getRelativePathTo(const OP_Node *base_node,
00766 UT_String &result) const;
00767
00768
00769
00770
00771
00772 void completePath(const char *prefixpath,
00773 UT_String &completepath) const;
00774
00775 virtual CH_Channel *getTrackChannel(const char *name);
00776
00777 virtual bool findParmFromTrack(fpreal t, const char *trackname,
00778 OP_NodeParmRefCycle &cycle,
00779 OP_Node *&node,
00780 PRM_Parm *&parm, int &vecidx);
00781
00782
00783
00784
00785 virtual void evaluateBatchParms(PRM_BatchList &list, fpreal now);
00786
00787
00788
00789
00790
00791 void globNodes(const char *pat, UT_String *expand,
00792 UT_PtrArray<OP_Node *> *list=0,
00793 OP_GlobContext *context = 0,
00794 const char *prefix = " ");
00795
00796 CH_Channel *findChannel(const char *path);
00797 void globChannels(const char *, UT_String &expand,
00798 OP_GlobContext *context = 0,
00799 const char *prefix = " ") const;
00800
00801 void globChannels(const char *pattern,
00802 CH_ChannelList &clist,
00803 OP_GlobContext *context = 0,
00804 OP_Node *dependent = 0);
00805
00806 void globChanRefs(const char *pattern,
00807 CH_ChannelRefList &list,
00808 OP_GlobContext *context = 0,
00809 OP_Node *dependent = 0);
00810
00811 int globParms(const char *pattern, fpreal t,
00812 UT_RefArray<opParmData> &list,
00813 OP_GlobContext *context = 0,
00814 OP_Node *dependent = 0,
00815 int calc_value = 1);
00816
00817
00818 void globNodeParms(const char *pattern, fpreal t,
00819 UT_RefArray<opParmData> &list,
00820 OP_GlobContext *context,
00821 OP_Node *dependent,
00822 int calc_value,
00823 bool animated_only);
00824
00825
00826 void globNodeChannels(const char *pattern,
00827 CH_ChannelList &list,
00828 OP_GlobContext *context,
00829 int *parm_start = NULL,
00830 UT_IntArray *parm_indices = NULL,
00831 UT_IntArray *parm_sub_indices = NULL
00832 ) const;
00833
00834
00835 void globNodeChanRefs(const char *pattern,
00836 CH_ChannelRefList &list,
00837 OP_GlobContext *context,
00838 int *parm_start = NULL,
00839 UT_IntArray *parm_indices = NULL,
00840 UT_IntArray *parm_sub_indices = NULL
00841 ) const;
00842
00843
00844
00845
00846 virtual void globNetworkBoxes(const char *pat, UT_String *expand,
00847 UT_PtrArray<OP_NetworkBox *> *list=0,
00848 OP_GlobContext *glob_context = 0,
00849 const char *prefix = " ");
00850
00851 virtual void globPostIts(const char *pat, UT_String *expand,
00852 UT_PtrArray<OP_PostIt *> *list=0,
00853 OP_GlobContext *glob_context = 0,
00854 const char *prefix = " ");
00855
00856
00857 int getAllChannels(CH_ChannelList &list, int scoped=0);
00858
00859
00860
00861 virtual void opChanged(OP_EventType reason, void *data=0);
00862
00863
00864
00865 virtual bool opShouldHandleChange(OP_EventType reason);
00866
00867
00868
00869
00870 virtual void referencedParmChanged(int pi);
00871
00872
00873
00874
00875
00876 virtual void forceRecook(bool evensmartcache = true);
00877
00878
00879
00880
00881
00882 virtual void reloadExternalFiles();
00883
00884
00885
00886
00887
00888 virtual unsigned needToCook(OP_Context &context, bool queryonly=false);
00889
00890
00891
00892
00893
00894 virtual bool cook(OP_Context &context);
00895
00896
00897
00898 bool parallelCook(OP_Context &context);
00899
00900
00901 static bool parallelCook(OP_Context &context,
00902 const OP_NodeList &nodes);
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 OP_CookLock & getCookLock() { return myCookLock; }
00916 bool lockForCooking(OP_CookLock::Scope &scope);
00917
00918
00919 OP_TaskState & taskState() { return myTaskState; }
00920 const OP_TaskState & taskState() const { return myTaskState; }
00921
00922
00923
00924
00925 virtual OP_ERROR pubCookInputGroups(OP_Context &context, int alone = 0);
00926
00927 void bumpVersionParm()
00928 { myDataMicroNode.bumpModVersion(); }
00929 int cookParmsModified() const
00930 { return myDataMicroNode.isModVersionOutdated(); }
00931
00932
00933
00934
00935
00936
00937 virtual int getDataClass() const;
00938
00939
00940
00941 virtual void getXformOrder(UT_XformOrder &xord, CH_Channel *chp);
00942
00943
00944
00945 virtual OP_DATA_TYPE getCookedDataType() const = 0;
00946 virtual void *getCookedData(OP_Context &);
00947 virtual void deleteCookedData() = 0;
00948
00949 virtual int saveCookedData(ostream &os, OP_Context &,
00950 int binary = 0) = 0;
00951 virtual bool loadCookedData(UT_IStream &is, const char *path=0);
00952 virtual int saveCookedData(const char *filename, OP_Context &) = 0;
00953
00954
00955
00956 virtual int getRelativeTransform(OP_Node &to, UT_Matrix4 &xform,
00957 OP_Context &context);
00958 virtual int getRelativeTransform(OP_Node &to, UT_DMatrix4 &xform,
00959 OP_Context &context);
00960
00961 virtual int getRelativeCaptureTransform(OP_Node &to,
00962 UT_Matrix4 &xform,
00963 OP_Context &context);
00964 virtual int getRelativeCaptureTransform(OP_Node &to,
00965 UT_DMatrix4 &xform,
00966 OP_Context &context);
00967 virtual void getRotations(fpreal t,
00968 fpreal &rx, fpreal &ry, fpreal &rz);
00969
00970
00971
00972 virtual int getWorldTransform(UT_DMatrix4 &xform, OP_Context &);
00973 virtual int getIWorldTransform(UT_DMatrix4 &xform, OP_Context &);
00974
00975
00976 int getWorldTransform(UT_Matrix4 &xform, OP_Context &);
00977 int getIWorldTransform(UT_Matrix4 &xform, OP_Context &);
00978
00979
00980
00981 void addTransformError(const OP_Node &node,
00982 const char *label=0) const;
00983
00984
00985
00986 virtual bool getBoundingBox(UT_BoundingBox &box, OP_Context &);
00987
00988
00989
00990 virtual const char *getInternalOpTable() const
00991 { return INVALID_TABLE_NAME; }
00992 virtual OP_Operator *getInternalOperator() const
00993 { return 0; }
00994
00995 virtual const char *inputLabel(unsigned idx) const;
00996 virtual const char *outputLabel(unsigned idx) const;
00997
00998
00999
01000 virtual const char *inputConnectorLabel(unsigned idx);
01001
01002
01003 virtual int isRefInput(unsigned ) const { return 0; }
01004
01005
01006
01007
01008
01009 bool hasRefOutputs(bool recurse_on_implicits = false) const;
01010
01011
01012
01013 virtual int getAuxInput() const;
01014
01015
01016
01017
01018
01019
01020
01021 int setLock(int state, int saveundo = 1);
01022 int getSoftLock() const {return flags().getSoftLocked();}
01023 int getHardLock() const {return flags().getHardLocked();}
01024 int getLock() const {return flags().getLocked(); }
01025
01026
01027
01028
01029
01030 int getNetworkLock(bool relaxedlockcheck = false,
01031 const OP_Node *inputNode = NULL) const;
01032
01033
01034 virtual int setModelLock(int on_off,
01035 void *modeler = 0,
01036 int allow_softlock_promotion=0,
01037 UT_Undo *undo = 0);
01038 int getModelLock() const;
01039
01040
01041
01042
01043 int setUnload(int on_off);
01044 int getUnload() const;
01045
01046
01047 virtual bool isLoaded() const { return true; }
01048
01049
01050
01051
01052 virtual bool unloadData();
01053
01054
01055 void takeActivateFlag(uchar flag, bool enable=true,
01056 bool send_flag_event=true);
01057 void takeDeactivateFlag(uchar flag)
01058 { takeActivateFlag(flag, false); }
01059 bool takeIsActiveFlag(uchar flag) const;
01060 void setHasTakeData(int onoff);
01061
01062 bool canAccessFlag(unsigned mask, uchar flag) const;
01063
01064
01065
01066
01067
01068
01069 virtual int setPicked(int on_off,
01070 bool propagate_parent_event = true);
01071
01072
01073
01074
01075
01076 int setEditPicked(int on_off,
01077 bool propagate_parent_event = true);
01078
01079 void setAutoscope(bool on_off) { myAutoscope = on_off; }
01080 bool isAutoscope() { return myAutoscope; }
01081
01082 int setCurrent(int on_off);
01083 int setExpose(int on_off);
01084 int setBypass(int on_off);
01085 int setTemplate(int on_off);
01086 int setFootprint(int on_off);
01087 int setXray(int on_off);
01088 int setDisplay(int on_off);
01089 int setRender(int on_off);
01090 int setHighlight(int on_off);
01091 int setModified(int on_off);
01092 int setSaveBypass(int on_off);
01093 int setSaveData(int on_off);
01094
01095 virtual int setPickable(int on_off);
01096 virtual int setAudio(int on_off);
01097 virtual int setExport(int on_off);
01098 virtual int setDebug(int on_off);
01099
01100
01101
01102
01103 void userSetTemplate(bool onoff);
01104
01105
01106
01107
01108 void userSetSelectableTemplate(bool onoff);
01109
01110
01111
01112 virtual int setFlag(char tag, int on_off);
01113 virtual int getFlag(char tag) const;
01114
01115 virtual int getPicked() const {return flags().getPicked(); }
01116 virtual int getEditPicked() const
01117 { return flags().getEditPicked(); }
01118 int getCurrent() const;
01119 int getDisplay() const {return flags().getDisplay(); }
01120 int getRender() const {return flags().getRender(); }
01121 int getHighlight()const {return flags().getHighlight();}
01122 int getBypass() const {return flags().getBypass(); }
01123 int getTemplate() const {return flags().getTemplate(); }
01124 int getFootprint() const {return flags().getFootprint(); }
01125 int getXray() const {return flags().getXray(); }
01126 int getExpose() const {return flags().getExpose(); }
01127 int getModified() const {return flags().getModified(); }
01128 int getSaveBypass() const{return flags().getSaveBypass(); }
01129 int getSaveData() const {return flags().getSaveData(); }
01130 virtual int getHasTakeData() const
01131 { return flags().getHasTakeData(); }
01132 virtual int getPickable();
01133 virtual int getAudio() const;
01134 virtual int getExport() const;
01135 virtual int getDebug() const;
01136 OP_Node *getPickableSelfOrParent();
01137
01138
01139 virtual void setExtraFlag(char, int) {}
01140
01141
01142
01143
01144
01145 virtual void setExtraFlags(int axis);
01146
01147
01148
01149
01150 int setCompress(int on_off);
01151 int getCompress() const;
01152
01153
01154
01155 void setCurrentAndPicked();
01156
01157
01158
01159
01160
01161
01162
01163 virtual bool setVisible(int onoff);
01164 virtual bool getVisible() const;
01165
01166
01167
01168
01169 virtual const OP_NodeFlags &flags() const
01170 { return static_cast<const OP_NodeFlags &>(OP_NetworkBoxItem::flags()); }
01171 virtual OP_NodeFlags &flags()
01172 { return static_cast<OP_NodeFlags &>(OP_NetworkBoxItem::flags()); }
01173
01174 virtual void getSaveFlagsString(UT_String &cmd,
01175 const char *flags,
01176 bool save_to_hip) const;
01177 virtual void getPreParmSaveFlagsString( UT_String &cmd ) const;
01178 virtual void getPostParmSaveFlagsString( UT_String &cmd ) const;
01179
01180 int hasOpInterest(void *data, OP_EventMethod m) const
01181 { return myEventValue.hasOpInterest(data, m); }
01182 void addOpInterest(void *data, OP_EventMethod m)
01183 { myEventValue.addOpInterest(data, m); }
01184 void removeOpInterest(void *data, OP_EventMethod m)
01185 { myEventValue.removeOpInterest(data, m); }
01186 int isBeingDeleted() const
01187 { return myBeingDeleted; }
01188 void setNodeBeingDeleted(int beingdeleted);
01189
01190 void setConnectionsChanging(bool value)
01191 { myConnectionsChanging = value; }
01192
01193
01194
01195
01196
01197
01198
01199
01200 static void repositionOpsMaxY(OP_NodeList &ops,
01201 UT_PtrArray<OP_NetworkBox *> &netboxes,
01202 fpreal x, fpreal y);
01203
01204
01205 virtual unsigned minInputs() const;
01206
01207
01208 virtual unsigned maxInputs() const;
01209
01210
01211
01212 virtual unsigned getNumVisibleInputs() const;
01213
01214
01215
01216
01217
01218 virtual unsigned orderedInputs() const;
01219
01220
01221
01222 virtual unsigned maxOutputs() const;
01223
01224
01225
01226 virtual unsigned getNumVisibleOutputs() const;
01227
01228
01229 bool hasUnorderedInputs() const;
01230
01231
01232
01233
01234
01235
01236
01237
01238 virtual unsigned nInputs() const;
01239
01240
01241
01242 unsigned nConnectedInputs() const;
01243
01244 unsigned getActiveInputIndex() const
01245 { return myActiveInputIndex; }
01246 void setActiveInputIndex(unsigned idx);
01247
01248
01249 OP_Node *getInput(unsigned idx, bool mark_used=false) const;
01250
01251
01252
01253 int getConnectedInputIndex(int startAt = -1) const;
01254
01255
01256 int getNthConnectedInput(int n) const;
01257
01258
01259
01260 virtual void getParallelInputs(OP_Context &context,
01261 OP_NodeList &nodes) const;
01262
01263
01264 virtual OP_ERROR setInput(unsigned idx, OP_Node *op,
01265 unsigned outputIdx = 0);
01266
01267
01268 virtual OP_ERROR setIndirectInput(unsigned idx,
01269 OP_InputIndirect *input);
01270
01271
01272 virtual OP_ERROR setInputReference(unsigned idx, const char *label,
01273 int keeppos, unsigned outputIdx = 0);
01274
01275
01276
01277 int whichInputIs(const OP_Node *who) const;
01278
01279
01280 int whichInputIs(const OP_InputIndirect *who) const;
01281
01282
01283 int whichInputIs(const OP_InputIndirect *whoi, int cnt) const;
01284
01285
01286
01287
01288 int whichOutputIs(OP_Node* target_node, int input_on_target_node);
01289
01290
01291
01292
01293 int whichInputIs(OP_Node* source_node, int counter);
01294
01295
01296 void consolidateInputs();
01297 virtual void clearUnreferencedInputs();
01298 virtual OP_Input *getInputReference(unsigned idx, int grow=1);
01299 virtual OP_Input *getInputReferenceConst(unsigned idx) const;
01300 virtual int doDeleteRewire() const { return 1; }
01301
01302
01303
01304 virtual void moveInput(int srcidx, int dstidx,
01305 bool forcesubnet = false);
01306 OP_ERROR insertInput(unsigned idx, OP_Node *op,
01307 unsigned outputIdx);
01308 OP_ERROR insertIndirectInput(unsigned idx,
01309 OP_InputIndirect *input);
01310
01311 DEP_MicroNode & dataMicroNode()
01312 { return myDataMicroNode; }
01313 DEP_MicroNode & flagMicroNode()
01314 { return myFlagMicroNode; }
01315 DEP_MicroNode & parmMicroNode(int parm_idx, int vi)
01316 { return getParmList()->parmMicroNode(
01317 parm_idx, vi); }
01318
01319
01320
01321
01322 virtual void getOwnedMicroNodes(
01323 DEP_MicroNodeList µnodes);
01324
01325
01326
01327 void propagateDirtyMicroNode(
01328 DEP_MicroNode µnode,
01329 OP_EventType reason,
01330 void *data,
01331 bool send_root_event);
01332
01333
01334
01335
01336 virtual void addExtraInput(OP_Node *op, OP_InterestType type)
01337 { addExtraInput(OP_InterestRef(*op, type)); }
01338
01339
01340
01341 void addExtraInput(OP_Node &op, int parm_i, int vec_i)
01342 { addExtraInput(OP_InterestRef(op,parm_i,vec_i)); }
01343
01344
01345
01346 void addExtraInput(const OP_InterestRef &source_ref);
01347
01348
01349
01350 void addExtraInput(DEP_MicroNode &source_micronode);
01351
01352 static DEP_MicroNode *getEvalChannelMicroNode(int thread);
01353
01354
01355
01356
01357 static void addExtraInputToEvalChannel(
01358 int thread,
01359 OP_Node &op, OP_InterestType type)
01360 {
01361 addExtraInputToEvalChannel(
01362 thread,
01363 OP_InterestRef(op, type));
01364 }
01365 static void addExtraInputToEvalChannel(
01366 int thread,
01367 OP_Node &op, int parm_i, int vec_i)
01368 {
01369 addExtraInputToEvalChannel(
01370 thread,
01371 OP_InterestRef(op,parm_i,vec_i));
01372 }
01373 static void addExtraInputToEvalChannel(
01374 int thread,
01375 const OP_InterestRef &source_ref)
01376 {
01377 DEP_MicroNode *target = getEvalChannelMicroNode(thread);
01378 if (target)
01379 OP_Node::addExtraInput(*target, source_ref);
01380 }
01381 static void addExtraInputToEvalChannel(
01382 int thread,
01383 DEP_MicroNode &src_micronode)
01384 {
01385 DEP_MicroNode *target = getEvalChannelMicroNode(thread);
01386 if (target)
01387 target->addExplicitInput(src_micronode);
01388 }
01389
01390
01391
01392
01393
01394
01395 static void addExtraInput(
01396 const OP_InterestRef &target_ref,
01397 const OP_InterestRef &source_ref);
01398 static void addExtraInput(
01399 const OP_InterestRef &target_ref,
01400 DEP_MicroNode &source_micronode);
01401 static void addExtraInput(
01402 DEP_MicroNode &target_micronode,
01403 const OP_InterestRef &source_ref);
01404
01405
01406 void getExtraInputNodes(
01407 OP_NodeList &extras,
01408 bool remove_duplicates = true,
01409 bool data_interest = true,
01410 bool parm_interest = true,
01411 bool flag_interest = true) const;
01412 void getExtraOutputNodes(
01413 OP_NodeList &extras,
01414 bool remove_duplicates = true,
01415 bool data_interest = true,
01416 bool parm_interest = true,
01417 bool flag_interest = true) const;
01418
01419 int getNumExtraInputs() const;
01420
01421 void dumpExtraInputs(
01422 std::ostream &os,
01423 bool as_DOT,
01424 int indent_level = 0) const;
01425
01426
01427
01428 static void addExprOpDependency(const char *arg_str,
01429 const PRM_RefId &ref_id,
01430 OP_InterestType interest_type);
01431 static void addExprOpDependency1From2(const char *arg_str1,
01432 const char *arg_str2,
01433 const PRM_RefId &ref_id,
01434 OP_InterestType interest_type);
01435 static void addExprOpParmDependency(const char *arg_str,
01436 const PRM_RefId &ref_id,
01437 OP_InterestType interest_type);
01438
01439 static void changeExprOpRef(const char *arg_str,
01440 char *&new_arg,
01441 const char *new_fullpath,
01442 const char *old_fullpath,
01443 const char *old_cwd);
01444
01445 static void changeExprOpRef1From2(const char *arg_str1,
01446 const char *arg_str2,
01447 char *&new_arg1,
01448 char *&new_arg2,
01449 const char *new_fullpath,
01450 const char *old_fullpath,
01451 const char *old_cwd);
01452
01453 static void changeExprOpParmRef(const char *arg_str,
01454 char *&new_arg,
01455 const char *new_fullpath,
01456 const char *old_fullpath,
01457 const char *old_cwd,
01458 const char *chan_name,
01459 const char *old_chan_name);
01460
01461 void addGenericOpNameReference( const UT_String &oppath );
01462 void addGenericOpNameReference( const PRM_RefId &ref_id,
01463 OP_Node *node );
01464
01465 static void moveAndUpdateDependencies(
01466 const OP_NodeList &src_nodes,
01467 const OP_NodeList &dest_nodes );
01468
01469 static void updateChannelPtrs( CH_CollectionList &parents );
01470
01471
01472
01473
01474 virtual void rebuildParmDependency( int parm_index );
01475
01476
01477 virtual void clearParmDependency( int parm_index );
01478
01479 void decrementOpReference(int node_id);
01480
01481 virtual void dumpDependencies();
01482 void dumpOpDependents(OP_Node *ref, int brief, ostream &os);
01483 int countReferences(int op_id);
01484
01485 void getExistingOpReferences(OP_NodeList &refs,
01486 bool recurse);
01487
01488 void getExistingOpDependents(OP_NodeList &deps,
01489 bool recurse);
01490 const OP_DependencyList &getOpDependents() const { return myOpDependents; }
01491
01492
01493 void getParmsThatReference(const char *channame,
01494 UT_PtrArray<PRM_Parm *> &parms,
01495 UT_IntArray &parmsubidxs);
01496
01497 virtual void inputConnectChanged(int which);
01498
01499
01500
01501
01502 unsigned nOutputs(int outputIdx = -1) const;
01503
01504
01505 unsigned nOutputEntries() const;
01506
01507 OP_Node *getOutput(unsigned idx, int outputIdx = -1);
01508
01509 const OP_Node *getOutput(unsigned idx, int outputIdx = -1) const;
01510
01511
01512
01513 void getNonSubnetOutputs( OP_NodeList &nodes ) const;
01514
01515
01516
01517 OP_Node *getOutputTowardsNode( const OP_Node *target );
01518
01519
01520
01521
01522 void fillInfoTree(UT_InfoTree &tree, fpreal time);
01523
01524
01525
01526
01527 virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree,fpreal time);
01528
01529
01530
01531
01532
01533
01534 virtual const char *getDefaultSelectedInfoTreeBranchName() const;
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550 virtual OP_ERROR lockInput(unsigned idx, OP_Context &context);
01551 virtual void unlockInput(unsigned idx);
01552 virtual OP_ERROR lockInputs(OP_Context &context);
01553 virtual void unlockInputs(void);
01554
01555
01556
01557
01558 int getCookCount(void) const { return myCookCount; }
01559 void triggerOutputChanged();
01560 void triggerUIChanged();
01561
01562
01563 virtual int cookedInputIndex() const { return -1; }
01564
01565 bool setMinimumCacheSize(int min_size);
01566
01567 OP_VERSION getVersionParms() const
01568 { return myDataMicroNode.modVersion(); }
01569
01570
01571
01572 virtual bool handleTimeChange(fpreal ) { return false; }
01573
01574
01575
01576 bool isTimeDependent(OP_Context &context);
01577
01578 static int getGlobbedNodes(OP_Node *cwd, UT_String &holder,
01579 const char *pattern, UT_WorkArgs &argv,
01580 OP_GlobContext *context);
01581
01582 static int getGlobbedNetworkBoxes(OP_Node *cwd, UT_String &holder,
01583 const char *pattern, UT_WorkArgs &argv,
01584 OP_GlobContext *context);
01585
01586 static int getGlobbedPostIts(OP_Node *cwd, UT_String &holder,
01587 const char *pattern, UT_WorkArgs &argv,
01588 OP_GlobContext *context);
01589
01590
01591
01592
01593
01594 virtual bool runCreateScript();
01595
01596
01597 void updateParmsToMatchCurrentUnits();
01598
01599
01600
01601 virtual void matchOTLDefinition();
01602
01603
01604 virtual void unmatchOTLDefinition();
01605
01606
01607
01608 const UT_String &getSyncErrors() const
01609 { return mySyncErrors; }
01610
01611 OP_ERROR getSyncErrorLevel() const
01612 { return mySyncErrorLevel; }
01613
01614
01615 int getMatchesOTLDefinition() const;
01616
01617
01618 static void propagateMatchOTLDefinitionToAncestors(OP_Node *node,
01619 bool sync_flag);
01620
01621
01622
01623 int getCanDeviateFromOTLDefinition() const;
01624 void setAllChildAssetPermissions(int permission);
01625
01626
01627 bool getIsEditableAssetSubNode() const;
01628
01629
01630 void turnOffAllChildExports(void);
01631
01632
01633 bool haveLicenseToAccessContents(OP_Node* opt_specific_child = NULL) const;
01634 bool haveLicenseToAccessParentContents() const;
01635 bool haveAncestorWithoutFullLicense(bool ignore_self) const;
01636 OP_OTLLicenseType getLicense() const;
01637
01638 OP_Node *getFirstExecLicenseOnlyAncestor(
01639 bool ignore_self = true) const;
01640
01641 OP_Node *getLastExecLicenseOnlyAncestor(
01642 bool ignore_self = true) const;
01643
01644 bool haveCompiledExpressions() const;
01645 bool isCompiled() const;
01646
01647
01648 void saveWires(ostream &os, const char *name,
01649 int dogeneral = 0);
01650 void saveOutputWires(ostream &os, const char *name,
01651 int dogeneral = 0);
01652 virtual void saveIntrinsicCommand(ostream &os, const char *name);
01653
01654
01655 virtual OP_ERROR saveCommand(ostream &os,
01656 const char *name,
01657 fpreal x,
01658 fpreal y,
01659 const char *netboxname,
01660 const OP_SaveCommandOptions &options);
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676 void saveParameterFlags(ostream &os, const char *name,
01677 const char *command,
01678 bool (PRM_Parm::*flag_method)(int) const,
01679 bool defaultstoo, bool reverse,
01680 UT_RefArray<opParmData> *parm_array);
01681
01682 void saveUserDataCommand(
01683 ostream &os, const char *node_name,
01684 bool omit_version = false);
01685
01686 enum RampError
01687 {
01688 RAMP_ERR_SUCCESS,
01689 RAMP_ERR_NOT_FOUND,
01690 RAMP_ERR_FIRST_OR_LAST_KEY
01691 };
01692 virtual RampError rampCommand(bool remove, fpreal pos, float rgba[4]);
01693 RampError rampCommand(bool remove, fpreal pos, float rgba[4],
01694 UT_Ramp &ramp);
01695
01696 virtual bool loadRamp(UT_IStream &is, const char *path=0);
01697
01698 bool loadRamp(UT_IStream &is, UT_Ramp &ramp,
01699 const char *path=0);
01700 OP_ERROR saveRamp(ostream &os, UT_Ramp &ramp,
01701 const char *name = 0, int command = 0);
01702
01703 bool getUserData(const char *key, std::string &result);
01704 void setUserData(const char *key, const std::string &data);
01705 bool hasUserData(const char *key);
01706 bool deleteUserData(const char *key);
01707 const UT_Options &userData() const { return myUserData; }
01708 bool loadUserData(UT_IStream &is, const char *path=NULL);
01709 OP_ERROR saveUserData(ostream &os, const char *path);
01710
01711
01712
01713 PY_OpaqueObject *getCachedPythonObject(const char *key) const;
01714
01715
01716 void setCachedPythonObject(
01717 const char *key, void *opaque_py_object);
01718
01719 bool deleteCachedPythonObject(const char *key);
01720
01721
01722 const UT_SymbolTable &cachedPythonObjects() const
01723 { return myCachedPythonObjects; }
01724
01725 bool loadExtraInputs(UT_IStream &is, const char *path=0);
01726
01727 void saveOverrides(ostream &os);
01728 void saveOverrides(ostream &os, OP_Node *root,
01729 const UT_String &rootpath,
01730 bool &added);
01731 void saveChildOverrides(ostream &os, OP_Node *root,
01732 const UT_String &rootpath,
01733 bool &added);
01734 bool loadOverride(UT_IStream &is);
01735 virtual UT_ErrorSeverity
01736 prmCookOverrides(fpreal t, int thread,
01737 const char *parm_name, int vec_idx);
01738 virtual bool isParmPendingOverride(const char *parm_name,
01739 int vec_idx) const;
01740 OP_ERROR cookOverrides(OP_Context &c);
01741
01742 virtual void removeOverrideDestination(OP_Node * ) {}
01743 virtual void removeOverrideDestination(OP_Node * ,
01744 int ) {}
01745
01746
01747 virtual void executeCommand(const char *command,
01748 ostream *out,
01749 ostream *err) const;
01750 virtual void pushAsPwdAndRunPython(
01751 PY_CompiledCode &compiled_code,
01752 PY_Result::Type desired_result_type,
01753 PY_Result &result,
01754 PY_EvaluationContext *context=NULL) const;
01755
01756 OP_ERROR executeHscriptScript(UT_String &script, fpreal now);
01757 OP_ERROR executePythonScript(UT_String &script, fpreal now);
01758
01759 void addPythonNodeError(const PY_Result &py_result);
01760
01761 void saveInputs(ostream &os, bool compile_basic);
01762 bool loadInputs(UT_IStream &is, const char *path=0);
01763 void saveNamedInputs(ostream &os, bool compile_basic);
01764 void saveNamedOutputs(ostream &os);
01765 bool loadNamedInputs(UT_IStream &is, const char *path=0);
01766 bool loadNamedOutputs(UT_IStream &is, const char *path=0);
01767
01768 void checkInputs();
01769
01770
01771
01772
01773 virtual void saveDialogScriptExtraInfo(ostream &os);
01774
01775
01776 virtual void createGalleryEntry(OP_GalleryEntry &entry);
01777
01778
01779
01780
01781
01782
01783
01784 void evalOpPathString(UT_String &val, int pi, int vi,
01785 fpreal t, int &op_id, fpreal &op_time,
01786 int expanded = 1);
01787 void evalOpPathString(UT_String &val, const char *pn,
01788 int &pi, int vi, fpreal t,
01789 int &op_id, fpreal &op_time, int expanded=1);
01790 static int findOpFramePair(const char *path, int &op_id,
01791 fpreal &frame);
01792
01793
01794 static void buildXformOrder(int trs, int xyz,
01795 UT_XformOrder &order);
01796
01797
01798 static UT_XformOrder::rstOrder getMainOrder( int trs );
01799
01800
01801 static int getMainOrderMenuIndex(UT_XformOrder::rstOrder order);
01802
01803 static UT_XformOrder::xyzOrder getRotOrder( int xyz );
01804
01805
01806 static int getRotOrderMenuIndex(UT_XformOrder::xyzOrder order);
01807
01808 static UT_Vector3R getXformPivot(int trs,
01809 fpreal tx, fpreal ty, fpreal tz,
01810 fpreal px, fpreal py, fpreal pz);
01811 static UT_Vector3R getPivotParmValue(int trs,
01812 fpreal tx, fpreal ty, fpreal tz,
01813 fpreal px, fpreal py, fpreal pz);
01814 static void buildXform(int trs, int xyz,
01815 float tx, float ty, float tz,
01816 float rx, float ry, float rz,
01817 float sx, float sy, float sz,
01818 float px, float py, float pz,
01819 UT_Matrix4 &mat);
01820 static void buildXform(int trs, int xyz,
01821 double tx, double ty, double tz,
01822 double rx, double ry, double rz,
01823 double sx, double sy, double sz,
01824 double px, double py, double pz,
01825 UT_DMatrix4 &mat);
01826 static void buildXform(int trs, int xyz,
01827 float tx, float ty, float tz,
01828 float rx, float ry, float rz,
01829 float sx, float sy, float sz,
01830 float s_xy, float s_xz, float s_yz,
01831 float px, float py, float pz,
01832 UT_Matrix4 &mat);
01833 static void buildXform(int trs, int xyz,
01834 double tx, double ty, double tz,
01835 double rx, double ry, double rz,
01836 double sx, double sy, double sz,
01837 double s_xy, double s_xz, double s_yz,
01838 double px, double py, double pz,
01839 UT_DMatrix4 &mat);
01840 static void buildXform(int trs,
01841 float tx, float ty, float rz,
01842 float sx, float sy, float px, float py,
01843 UT_Matrix3 &mat);
01844 static void buildXform(int trs,
01845 double tx, double ty, double rz,
01846 double sx, double sy, double px, double py,
01847 UT_DMatrix3 &mat);
01848 static void buildXform(int trs,
01849 float tx, float ty, float rz,
01850 float sx, float sy, float s_xy,
01851 float px, float py,
01852 UT_Matrix3 &mat);
01853 static void buildXform(int trs,
01854 double tx, double ty, double rz,
01855 double sx, double sy, double s_xy,
01856 double px, double py,
01857 UT_DMatrix3 &mat);
01858
01859 virtual int getTranslateParmIndex();
01860
01861
01862
01863 void resolveInputReferences();
01864
01865 static void clearAllPendingUndoFlags();
01866
01867 virtual void clearUndoFlags();
01868 virtual void setAnyUndoFlag();
01869 void saveForUndoInput();
01870
01871 void blockModify(int on_off, int propagate = 1);
01872 int isBlockModify(void) const;
01873 virtual void propagateEndBlockModify();
01874
01875
01876 virtual const CL_Clip *getClip(OP_Context *context = 0);
01877
01878
01879
01880 void getMotionEffectsNetworkPath(UT_String &path);
01881
01882
01883 const char *getCookDurationString() const;
01884
01885
01886 void getCookInfo(UT_String &info) const;
01887
01888
01889 virtual int getNetOverviewColor( UT_Color &color );
01890
01891
01892 virtual UT_Ramp *getRamp();
01893
01894 virtual int isCookingRender() const { return 0; }
01895 virtual void setCookingRender(int val);
01896
01897 virtual void clearInterrupted()
01898 { clearInterruptedImpl(true); }
01899 int wasInterrupted() const
01900 { return flags().getInterrupted(); }
01901
01902
01903
01904
01905 void setRenameConflict()
01906 { myRenameConflict = 1; }
01907 void setRunningCreateScript(int onoff);
01908
01909
01910 virtual int outputCode(OP_OutputCodeParms &, OP_Context &);
01911
01912 virtual fpreal getTimeTransform(int input, fpreal t);
01913 virtual void getInputRes(int input, fpreal t,
01914 const OP_Context &context,
01915 OP_Context &input_context);
01916
01917
01918 static void setIndentLevel(int numspaces);
01919 static void writeIndent(ostream &os, int indent);
01920 static void writeSpaces(ostream &os, int spaces);
01921 static void writeFileHeader(ostream &os, const char *filename,
01922 const char *prefix);
01923
01924 UT_TokenString & getHashCode(OP_Context &context, int group_mask =1);
01925 virtual UT_TokenString & getParmHashCode(OP_Context &context,
01926 int group_mask = 1);
01927
01928 virtual int getNumInputsToHash();
01929 virtual OP_Node *getInputToHash(int i);
01930
01931 void clearHashCodeFlags();
01932 bool isHashCodeBuilt() const { return myBuiltHashCode;}
01933 void builtHashCode(bool b = true) { myBuiltHashCode = b; }
01934 void buildInputHashCode(UT_TokenString &string,
01935 OP_Context &context,
01936 int group_mask,
01937 int level);
01938
01939
01940 void setCreatorState(const char *s)
01941 { myCreatorState.harden(s); }
01942 const UT_String &getCreatorState() const { return myCreatorState; }
01943 void builtExplicitly(int yn) { myBuiltExplicitly = yn; }
01944 int wasBuiltExplicitly() const{ return myBuiltExplicitly; }
01945
01946 bool matchesState(const char *state) const;
01947
01948
01949
01950 virtual void changeParmTemplate(PRM_Template *new_template);
01951
01952 void ensureInputsAndOutputsAreValid();
01953
01954
01955
01956 void connectToInputNode(OP_Node &inputnode, int input_idx,
01957 int branch_off=0);
01958
01959
01960 virtual int editCallback(CL_Track *track, fpreal t,
01961 fpreal newValue);
01962
01963
01964 static OP_EditCallback getEditCallback(void *&data);
01965 static void setEditCallback(OP_EditCallback func,
01966 void *data);
01967
01968
01969
01970
01971
01972 static void buildQuadricXform(UT_Matrix4 &mat,
01973 float tx, float ty, float tz,
01974 float sx, float sy, float sz,
01975 char axis = 'y');
01976
01977 static void buildQuadricXform(UT_DMatrix4 &mat,
01978 double tx, double ty, double tz,
01979 double sx, double sy, double sz,
01980 char axis = 'y');
01981
01982 static int buildOpMenu(OP_Network *net, PRM_Name *theMenu,
01983 int theMenuSize, int (*doAdd)(OP_Node *) = 0,
01984 int startItem = 0, const PRM_Parm *parm = 0,
01985 int showSubnets = 1, int expandSubnets = 1,
01986 bool recurse = false);
01987
01988
01989
01990
01991 static void buildPreDefRulesMenu(PRM_Name *menu,
01992 OP_PreDefRules &pdr);
01993
01994
01995
01996
01997
01998 virtual const CH_LocalVariable *resolveVariable(const char *name);
01999 virtual const CH_LocalVariable *resolveExtraVariableForSyntaxHighlight(
02000 const char *name);
02001
02002
02003 static int getNameSerialIndex();
02004
02005
02006 virtual void setMapping(int idx, int type, const char *label = 0);
02007 virtual int getMapping(int idx, const char *&label) const;
02008
02009
02010 virtual int acceptDragDrop(DD_Source &src, const char *label);
02011 virtual int testDragDrop(DD_Source &src);
02012 virtual void getDragDropChoice(DD_Source &src, DD_ChoiceList &c);
02013
02014
02015 bool hasComment() const;
02016 bool hasParmsNotAtFactoryDefault() const;
02017 bool hasAnimatedParms() const;
02018 bool hasChopOverriddenParms() const;
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034 bool traverseInputs(bool (*callback)(OP_Node &, void *),
02035 void *data,
02036 bool follow_subnets,
02037 bool follow_ref_inputs,
02038 bool follow_extra_inputs,
02039 OP_InterestType extra_interest_mask =
02040 OP_INTEREST_ALL);
02041 bool traverseInputs(bool (*callback)(const OP_Node &, void*),
02042 void *data,
02043 bool follow_subnets,
02044 bool follow_ref_inputs,
02045 bool follow_extra_inputs,
02046 OP_InterestType extra_interest_mask =
02047 OP_INTEREST_ALL) const;
02048
02049
02050
02051
02052 bool traverseChildren(bool (*callback)(OP_Node &, void*),
02053 void *data,
02054 bool recurse_into_subnets);
02055
02056
02057
02058 virtual bool usesFootprint() const { return false; }
02059
02060 void getExternalReferences(UT_StringArray &reflist,
02061 UT_StringArray *nodelist = 0,
02062 bool from_children_too = true,
02063 bool collapse = false,
02064 bool check_missing = false,
02065 bool show_missing_only = false);
02066 virtual bool getSaveWithVopnets();
02067 virtual void runDelScript();
02068
02069
02070 virtual void preDelete() { }
02071
02072
02073
02074 virtual DOP_Parent *castToDOPParent() { return 0; }
02075 virtual const DOP_Parent *castToDOPParent() const { return 0; }
02076
02077
02078
02079
02080 virtual VOP_CodeGenerator *getVopCodeGenerator() { return 0; }
02081
02082
02083
02084
02085
02086
02087
02088
02089 virtual int beginVopCodeGeneratorUpdate() { return 0; }
02090 virtual void endVopCodeGeneratorUpdate(int update_level) {}
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100 virtual bool getScriptMaterialInfo( UT_String & mat_info,
02101 VOP_ScriptMaterialCodeMapper * mapper )
02102 { return false; }
02103
02104
02105
02106
02107
02108 virtual const char *getOTLSubType() { return 0; }
02109
02110
02111
02112 bool setChannelAlias(PRM_Parm &parm, int subindex,
02113 const char *alias_name);
02114
02115 void disconnectAllInputsOutputs(bool keepSelected,
02116 bool forceDisconnectOutputs = false);
02117
02118 void disconnectAllInputs(void);
02119 void disconnectAllOutputs(void);
02120
02121
02122 virtual void notifyParmRenameDependents(
02123 const UT_String &chan_name,
02124 const UT_String &old_chan_name );
02125
02126 void writeChannel(CH_Channel *channel, ostream &os,
02127 const char *name, bool frames);
02128 void writeAllChannels(ostream &os, const char *name,
02129 bool frames, bool dochblock,
02130 bool dospareparms);
02131
02132
02133
02134
02135 virtual bool triggerParmCallback(PRM_Parm *parmptr, fpreal now,
02136 int value, void *data);
02137
02138 virtual int64 getMemUsage(UT_Bool onlythis) const;
02139 int64 getExtraInputMemUsage() const;
02140 static void printOpMemoryUsageStats(ostream &os);
02141
02142
02143
02144
02145
02146 virtual void unscopeChannels(bool recurse);
02147
02148
02149
02150
02151 virtual void setChannelScope(const char *pattern,
02152 OP_ScopeOp scope_op,
02153 const OP_ScopeOptions &scope_opts);
02154
02155
02156
02157 virtual const UT_String &getItemName() const { return getName(); }
02158
02159
02160 virtual bool changeSpareParms(UT_IStream &istream,
02161 UT_String &errors);
02162
02163
02164 virtual void spareParmRemoved(const char *parmname);
02165
02166
02167
02168 virtual PRM_ParmList *createObsoleteParmList();
02169 virtual void resolveAndDeleteObsoleteParmList(
02170 PRM_ParmList *&obsolete_parms);
02171
02172 void updateVersionUserData();
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182 void syncNodeVersionIfNeeded(
02183 bool *node_deleted,
02184 const char *from_version = NULL,
02185 bool update_node_version = false);
02186
02187
02188
02189
02190 virtual void syncNodeVersion(
02191 const char *old_version,
02192 const char *current_version,
02193 bool *node_deleted);
02194
02195
02196
02197
02198
02199
02200
02201 bool setGlobalFloatParam(const char *param,
02202 fpreal value,
02203 bool *warned);
02204 bool setGlobalStringParam(const char *param,
02205 const char *strvalue,
02206 bool *warned);
02207
02208
02209
02210 void beginPropagateModification();
02211 void endPropagateModification();
02212
02213
02214 virtual void getActiveOperatorsDefinedByOTL(
02215 UT_HashTable &active_operators) const;
02216
02217
02218
02219
02220
02221 static bool getDoingBulkNotification();
02222 static bool isDirectorDoingBulkNotification();
02223
02224
02225
02226
02227 virtual bool hasDifferentMultiInputs() const;
02228
02229
02230 virtual bool canCreateNewOpType() const;
02231 static bool createNewOpType
02232 (OP_Node *node,
02233 UT_String &errors,
02234 const char *typeName=NULL,
02235 const char *typeLabel=NULL,
02236 const char *otlFile=NULL,
02237 const char *metaSource=NULL,
02238 const char *comment=NULL,
02239 const char *version=NULL,
02240 const char *newName=NULL,
02241 int minimumInputs=-1,
02242 int maximumInputs=-1,
02243 bool ignore_external_references=false,
02244 bool compress_contents=false,
02245 bool force=false,
02246 int *newNodeId=NULL,
02247 bool compile_contents = false);
02248
02249
02250 virtual UT_String *getMaterialIconFilename() { return 0; }
02251 virtual void setMaterialIconFilename(const char * ) {}
02252 virtual IMG_Raster *getMaterialIconImage() { return 0; }
02253 virtual bool getMaterialIconAllowRegenerateFlag() { return true; }
02254 virtual void setMaterialIconAllowRegenerateFlag(bool) {}
02255
02256
02257
02258
02259
02260 static void setSmallMode();
02261
02262 static bool getSmallMode();
02263
02264
02265
02266
02267
02268
02269 static void startBulkNotifications(
02270 const OP_NodeList &changed,
02271 OP_Node *caller = NULL);
02272 static void endBulkNotifications(
02273 const OP_NodeList &changed);
02274
02275
02276 static void setNodeButtonWidthFlagMult(int new_mult);
02277
02278
02279
02280
02281
02282 virtual bool willAutoconvertInputType(int input_idx);
02283
02284 bool isDependentOn(OP_Node* other_node, PRM_Parm* parm);
02285
02286
02287
02288 void setExposeRecursive(bool expose, bool do_inputs, int level = 0);
02289
02290
02291
02292 virtual bool getIsVisible(int idx);
02293
02294
02295
02296 bool verifyTemplatesWithParameters() const;
02297
02298 OP_Input *getNamedInputReference(const OP_ConnectorId& input_name, bool grow = true);
02299 OP_Input *getNamedInputReferenceConst(const OP_ConnectorId& input_name) const;
02300 OP_Node *getNamedInput(const OP_ConnectorId& input_name, bool mark_used=false) const;
02301
02302
02303
02304 virtual int getInputFromName(const UT_String &in) const;
02305 virtual int getOutputFromName(const UT_String &out) const;
02306 virtual void getInputName(UT_String &in, int idx) const;
02307 virtual void getOutputName(UT_String &out, int idx) const;
02308
02309 int getInputFromUniqueName(const OP_ConnectorId& id) const;
02310 int getOutputFromUniqueName(const OP_ConnectorId& id) const;
02311 void getUniqueInputName(OP_ConnectorId& id_out, int idx, bool disable_creation = false);
02312 void getUniqueOutputName(OP_ConnectorId& id_out, int idx);
02313
02314
02315 OP_Node *getNamedOutput(unsigned idx, const OP_ConnectorId* output_name = NULL);
02316
02317 const OP_Node *getNamedOutput(unsigned idx, const OP_ConnectorId* output_name = NULL) const;
02318
02319
02320 virtual OP_ERROR setNamedInput(const OP_ConnectorId& input_name, OP_Node *op,
02321 const OP_ConnectorId* output_name = NULL);
02322
02323 virtual OP_ERROR setNamedIndirectInput(const OP_ConnectorId& input_name,
02324 OP_InputIndirect *input);
02325 virtual OP_ERROR setNamedInputReference(const OP_ConnectorId& input_name,
02326 const char *label, int, const OP_ConnectorId* output_name = NULL);
02327
02328 OP_ERROR insertNamedInput(const OP_ConnectorId& input_name, OP_Node *op,
02329 const OP_ConnectorId* output_name);
02330 OP_ERROR insertNamedIndirectInput(const OP_ConnectorId& input_name,
02331 OP_InputIndirect *input);
02332
02333
02334
02335 virtual void onCreated(void) { }
02336
02337 virtual bool isOrderedInput(const OP_ConnectorId& input_name) const;
02338
02339
02340
02341 OP_ConnectorId whichNamedInputIs(const OP_Node *who) const;
02342
02343
02344 OP_ConnectorId whichNamedInputIs(const OP_InputIndirect *who) const;
02345 virtual bool willAutoconvertNamedInputType(const OP_ConnectorId& input_name);
02346
02347
02348
02349 TInputsIterator traverseInputs(TInputsIterator* prev_iter);
02350 TInputsIterator traverseConnectedInputs(TInputsIterator* prev_iter);
02351 TInputsIterator getTraverseEndIterator(void);
02352
02353
02354
02355 void gatherInputs(TInputPairs& input_pairs_out);
02356 void gatherOutputs(TOutputPairs& output_pairs_out);
02357
02358 virtual void getAuxInputName(OP_ConnectorId& name_out);
02359 unsigned nOutputsNamed(const OP_ConnectorId* output_name = NULL) const;
02360
02361 unsigned getInputsArraySize() { return myInputs.entries(); }
02362
02363
02364 void getLocalVarNames(UT_StringArray &out_vars);
02365
02366 void recomputeCompiledHash();
02367
02368 protected:
02369
02370 virtual void doGetFullPath(UT_WorkBuffer &str) const;
02371
02372
02373
02374 virtual void buildLocalVarNames(UT_StringArray &out_vars);
02375
02376
02377
02378 void finishedLoadingParentNetwork(void);
02379
02380 OP_Node(OP_Network *parent, const char *name, OP_Operator *entry);
02381 virtual ~OP_Node();
02382
02383 void setNewParent( OP_Network *new_parent );
02384
02385 static void bumpNameSerialIndex();
02386
02387 void setLegacyConnectingInputIndex(int index)
02388 { myLegacyConnectingInputIndex = index; }
02389
02390
02391
02392 virtual void clearAndDestroy(void);
02393
02394
02395 virtual void clearCache();
02396
02397 void clearInterruptedImpl(bool allow_recook);
02398
02399
02400
02401
02402
02403
02404
02405 virtual OP_ERROR cookMe(OP_Context &context) = 0;
02406
02407
02408
02409
02410
02411 virtual OP_ERROR bypassMe(OP_Context &context, int &copied_input) = 0;
02412
02413
02414
02415
02416 virtual void doOverridePreCook() { }
02417 virtual void doOverridePostCook() { }
02418
02419
02420
02421
02422 int getSourceCount(void) const;
02423 virtual int bumpSourceCount(int d);
02424
02425
02426
02427 virtual OP_ERROR cookInputGroups(OP_Context &context, int alone = 0);
02428
02429
02430
02431
02432
02433
02434 virtual int deleteNodeData(void *);
02435 virtual void *copyNodeData(void *);
02436
02437
02438 virtual OP_ERROR saveIntrinsic(ostream &os, const OP_SaveFlags &flags);
02439 virtual OP_ERROR save(ostream &os, const OP_SaveFlags &flags,
02440 const char *path_prefix = "");
02441
02442 bool loadIntrinsic(UT_IStream &is, const char *path=0);
02443 virtual bool loadPacket(UT_IStream &is, short class_id,
02444 short sig, const char *path=0);
02445 virtual bool loadPacket(UT_IStream &is, const char *token,
02446 const char *path=0);
02447 virtual bool load(UT_IStream &is, const char *ext="",
02448 const char *path=0);
02449
02450
02451 virtual void loadStart();
02452 virtual void loadFinished();
02453
02454
02455
02456 void loadContentsSection();
02457
02458
02459
02460 virtual bool syncContents(UT_IStream &is);
02461
02462
02463 void setMatchesOTLDefinition(int matches);
02464
02465 virtual const char *getFileExtension(int binary) const = 0;
02466 virtual const char *getDataFileExtension(int binary) const;
02467
02468
02469
02470 const char *inputLabelNum(unsigned idx) const;
02471 const char *outputLabelNum(unsigned idx) const;
02472
02473
02474
02475 virtual void checkTimeDependencies( int do_parms=1,
02476 int do_inputs=1,
02477 int do_extras=1 );
02478 unsigned isInput(unsigned idx)
02479 { return idx < myInputs.entries(); }
02480
02481
02482 void sendEvent(OP_EventType type, void *data=0);
02483
02484
02485
02486 int haveSeenDataModification(long modification_id);
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496 virtual int propagateModification(OP_Node *by_whom,
02497 OP_EventType reason,
02498 int parm_index,
02499 OP_PropagateData &prop_data);
02500
02501
02502
02503 OP_Cache * getCookCache() { return &myCache; }
02504
02505
02506 static void deleteDataCallback(void *, void *);
02507 static void *copyDataCallback(void *, void *);
02508
02509 static void cmd_locate(CMD_Args &);
02510
02511 virtual void saveFlagsForUndo();
02512 void saveForUndoLayout();
02513 void saveForUndoColor();
02514
02515 static void saveForUndoDelete(OP_NodeList &nodes);
02516
02517
02518 void clearDependency();
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531 bool dirtyForTimeChange(fpreal t)
02532 {
02533 if (isCookedTime(t))
02534 return false;
02535
02536 myDataMicroNode.setDirty(true);
02537 return true;
02538 }
02539
02540
02541
02542 virtual void cloneFromProxyRefNode( OP_Network *proxy );
02543
02544 virtual OP_Network * cloneToProxyRefNode();
02545 void stealDependents( OP_Node *other );
02546
02547 bool hasOpDependents()
02548 { return !myOpDependents.isEmpty(); }
02549 virtual int hasProxyRefNodes() const
02550 { return 0; }
02551 virtual void moveProxyRefNodes( OP_Network * ) { }
02552 void clearOpReferences();
02553 virtual void rebuildOpDependents( bool proxy_only );
02554
02555
02556 virtual int removeOpDependent(
02557 int op_id, const PRM_RefId &ref_id,
02558 OP_InterestType mask = OP_INTEREST_ALL );
02559 virtual int removeOpDependent(
02560 int op_id, OP_InterestType mask = OP_INTEREST_ALL );
02561
02562
02563
02564
02565
02566 virtual void buildOpDependencies();
02567 virtual void checkChannelDependencies( CH_Channel *ch,
02568 CH_CHANGE_TYPE reason );
02569
02570 void notifyOpDependents( OP_InterestType interest,
02571 bool recurse );
02572 virtual void moveDependencies( OP_Node *from_node );
02573
02574
02575
02576
02577
02578 void notifyRenameDependents( const UT_String &full_from );
02579 virtual void notifyRenameDependents( const UT_String &full_from,
02580 OP_NodeList &cook_nodes );
02581
02582
02583
02584
02585
02586 void notifyRenameReferences( const UT_String &full_from );
02587 virtual void notifyRenameReferences( const UT_String &full_from,
02588 OP_NodeList &cook_nodes );
02589
02590
02591 virtual void handleOpDependency( int referenced_op_id,
02592 const OP_Dependency &op_dep,
02593 OP_InterestType interest_type,
02594 bool &need_cook,
02595 const char *old_fullpath,
02596 const char *old_cwd,
02597 const char *old_chan_name );
02598 virtual void buildParmDependency( int parm_index );
02599
02600 void addOpNameReference(
02601 const PRM_RefId &ref_id, const UT_String &op_path,
02602 OP_InterestType type );
02603
02604 void addChannelNameReference(
02605 const PRM_RefId &ref_id, const UT_String &op_path,
02606 const UT_String &chan_name, OP_InterestType type );
02607
02608 OP_Node *getNodeOrCreateProxy(const UT_String &op_path);
02609
02610 void addOpReference( const PRM_RefId &ref_id, OP_Node *node,
02611 const PRM_RefId &source_ref_id,
02612 OP_InterestType type );
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628 bool changeOpPathRef( UT_String &value_str,
02629 const char *new_fullpath,
02630 const char *old_fullpath,
02631 const char *old_cwd,
02632 const char *new_cwd );
02633
02634
02635
02636 static bool getStringParmOpPath(
02637 PRM_Parm &parm, int vi, UT_String &oppath,
02638 int thread );
02639 void handleStringParmOpPathDependency(
02640 int parm_index, int vi,
02641 const char *new_fullpath,
02642 const char *old_fullpath, const char *old_cwd );
02643
02644
02645 void notifyNodeDeletion();
02646
02647
02648
02649 virtual void nodeDeleted(OP_Node *op, int propagate=1);
02650
02651 void startCookTimer(const OP_Context &context);
02652 void stopCookTimer(const OP_Context &context);
02653
02654 virtual const char *getCookTimerLabel(const OP_Context &context) const;
02655
02656
02657 virtual void permissionError(const char *chname = 0);
02658
02659
02660 void addInputError(unsigned input_idx);
02661
02662
02663
02664
02665
02666 virtual bool isInputConnectedInsideSubnet(int input_idx) const;
02667 virtual bool isNamedInputConnectedInsideSubnet(const OP_ConnectorId& input_name) const;
02668
02669
02670 virtual void nodeUnlocked() { ; }
02671
02672
02673 virtual void setUniqueId(int id);
02674 void changeOpDependentUniqueId( int old_id, int new_id );
02675 void changeOpReferenceUniqueId( int old_id, int new_id );
02676 virtual void clearUniqueId();
02677
02678 void setAllowBuildDependencies( int yesno )
02679 { myAllowBuildDependencies = yesno; }
02680 int allowBuildDependencies() const
02681 { return myAllowBuildDependencies; }
02682
02683
02684
02685 void evaluateAllParms(fpreal t);
02686
02687
02688
02689
02690 virtual void getMyExternalReferences(UT_StringArray &reflist,
02691 UT_StringArray *nodelist =0,
02692 bool collapse = false,
02693 bool check_missing = false,
02694 bool show_missing_only=false);
02695
02696 void getExternalFiles(UT_StringArray &files,
02697 const char *stringparm,
02698 int framestart, int frameend,
02699 bool collapse,
02700 bool check_missing,
02701 bool show_only_missing,
02702 UT_KnownPath path);
02703
02704
02705 virtual bool canDestroyNode();
02706
02707
02708
02709
02710
02711
02712 static bool canDestroyNodes(OP_Network *src_net,
02713 OP_NodeList *nodes);
02714
02715
02716
02717
02718
02719 virtual bool cookedDataUsesAllParameters() const
02720 { return false; }
02721
02722
02723 virtual bool cookedDataNeedsErrors() const
02724 { return false; }
02725
02726
02727
02728 bool getIsRunningInCreateScript() const;
02729
02730
02731
02732
02733
02734 virtual void refreshRepresentativeNode(OP_Node &changed_child);
02735
02736
02737
02738 void convertOpdefToAbsolutePath(UT_String &str) const;
02739
02740 bool isCookedTime(fpreal t) const
02741 {
02742 return myDataMicroNode.isEqualToLastUpdateTime(t);
02743 }
02744
02745
02746
02747 virtual void dumpMicroNodes(
02748 std::ostream &os,
02749 bool as_DOT,
02750 int indent_level) const;
02751
02752
02753 UT_TokenString myHashCode;
02754 UT_TokenString myParmHashCode;
02755 int myLastGroupMask;
02756 OP_VERSION myHashVersion;
02757 fpreal myHashTime;
02758 int myParmLastGroupMask;
02759 OP_VERSION myParmHashVersion;
02760 fpreal myParmHashTime;
02761 UT_String mySyncErrors;
02762 OP_ERROR mySyncErrorLevel;
02763 int mySyncDepth;
02764
02765
02766
02767
02768
02769
02770
02771 static fpreal getFlagWidth();
02772
02773
02774 static fpreal getNodeHeight();
02775
02776
02777
02778 static fpreal getNodeButtonWidth();
02779
02780
02781
02782 static fpreal getConnectorHeight();
02783
02784 static bool theSmallMode;
02785
02786
02787
02788 void deleteInput(int idx);
02789 void deleteInput(const OP_ConnectorId& input_name);
02790
02791
02792 void updateErrorSeverity();
02793
02794
02795 virtual void onInputAllocated(OP_Input* new_input, int index) { }
02796
02797
02798 void checkConnectorsConsistency(void);
02799
02800
02801
02802 void renameInput(OP_Input* input, int new_id);
02803 void renameOutput(OP_Output* output, int new_id);
02804
02805
02806 uint32 myCompHash;
02807
02808 private:
02809 #ifdef INTEL_COMPILER
02810 OP_Node(const OP_Node& );
02811 #endif
02812
02813 bool doDebugConsistencyCheck();
02814 void createCollection( OP_Operator *entry );
02815
02816
02817
02818 OP_ERROR saveIntrinsicError();
02819 OP_ERROR saveError();
02820 OP_ERROR saveGroupMemberships(ostream &os,
02821 const OP_SaveFlags &flags,
02822 const char *path_prefix);
02823 bool loadGroupMemberships(UT_IStream &is,const char*path=0);
02824
02825
02826 OP_ERROR saveNetworkBox(ostream &os,
02827 const OP_SaveFlags &flags,
02828 const char *path_prefix);
02829
02830
02831 bool loadNetworkBox(UT_IStream &is, const char *path=0);
02832
02833 bool loadNodeFlags(UT_IStream &is, const char *path);
02834
02835 void saveForUndoComment();
02836 void saveForUndoDelScript();
02837
02838 UT_BitArray &getGroups() { return myGroups; }
02839 const UT_BitArray &getGroups() const { return myGroups; }
02840
02841 bool setOutput(OP_Node *node, int outputIdx);
02842 bool delOutput(OP_Node *node, int outputIdx);
02843 bool setNamedOutput(OP_Node *node, const OP_ConnectorId& output_name);
02844 bool delNamedOutput(OP_Node *node, const OP_ConnectorId& output_name);
02845
02846
02847 void setInterrupted();
02848
02849 int findAncestor(const OP_Node *node) const;
02850 int findDataAncestor(const OP_Node *node) const;
02851 void clearRecursionBit() const;
02852
02853 void initializeExpressions() const;
02854 void clearInputs();
02855 void clearOutputs();
02856
02857 virtual PRM_ParmMicroNode
02858 *createParmMicroNodes(PRM_Parm &parm) const;
02859
02860 static bool getMicroNodesFromRef(
02861 const OP_InterestRef &ref,
02862 DEP_MicroNodeList µnodes);
02863
02864
02865
02866
02867 void removeOpReference(
02868 const PRM_RefId &ref_id,
02869 OP_InterestType mask = OP_INTEREST_ALL );
02870 void removeOpReference(
02871 const PRM_RefId &ref_id,
02872 int op_id,
02873 OP_InterestType mask = OP_INTEREST_ALL );
02874
02875 int addOpDependent( int op_id,
02876 const PRM_RefId &source_ref,
02877 const PRM_RefId &ref_id,
02878 OP_InterestType type );
02879
02880 void updateRenameDependent( OP_Node *dependent,
02881 const char *old_cwd,
02882 OP_NodeList &cook_nodes );
02883
02884 void buildScriptOpDependencies();
02885 void changeScriptOpRef( const char *new_fullpath,
02886 const char *old_path,
02887 const char *old_cwd );
02888 static void changeScriptCB( UT_String &str,
02889 const char *token_start,
02890 const char *&ch, void *userdata );
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905 bool findTimeInterests(OP_Context &context, OP_Node *node,
02906 bool update_cook,
02907 OP_NodeCycleDetect &cycle,
02908 OP_NodeList *interests = NULL);
02909
02910
02911 bool attemptPrefixMatch(const OP_NetworkBoxItem *item,
02912 char *childpref, int childpreflen,
02913 UT_String &maxprefix) const;
02914
02915
02916 void findUsedDataInterests(OP_NodeList &nodes, OP_Node *op);
02917
02918
02919
02920 bool internalSetGlobalParam(const char *param,
02921 int setreturned,
02922 bool *warned);
02923
02924 int internalSetPicked(int on_off,
02925 bool propagate_parent_event,
02926 bool edit);
02927
02928 OP_ERROR internalCookInput(OP_Context &context, int input_idx,
02929 OP_Node &input_node);
02930
02931 virtual void removeInputFromMapping(int idx);
02932 void removeOutputFromMapping(int idx);
02933
02934
02935
02936 void skipUntilClosingBrace(UT_IStream &is);
02937
02938
02939 void resolveUnresolvedLoadedInputs(void);
02940
02941 void generateConnectorUniqueId(OP_ConnectorId& id_out);
02942 OP_Output* getOrCreateOutput(int array_index, bool create, int id_to_use);
02943
02944 uint32 computeCompiledHash() const;
02945
02946 private:
02947 OP_Cache myCache;
02948
02949 OP_ERROR myLastErrorSeverity;
02950 OP_Network *myParent;
02951 OP_Network *myRootCompiledParent;
02952 UT_PtrArray<OP_Input *> myInputs;
02953
02954 TStringInputMap myInputsMap;
02955 mutable UT_BitArray myUsedInputs;
02956 UT_PtrArray<OP_Output *> myOutputs;
02957
02958 TStringOutputMap myOutputsMap;
02959
02960 OP_DataMicroNode myDataMicroNode;
02961 DEP_MicroNode myFlagMicroNode;
02962
02963 UT_String myComment;
02964 UT_String myDelScript;
02965 UT_String myCreatorState;
02966 UT_Color myColor;
02967 UT_BitArray myGroups;
02968 OP_Value myEventValue;
02969 fpreal myPosX;
02970 fpreal myPosY;
02971 long myCookCount;
02972 SYS_AtomicInt32 mySourceCount;
02973 int myBlockModify;
02974 int myUniqueId;
02975 int myConnectorNextId;
02976 int myNextIdOverride;
02977 unsigned myActiveInputIndex;
02978
02979
02980 int myLegacyConnectingInputIndex;
02981
02982 bool myAutoscope;
02983
02984 fpreal myCookDuration;
02985 unsigned int myRenameConflict : 1,
02986 myCookedForRender : 1,
02987 myModifyWaiting : 1,
02988 myBuiltExplicitly : 1,
02989 myAllowBuildDependencies : 1,
02990 myBeingDeleted : 1,
02991 myRunningCreateScript : 1,
02992 myRunningDelScript : 1,
02993 myAlreadyRunDelScript : 1,
02994 myMatchesOTLDefinition : 1,
02995 myLoadCookedDataError : 1,
02996 myBuiltHashCode : 1,
02997 myIsProxyRefNode : 1,
02998 myConnectionsChanging : 1;
02999
03000 mutable bool myStartedTraverseInputs;
03001 mutable bool myRecursionFlag;
03002
03003
03004 static long theModificationCounter;
03005
03006 static int thePropagateLevel;
03007
03008
03009 OP_ReferenceList myOpReferences;
03010
03011 OP_DependencyList myOpDependents;
03012
03013
03014 OP_BundleReferences myBundleRefs;
03015
03016
03017 mutable OP_CookLock myCookLock;
03018 OP_TaskState myTaskState;
03019
03020
03021
03022 UT_Options myUserData;
03023
03024
03025
03026 UT_SymbolTable myCachedPythonObjects;
03027
03028
03029
03030
03031 TUnresolvedInputs *myUnresolvedInputs;
03032
03033
03034
03035
03036 bool myLoadedNamedInputs;
03037
03038
03039
03040 mutable OP_CompileStatusType myCachedCompileStatus;
03041
03042 static bool *theCheckConnectionConsistency;
03043
03044 static int myNumSpaces;
03045
03046 static int myNodeButtonWidthFlagMult;
03047
03048
03049 static OP_EditCallback theEditCallback;
03050 static void *theEditCallbackData;
03051
03052
03053 static int makeUniqueId(OP_Node *node);
03054
03055 static int theUniqueId;
03056 static int theUniqueSize;
03057 static OP_Node **theUniqueNodes;
03058 static bool theDoingBulkNotification;
03059 static OP_Node *theBulkNotificationCaller;
03060
03061 friend class OP_Network;
03062 friend class OP_Group;
03063 friend class OP_DataMicroNode;
03064 friend class OP_ParmMicroNode;
03065 friend class OP_Input;
03066 friend class OP_InputIndirect;
03067 friend class OP_UndoDelete;
03068 friend class OP_UndoInput;
03069 friend class OP_UndoCreate;
03070 friend class OP_UndoSpareParm;
03071
03072 friend class op_MicroNodeDirtied;
03073 };
03074
03075
03076
03077 OP_API OP_Node * OPgetNodeFromChannel( const CH_Channel *chp );
03078
03079 #define CAST_INSTANTIATE(PREFIX) \
03080 inline static PREFIX##_Node *CAST_##PREFIX##NODE(OP_Node *op) \
03081 { \
03082 return ((op) ? (op)->castTo##PREFIX##Node() : 0); \
03083 } \
03084 \
03085 inline static const PREFIX##_Node *CAST_##PREFIX##NODE(const OP_Node *op) \
03086 { \
03087 return ((op) ? (op)->castTo##PREFIX##Node() : 0); \
03088 } \
03089
03090
03091
03092
03093
03094
03095 INSTANTIATE_FOR_ALL_NODE_TYPES(CAST_INSTANTIATE)
03096
03097
03098 #undef CAST_INSTANTIATE
03099
03100
03101 #undef INSTANTIATE_FINDNODE_FUNCTIONS
03102 #undef INSTANTIATE_CASTNODE_FUNCTIONS
03103 #undef INSTANTIATE_FOR_ALL_NODE_TYPES
03104
03105 #endif