00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __SOP_Node_h__
00022 #define __SOP_Node_h__
00023
00024 #include "SOP_API.h"
00025 #include <UT/UT_SymbolTable.h>
00026 #include <UT/UT_IntArray.h>
00027 #include <UT/UT_RefArray.h>
00028 #include <UT/UT_String.h>
00029 #include <GU/GU_Detail.h>
00030 #include <GU/GU_DetailHandle.h>
00031 #include <GU/GU_DetailGroupPair.h>
00032 #include <GU/GU_SelectType.h>
00033 #include <OP/OP_InputChangeHelper.h>
00034 #include <OP/OP_Network.h>
00035 #include <GOP/GOP_Manager.h>
00036 #include "SOP_Error.h"
00037 #include "SOP_Guide.h"
00038 #include "SOP_NodeFlags.h"
00039
00040 class UT_InfoTree;
00041 class UT_Undo;
00042 class GB_VertexGroup;
00043 class GU_Selection;
00044 class GU_Topology;
00045 class OP_OperatorTable;
00046 class SOP_Node;
00047 class SOP_SoftLockData;
00048 class DD_Source;
00049
00050 extern "C" {
00051 DLLEXPORT extern void newSopOperator(OP_OperatorTable *table);
00052 };
00053
00054 class sopVarInfo;
00055
00056 class SOP_API sop_attribRef
00057 {
00058 public:
00059 UT_String myName;
00060 int mySize;
00061 GB_AttribType myType;
00062 };
00063
00064
00065 typedef float (SOP_Node::*SOP_LocalVarFunc)
00066 (sopVarInfo *varinfo);
00067
00068
00069 SOP_API extern void SOPfillMetaKernelMenu(void *, PRM_Name *names, int size,
00070 const PRM_SpareData *, PRM_Parm *);
00071
00072
00073
00074 typedef void sopVisualizeCallback(void * , SOP_Node *, OP_Context &, GU_Detail *);
00075
00076 class SOP_API SOP_Node : public OP_Network
00077 {
00078 public:
00079 virtual const char *getChildType() const;
00080 virtual const char *getOpType() const;
00081
00082 virtual OP_OpTypeId getChildTypeID() const;
00083 virtual OP_OpTypeId getOpTypeID() const;
00084
00085 const SOP_NodeFlags &getFlags() const { return mySopFlags; }
00086
00087
00088 virtual int isCookingRender() const
00089 { return getCreator()->isCookingRender(); }
00090
00091
00092
00093 virtual void opChanged(OP_EventType reason, void *data=0);
00094
00095
00096
00097
00098
00099
00100 const CH_LocalVariable *resolveVariable(const char *name);
00101
00102
00103
00104
00105
00106 void setVariableOrder(int detail, int prim,
00107 int pt, int vtx);
00108
00109
00110 int getVariableOrder(int level) const;
00111
00112 int getVariablePrecedence(int var) const;
00113
00114
00115
00116
00117
00118 virtual bool usesFootprint() const { return true; }
00119
00120 void setVisualizeCallback(sopVisualizeCallback *callback, void *data);
00121
00122 private:
00123 void clearLocalVars();
00124
00125 public:
00126
00127
00128
00129
00130
00131 static void setCaptureOverrideFlag( bool flag )
00132 {
00133 theGlobalCaptOverride = flag;
00134 }
00135 static bool getCaptureOverrideFlag()
00136 {
00137 return theGlobalCaptOverride;
00138 }
00139
00140
00141
00142
00143
00144 void setupLocalVars();
00145
00146
00147
00148
00149 void resetLocalVarRefs();
00150
00151 void setCurGdh(int index,
00152 const GU_DetailHandle &gdh);
00153 void clearCurGdh(int index);
00154 const GU_DetailHandle &getCurGdh(int index);
00155
00156
00157 virtual float getVariableValue(int index, int thread);
00158
00159
00160
00161 bool getVariableValueFP(fpreal &val, int index);
00162
00163
00164
00165 virtual void getVariableString(int index, UT_String &value,
00166 int thread);
00167
00168
00169
00170 void addGenericVariable(const char *varname,
00171 GEO_Standard_Attributes attr,
00172 int idx, int sz, GB_AttribType type,
00173 float ladefault = 0.0f);
00174 void addGenericVariable(const char *varname,
00175 const char *attribname, int idx,
00176 int sz, GB_AttribType type,
00177 float ladefault = 0.0F);
00178 void addGenericVariable(const char *varname,
00179 int varidx,
00180 SOP_LocalVarFunc callback,
00181 float ladefault = 0.0F);
00182
00183
00184
00185 void addGenericVariable(const GU_Detail *gdp,
00186 int gdpidx,
00187 const char *varname,
00188 const char *attribname, int idx,
00189 int sz, GB_AttribType type,
00190 float ladefault = 0.0F);
00191 void addGenericVariable(int gpdidx,
00192 const char *varname,
00193 int varidx,
00194 SOP_LocalVarFunc callback,
00195 float ladefault = 0.0F);
00196 void addSpecificVariable(const GU_Detail *gdp,
00197 int gdpidx,
00198 const char *varname,
00199 const char *attribname, int idx,
00200 int sz, GB_AttribType type,
00201 GEO_AttributeOwner dictionary,
00202 float ladefault = 0.0F);
00203 void addSpecificVariable(int gpidx,
00204 const char *varname,
00205 int varidx,
00206 GEO_AttributeOwner dictionary,
00207 SOP_LocalVarFunc callback,
00208 float ladefault = 0.0F);
00209
00210 static int addCustomVariableCallback(const char *attr,
00211 const char *varname, void *data);
00212 void addCustomVariable(const char *attr,
00213 const char *varname);
00214
00215 void cacheVarPtBox(int gpdidx);
00216 void cacheVarPrimBox(int gpdidx);
00217
00218
00219
00220
00221
00222 float varCallbackT(sopVarInfo *varinfo);
00223
00224 float varCallbackPT(sopVarInfo *varinfo);
00225 float varCallbackPR(sopVarInfo *varinfo);
00226 float varCallbackVTX(sopVarInfo *varinfo);
00227
00228 float varCallbackNPT(sopVarInfo *varinfo);
00229 float varCallbackNPR(sopVarInfo *varinfo);
00230 float varCallbackNVTX(sopVarInfo *varinfo);
00231
00232 float varCallbackCE(sopVarInfo *varinfo);
00233 float varCallbackMIN(sopVarInfo *varinfo);
00234 float varCallbackMAX(sopVarInfo *varinfo);
00235 float varCallbackSIZE(sopVarInfo *varinfo);
00236 float varCallbackLIFE(sopVarInfo *varinfo);
00237 float varCallbackBB(sopVarInfo *varinfo);
00238 float varCallbackWEIGHT(sopVarInfo *varinfo);
00239
00240
00241
00242 const GU_DetailHandle &curGdh(int index) const
00243 { UT_ASSERT(index == 0 || index == 1); return myCurGdh[index]; }
00244
00245
00246
00247
00248 int curVertexNum(int index) const
00249 { UT_ASSERT(index == 0 || index == 1); return myCurVtxNum[index]; }
00250
00251 const GEO_Vertex *curVertex(int index) const
00252 { UT_ASSERT(index == 0 || index == 1); return myCurVtx[index]; }
00253
00254 const GEO_Point *curPoint(int index) const
00255 { UT_ASSERT(index == 0 || index == 1); return myCurPt[index]; }
00256
00257 const GEO_Primitive *curPrim(int index) const
00258 { UT_ASSERT(index == 0 || index == 1); return myCurPrim[index]; }
00259
00260
00261 UT_BoundingBox curPointBBox(int index)
00262 {
00263 UT_ASSERT(index == 0 || index == 1);
00264 cacheVarPtBox(index);
00265 return myCurPtBox[index];
00266 }
00267
00268
00269 UT_BoundingBox curPrimBBox(int index)
00270 {
00271 UT_ASSERT(index == 0 || index == 1);
00272 cacheVarPrimBox(index);
00273 return myCurPrimBox[index];
00274 }
00275
00276
00277
00278 void setPivotParmToGroupCentroid(OP_Context &context);
00279
00280 private:
00281
00282 void getGroupMenuHeader( int sourcenum, const char * title,
00283 UT_String & header );
00284
00285 static void buildSopGroups( const GU_Detail *src,
00286 const char * prim_header,
00287 const char * pt_header,
00288 PRM_Name *menuEntries, int themenusize,
00289 unsigned type, int start,
00290 bool includeselection, PRM_Parm *parm );
00291
00292 static int buildSopEdgeGroups( const GU_Detail *src,
00293 const char * edge_header,
00294 const char *prim_header, const char *pt_header,
00295 PRM_Name *menuEntries, int themenusize,
00296 bool addprim, int start,
00297 PRM_Parm *parm );
00298
00299 static int buildSopBreakpointGroups( const GU_Detail *src,
00300 const char * brkpt_header,
00301 const char * prim_header, const char *pt_header,
00302 PRM_Name *choicenames, int menusize,
00303 bool addprim, int start,
00304 PRM_Parm *parm );
00305
00306 public:
00307
00308
00309 static void buildGroupsFromSop( SOP_Node * src_sop,
00310 PRM_Parm *parm, const PRM_SpareData *spare,
00311 unsigned type, int start,
00312 PRM_Name *menuEntries, int thelistsize );
00313
00314 static int buildEdgeGroupsFromSop( SOP_Node * src_sop,
00315 PRM_Parm *parm, const PRM_SpareData *spare,
00316 bool addprim, int start,
00317 PRM_Name *menuEntries, int thelistsize );
00318
00319 static int buildBreakpointGroupsFromSop( SOP_Node * src_sop,
00320 PRM_Parm *parm, const PRM_SpareData *spare,
00321 bool addprim, int start,
00322 PRM_Name *menuEntries, int thelistsize );
00323
00324 void buildInputGroups(int thesourcenum,
00325 PRM_Name *thechoicenames,
00326 int themenusize,
00327 unsigned type, int start,
00328 bool includeselection,
00329 PRM_Parm *parm);
00330
00331 int buildInputEdgeGroups(int sourcenum,
00332 PRM_Name *choicenames, int menusize,
00333 bool addprim, int start,
00334 PRM_Parm *parm);
00335
00336 int buildInputBreakpointGroups(int sourcenum,
00337 PRM_Name *choicenames, int menusize,
00338 bool addprim, int start,
00339 PRM_Parm *parm);
00340
00341 virtual int setModelLock(int lock_type,
00342 void *modeler = 0,
00343 int allow_softlock_promotion=0,
00344 UT_Undo *undo = 0);
00345
00346
00347 virtual OP_DATA_TYPE getCookedDataType() const;
00348
00349 virtual void *getCookedData(OP_Context &ctx);
00350
00351 virtual bool getBoundingBox(UT_BoundingBox &box, OP_Context &ctx);
00352
00353
00354
00355
00356
00357
00358 const GU_Detail *getCookedGeo(OP_Context &, int forced = 0);
00359 GU_DetailHandle getCookedGeoHandle(OP_Context &, int forced = 0);
00360 const SOP_Guide *getCookedGuide1() const;
00361 const SOP_Guide *getCookedGuide2() const;
00362
00363
00364
00365 const GU_Detail *getLastGeo();
00366
00367
00368
00369
00370
00371 const GU_Detail *getInputLastGeo(int input, float time);
00372
00373 OP_ERROR cookGuide1(OP_Context &context);
00374 OP_ERROR cookGuide2(OP_Context &context);
00375
00376 OP_ERROR cookGuideList(OP_Context &context,
00377 UT_RefArray<GU_DetailHandle> &list);
00378
00379
00380
00381
00382 virtual GOP_GuideListType getGuideListType() const
00383 { return OP_GUIDELIST_GUDETAIL; }
00384
00385 virtual OP_ERROR lockInput(unsigned idx, OP_Context &context);
00386 void unlockInput(unsigned idx);
00387 virtual OP_ERROR lockInputs(OP_Context &context);
00388 void unlockInputs();
00389
00390 static void buildOperatorTable(OP_OperatorTable &table);
00391 static void initializeExpressions();
00392
00393 void expandGroupNames(const char *pattern,
00394 UT_String &outNames,
00395 int isPrims,
00396 GU_Detail *pgdp);
00397 void expandGroupNames(const char *pattern,
00398 UT_String &outNames,
00399 int isPrims)
00400 { expandGroupNames(pattern, outNames, isPrims, gdp); }
00401
00402 const GB_PrimitiveGroup *parsePrimitiveGroups(const char *pattern,
00403 GU_Detail *pgdp,
00404 int allow_numeric=1,
00405 int ordered = 1,
00406 bool strict = false,
00407 int offset = 0);
00408 const GB_PrimitiveGroup *parsePrimitiveGroups(const char *pattern)
00409 { return parsePrimitiveGroups(pattern, gdp); }
00410
00411 GB_PrimitiveGroup *parsePrimitiveGroupsCopy(const char *pattern,
00412 GU_Detail *pgdp,
00413 int allow_numeric=1,
00414 int ordered = 1,
00415 bool strict = false);
00416 GB_PrimitiveGroup *parsePrimitiveGroupsCopy(const char *pattern)
00417 {return parsePrimitiveGroupsCopy(pattern,gdp);}
00418
00419 const GB_PointGroup *parsePointGroups(const char *pattern,
00420 GU_Detail *pgdp,
00421 int allow_numeric=1,
00422 int ordered = 1,
00423 bool strict = false,
00424 int offset = 0);
00425 const GB_PointGroup *parsePointGroups(const char *pattern)
00426 { return parsePointGroups(pattern, gdp); }
00427
00428 GB_PointGroup *parsePointGroupsCopy(const char *pattern,
00429 GU_Detail *pgdp,
00430 int allow_numeric=1,
00431 int ordered = 1,
00432 bool strict = false);
00433 GB_PointGroup *parsePointGroupsCopy(const char *pattern)
00434 { return parsePointGroupsCopy(pattern, gdp); }
00435
00436 const GB_EdgeGroup *parseEdgeGroups(const char *pattern,
00437 GU_Detail *pgdp,
00438 bool strict = true,
00439 int prim_offset = 0,
00440 int point_offset = 0);
00441 const GB_EdgeGroup *parseEdgeGroups(const char *pattern)
00442 { return parseEdgeGroups(pattern, gdp); }
00443
00444 GB_EdgeGroup *parseEdgeGroupsCopy(const char *pattern,
00445 GU_Detail *pgdp);
00446 GB_EdgeGroup *parseEdgeGroupsCopy(const char *pattern)
00447 { return parseEdgeGroupsCopy(pattern, gdp); }
00448
00449 const GB_BreakpointGroup *parseBreakpointGroups(const char *pattern,
00450 GU_Detail *pgdp,
00451 bool strict = true,
00452 int offset = 0);
00453 const GB_BreakpointGroup *parseBreakpointGroups(const char *pattern)
00454 { return parseBreakpointGroups(pattern, gdp); }
00455
00456 GB_BreakpointGroup *parseBreakpointGroupsCopy(const char *pattern,
00457 GU_Detail *pgdp);
00458 GB_BreakpointGroup *parseBreakpointGroupsCopy(const char *pattern)
00459 {return parseBreakpointGroupsCopy(pattern,gdp);}
00460
00461 const GB_VertexGroup *parseVertexGroups(const char *pattern,
00462 GU_Detail *pgdp,
00463 bool strict = true,
00464 int offset = 0);
00465 const GB_VertexGroup *parseVertexGroups(const char *pattern)
00466 { return parseVertexGroups(pattern, gdp); }
00467
00468 GB_VertexGroup *parseVertexGroupsCopy(const char *pattern,
00469 GU_Detail *pgdp);
00470 GB_VertexGroup *parseVertexGroupsCopy(const char *pattern)
00471 { return parseVertexGroupsCopy(pattern, gdp); }
00472
00473 const GB_BaseGroup *parseAllGroups(const char *pattern,
00474 GU_Detail *pgdp=0,
00475 int allow_numeric=1,
00476 int ordered=1,
00477 unsigned int mask = GBGROUP);
00478 const GB_BaseGroup *parseAllGroups(const char *pattern)
00479 { return parseAllGroups(pattern, gdp); }
00480
00481 GB_BaseGroup *parseAllGroupsCopy(const char *pattern,
00482 GU_Detail *pgdp=0,
00483 int allow_numeric=1,
00484 int ordered=1,
00485 unsigned int mask = GBGROUP);
00486 GB_BaseGroup *parseAllGroupsCopy(const char *pattern)
00487 { return parseAllGroupsCopy(pattern, gdp); }
00488
00489
00490
00491
00492
00493
00494
00495 int destroyAdhocGroup (const GB_BaseGroup *group)
00496 { return myGroupParse.destroyAdhocGroup(group); }
00497 void destroyAdhocGroups()
00498 { myGroupParse.destroyAdhocGroups(); }
00499 void destroyAdhocGroups(const GU_Detail *g)
00500 { myGroupParse.destroyAdhocGroups(g); }
00501
00502
00503
00504 void select(void);
00505
00506 void select(GU_SelectionType stype);
00507
00508 void select(const GB_BaseGroup &group, int use_gtype = 1,
00509 int add_to_sel = 0);
00510 void select(GEO_Primitive &prim, int sel_prim = 1,
00511 int add_to_sel = 0);
00512 void select(GEO_Point &point, int point_sel = 1,
00513 int add_to_sel = 0);
00514 void selectFrom(GEO_Primitive &prim, int sel_prim = 1,
00515 int add_to_sel = 0);
00516 void selectFrom(GEO_Point &point, int point_sel = 1,
00517 int add_to_sel = 0);
00518
00519
00520
00521
00522
00523 void selectInputGroup(GB_BaseGroup *group,
00524 int grouptype);
00525
00526
00527
00528 void clearSelection(void);
00529
00530
00531
00532 void clearSelection(GU_SelectionType stype);
00533
00534
00535
00536
00537 int destroySelection(void);
00538
00539
00540 int selectionEnabled(void) const
00541 {
00542 return getHighlight();
00543 }
00544
00545 bool hasCookedSelection(void) const
00546 {
00547 return myHasCookedSelection;
00548 }
00549
00550
00551
00552
00553
00554 bool copyTempSelections(OP_Context &context, SOP_Node *src);
00555
00556 virtual void resetSimulation (void) {}
00557
00558 virtual int getNetOverviewColor( UT_Color &color );
00559
00560 void addInstanceReference(SOP_Node *node);
00561 void clearInstanceReference(SOP_Node *node);
00562
00563
00564
00565
00566
00567
00568
00569
00570 void makeInstanceOf(SOP_Node *node);
00571
00572
00573
00574
00575 void makePreserveRequest();
00576
00577 virtual void setVisualization(int) {}
00578 virtual void setForceCapture(int) {}
00579
00580 virtual void getNodeSpecificInfoText(OP_Context &context,
00581 int verbose,
00582 UT_WorkBuffer &text);
00583
00584
00585 virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree,
00586 float time);
00587
00588
00589
00590
00591
00592
00593
00594 virtual const char *getDefaultSelectedInfoTreeBranchName() const;
00595
00596
00597
00598 static PRM_SpareData theFirstInput;
00599 static PRM_SpareData theSecondInput;
00600 static PRM_SpareData theThirdInput;
00601 static PRM_SpareData theFourthInput;
00602
00603
00604 virtual fpreal getW() const;
00605
00606 virtual fpreal getH() const;
00607
00608
00609 protected:
00610 SOP_Node(OP_Network *parent, const char *name, OP_Operator *entry);
00611 virtual ~SOP_Node();
00612
00613
00614
00615 virtual void setUniqueId(int id);
00616 virtual void clearUniqueId();
00617
00618
00619
00620
00621
00622
00623
00624 int removeAdhocGroup (const GB_BaseGroup *group)
00625 { return myGroupParse.removeAdhocGroup(group); }
00626 void removeAdhocGroups()
00627 { myGroupParse.removeAdhocGroups(); }
00628
00629
00630
00631
00632
00633
00634
00635 virtual OP_ERROR cookMe (OP_Context &context);
00636 virtual OP_ERROR bypassMe (OP_Context &context, int &copied_input);
00637 virtual OP_ERROR cookMySop(OP_Context &context) = 0;
00638 virtual OP_ERROR cookMyGuide1(OP_Context &context);
00639 virtual OP_ERROR cookMyGuide2(OP_Context &context);
00640 virtual OP_ERROR cookMyGuideList(OP_Context &context,
00641 UT_RefArray<GU_DetailHandle> &list);
00642
00643 virtual OP_ERROR pubCookInputGroups(OP_Context &context, int alone = 0);
00644
00645 virtual void checkInputChanged(int parm_index, int group_type_index,
00646 GU_DetailGroupPair &detail_group_pair,
00647 GU_Detail *pgdp, const GB_BaseGroup *group);
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668 virtual OP_ERROR cookInputPrimitiveGroups(OP_Context &context,
00669 const GB_PrimitiveGroup *&group,
00670 GU_DetailGroupPair &detail_group_pair,
00671 int alone = 0, bool do_selection = true,
00672 int input_index = 0, int parm_index = 0,
00673 int group_type_index = -1,
00674 bool allow_reference = true,
00675 bool fetchgdp = true,
00676 GU_Detail *pgdp = NULL);
00677
00678
00679 virtual OP_ERROR cookInputPointGroups(OP_Context &context,
00680 const GB_PointGroup *&group,
00681 GU_DetailGroupPair &detail_group_pair,
00682 int alone = 0, bool do_selection = true,
00683 int input_index = 0, int parm_index = 0,
00684 int group_type_index = -1,
00685 bool allow_reference = true,
00686 bool fetchgdp = true,
00687 GU_Detail *pgdp = NULL);
00688
00689
00690 virtual OP_ERROR cookInputEdgeGroups(OP_Context &context,
00691 const GB_EdgeGroup *&group,
00692 GU_DetailGroupPair &detail_group_pair,
00693 int alone = 0, bool do_selection = true,
00694 int input_index = 0, int parm_index = 0,
00695 int group_type_index = -1,
00696
00697
00698
00699
00700 bool allow_reference = false,
00701 bool fetchgdp = true,
00702 GU_Detail *pgdp = NULL);
00703
00704
00705
00706
00707
00708 virtual OP_ERROR cookInputAllGroups(OP_Context &context,
00709 const GB_BaseGroup *&group,
00710 GU_DetailGroupPair &detail_group_pair,
00711 int alone = 0, bool do_selection = true,
00712 int input_index = 0, int parm_index = 0,
00713 int group_type_index = -1,
00714 bool allow_reference = false,
00715 bool is_default_prim = true,
00716 bool fetchgdp = true,
00717 GU_Detail *pgdp = NULL);
00718
00719
00720
00721
00722
00723
00724 const GB_BaseGroup *parseInputGroup(const UT_String &groupname,
00725 int grouptype, GU_Detail *gdp,
00726 bool allow_reference, bool is_default_prim);
00727
00728 private:
00729
00730 OP_ERROR cookInputGroupsPrologue(OP_Context &context, bool fetchgdp,
00731 int alone, int input_index,
00732 GU_Detail *&pgdp);
00733
00734
00735 void cookInputGroupsEpilogue(int parm_index, int group_type_index,
00736 GU_DetailGroupPair &detail_group_pair,
00737 GU_Detail *pgdp, const GB_BaseGroup *group,
00738 bool fetchgdp, int alone);
00739
00740 protected:
00741 virtual void inputConnectChanged(int which_input);
00742
00743
00744
00745
00746
00747
00748 virtual void instanceGeometryChange(SOP_Node *sop,
00749 OP_EventType how);
00750
00751
00752
00753
00754
00755
00756
00757
00758 const GU_Detail *inputGeo(int index, OP_Context &)
00759 { return inputGeo(index); }
00760 const GU_Detail *inputGeo(int index) const;
00761 GU_DetailHandle inputGeoHandle(int index) const;
00762
00763
00764
00765
00766
00767
00768 void addError(int code, const char *msg = 0)
00769 { getLockedErrorManager()->addError(SOP_OPTYPE_NAME,
00770 code, msg); }
00771 void addMessage(SOP_ErrorCodes code, const char *msg = 0)
00772 { getLockedErrorManager()->addMessage(SOP_OPTYPE_NAME,
00773 code, msg); }
00774 void addWarning(SOP_ErrorCodes code, const char *msg = 0)
00775 { getLockedErrorManager()->addWarning(SOP_OPTYPE_NAME,
00776 code, msg); }
00777 void addFatal(SOP_ErrorCodes code, const char *msg = 0)
00778 { getLockedErrorManager()->addFatal(SOP_OPTYPE_NAME,
00779 code, msg); }
00780 void addSystemError(const char *msg = 0)
00781 { getLockedErrorManager()->systemError(msg);}
00782 void addCommonError(UT_CommonErrorCode what,
00783 const char *msg = 0)
00784 { getLockedErrorManager()->commonError(what, msg);}
00785
00786
00787
00788
00789 SOP_Node *getObjectsSopNode(const char *objectName,
00790 OP_Context &context,
00791 UT_Matrix4 *xform = 0,
00792 float *rx = 0,
00793 float *ry = 0,
00794 float *rz = 0);
00795
00796
00797
00798
00799
00800
00801
00802 public:
00803 static PRM_ChoiceList allGroupMenu;
00804 static PRM_ChoiceList groupMenu;
00805 static PRM_ChoiceList primGroupMenu;
00806 static PRM_ChoiceList pointGroupMenu;
00807 static PRM_ChoiceList edgeGroupMenu;
00808 static PRM_ChoiceList breakpointGroupMenu;
00809 static PRM_ChoiceList primNamedGroupMenu;
00810 static PRM_ChoiceList pointNamedGroupMenu;
00811
00812 protected:
00813
00814 int parseGroups(const char *pattern,
00815 GU_Detail *gdp,
00816 const GB_PrimitiveGroup *&prim,
00817 const GB_PointGroup *&points,
00818 bool strict = false);
00819
00820 int parseGroupsCopy(const char *pattern,
00821 GU_Detail *gdp,
00822 GB_PrimitiveGroup *&prim,
00823 GB_PointGroup *&points,
00824 int unify,
00825 bool strict = false);
00826
00827 public:
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837 int fillAttribNameMenu(PRM_Name *menu_entries,
00838 int max_menu_size,
00839 GEO_AttributeOwner dictionary,
00840 int input_index,
00841 bool (*approve)(const GB_Attribute*,void*)=NULL,
00842 void *approve_data = NULL);
00843
00844
00845 static void sortMenu(PRM_Name *menuEntries, int size);
00846
00847 static void removeMenuDuplicates(PRM_Name *menuEntries, int size);
00848
00849
00850 static bool approveUserAttribsOnlyCB(const GB_Attribute *atr,
00851 void *data);
00852
00853 protected:
00854
00855
00856
00857 void getVectorAttribOffsets( const char * attrib_names,
00858 UT_IntArray &point_attrib_offsets,
00859 UT_IntArray &prim_attrib_offsets);
00860
00861
00862 void getVectorAttribOffsets(const GB_AttributeDict &dict,
00863 const char * attrib_string,
00864 UT_IntArray &offsets,
00865 UT_String &bad_attribs);
00866
00867 protected:
00868
00869
00870
00871 virtual int acceptDragDrop(DD_Source &src, const char *l);
00872 virtual int testDragDrop(DD_Source &src);
00873 virtual void getDragDropChoice(DD_Source &src,
00874 DD_ChoiceList &choices);
00875
00876
00877
00878 int parseEachGroup(const char *pattern,
00879 GroupOperation operation,
00880 void *data, int isPrim,
00881 GU_Detail *pgdp=0,
00882 bool strict = false,
00883 bool allow_adhoc = false);
00884
00885
00886
00887
00888 void subdividePrimitiveGroup(
00889 GroupOperation operation,
00890 const GB_PrimitiveGroup *group,
00891 void *data, int optype,
00892 int opstep, const char *oplabel,
00893 GU_Detail *gdp=0);
00894 void subdivideMixPrimitiveGroup(
00895 GroupOperation operation,
00896 const GB_PrimitiveGroup *group,
00897 void *data, int optype,
00898 int opstep, const char *oplabel,
00899 GU_Detail *gdp=0);
00900 void subdividePointGroup(
00901 GroupOperation operation,
00902 const GB_PointGroup *group,
00903 void *data, int optype,
00904 int opstep, const char *oplabel,
00905 GU_Detail *gdp=0);
00906
00907
00908
00909
00910 GB_PrimitiveGroup *createAdhocPrimGroup (GU_Detail &geo,
00911 const char *p="adhoc")
00912 { return myGroupParse.createPrimitiveGroup (geo, p); }
00913 GB_PointGroup *createAdhocPointGroup(GU_Detail &geo,
00914 const char *p="adhoc")
00915 { return myGroupParse.createPointGroup (geo, p); }
00916 GB_EdgeGroup *createAdhocEdgeGroup (GU_Detail &geo,
00917 const char *p="adhoc")
00918 { return myGroupParse.createEdgeGroup(geo, p); }
00919 GB_VertexGroup *createAdhocVertexGroup (GU_Detail &geo,
00920 const char *p="adhoc")
00921 { return myGroupParse.createVertexGroup(geo, p); }
00922 GB_BreakpointGroup *createAdhocBreakpointGroup (GU_Detail &geo,
00923 const char *p="adhoc")
00924 { return myGroupParse.createBreakpointGroup(geo, p); }
00925
00926
00927
00928
00929
00930
00931
00932
00933 void clearInstance(int duplicate = 0);
00934
00935
00936
00937
00938
00939 OP_ERROR duplicateSource(unsigned index, OP_Context &context,
00940 GU_Detail *gdp, int clean=1);
00941 OP_ERROR duplicateSource(unsigned index, OP_Context &context)
00942 { return duplicateSource(index, context, gdp); }
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956 OP_ERROR duplicatePointSource(unsigned index, OP_Context &ctx,
00957 GU_Detail *gdp, int clean = 1,
00958 bool wattrib = true,
00959 bool *fully = 0);
00960 OP_ERROR duplicatePointSource(unsigned index, OP_Context &ctx)
00961 { return duplicatePointSource(index, ctx, gdp); }
00962
00963
00964
00965 OP_ERROR duplicateChangedSource(unsigned idx, OP_Context &ctx,
00966 int *changed = 0, bool force=false);
00967
00968
00969 OP_ERROR duplicateSourceGroup(const GU_Detail *src_gdp,
00970 const GB_PrimitiveGroup *primgroup,
00971 GU_Detail *dest_gdp=0);
00972
00973
00974 void resetChangedSourceFlags();
00975
00976
00977
00978
00979
00980
00981
00982 OP_ERROR checkChangedSourceFlags(unsigned idx, OP_Context &ctx,
00983 int *changed);
00984
00985
00986
00987
00988
00989
00990
00991
00992 bool useInputSource(unsigned idx, bool &changed, bool force)
00993 {
00994 return myInputChangeHelper.useInput(
00995 *this, idx, changed, force);
00996 }
00997
00998
00999
01000
01001 OP_ERROR duplicateChangedSource(unsigned idx, OP_Context &ctx,
01002 GU_Topology &tp, int *changed,
01003 GU_Detail *gdp, int clean=1);
01004 OP_ERROR duplicateChangedSource(unsigned idx, OP_Context &ctx,
01005 GU_Topology &tp, int *changed=0)
01006 { return duplicateChangedSource(idx, ctx, tp, changed,
01007 gdp); }
01008
01009
01010 virtual void deleteCookedData(void);
01011 virtual int deleteNodeData(void *);
01012 virtual void *copyNodeData (void *);
01013
01014
01015
01016 GB_PrimitiveGroup *getPastedSurfaces(void)
01017 {
01018 return gdp->getPastedSurfaces("_sop_all_pasted_");
01019 }
01020 GB_PrimitiveGroup *getPastedSurfaces(GB_PrimitiveGroup *&used)
01021 {
01022 return gdp->getPastedSurfaces(used,
01023 "_sop_all_pasted_",
01024 "_sop_used_pasted_");
01025 }
01026 void updatePastedDisplacement(const GEO_Point &ppt,
01027 const GB_PrimitiveGroup *all,
01028 GB_PrimitiveGroup *used)
01029 {
01030 gdp->updatePastedDisplacement(ppt, all, used);
01031 }
01032 int updatePastedDisplacements(void)
01033 {
01034
01035 return gdp->updatePastedDisplacements();
01036 }
01037 int updatePastedDependents(GB_PrimitiveGroup *all,
01038 GB_PrimitiveGroup *used)
01039 {
01040
01041 return gdp->updatePastedDependents(all, used);
01042 }
01043
01044
01045 void convertPivotAboutGroupCentroid(
01046 PRM_Parm &grppivot_parm,
01047 int pivot_parm_idx,
01048 const UT_Vector3 *centroid = 0);
01049
01050
01051
01052 virtual bool getGroupCentroid(OP_Context & ,
01053 UT_Vector3 & )
01054 { return false; }
01055
01056
01057
01058
01059 virtual OP_ERROR save(ostream &os, const OP_SaveFlags &flags,
01060 const char *pathPrefix);
01061 virtual bool load(UT_IStream &is, const char *extension,
01062 const char *path=0);
01063
01064 void refreshGdp();
01065
01066
01067
01068
01069
01070
01071
01072
01073 GU_DetailHandle myGdpHandle;
01074
01075
01076
01077
01078 GU_Detail *gdp;
01079 SOP_Guide *myGuide1;
01080 SOP_Guide *myGuide2;
01081 SOP_NodeFlags mySopFlags;
01082
01083 private:
01084
01085
01086
01087
01088
01089 virtual OP_ERROR saveIntrinsic(ostream &os, const OP_SaveFlags &flags);
01090
01091 virtual bool loadPacket(UT_IStream &is, short class_id, short sig,
01092 const char *path=0);
01093 virtual bool loadPacket(UT_IStream &is, const char *token,
01094 const char *path=0);
01095
01096 virtual void clearAndDestroy(void);
01097
01098 virtual int saveCookedData(const char *, OP_Context &);
01099 virtual int saveCookedData(ostream &os, OP_Context &, int binary = 0);
01100 virtual bool loadCookedData(UT_IStream &is, const char *path=0);
01101
01102
01103
01104
01105 bool loadHardCookedData(UT_IStream &is, const char *path=0);
01106
01107 virtual const char *getFileExtension(int binary) const;
01108
01109 int softLockable(const GU_Detail &unmodelled_gdp,
01110 const GU_Detail &modelled_gdp) const;
01111
01112
01113
01114
01115 int storeSoftLockData(OP_Context &context, int prev_lock,
01116 SOP_SoftLockData *old_slockdata=0);
01117
01118 sopVisualizeCallback *myVisualizeCallback;
01119 void *myVisualizeCallbackData;
01120
01121 protected:
01122
01123
01124
01125 GU_Selection *newSelection(GU_SelectionType stype);
01126 GU_Selection *newSelection(const GB_BaseGroup &group);
01127
01128
01129 public:
01130
01131 virtual void unloadDataHack();
01132
01133 virtual bool unloadData();
01134
01135
01136 bool isLoaded() const;
01137
01138 private:
01139 OP_InputChangeHelper myInputChangeHelper;
01140
01141
01142
01143
01144
01145
01146 UT_PtrArray<GU_DetailHandle *> myInputGeoHandles;
01147
01148 GOP_Manager myGroupParse;
01149
01150 friend class SOP_UndoModel;
01151 friend class SOP_CacheManager;
01152 friend class SOP_CacheData;
01153
01154
01155
01156
01157 SOP_SoftLockData *mySoftLockData;
01158
01159 bool myHasCookedSelection;
01160
01161
01162
01163
01164
01165 static bool theGlobalCaptOverride;
01166
01167 protected:
01168
01169 UT_SymbolTable myLocalVarTable;
01170 UT_PtrArray<sopVarInfo *> myLocalVarArray;
01171 UT_IntArray myInstancingOps;
01172
01173 int myInstanceOp;
01174
01175 int myLocalVarOrder;
01176
01177 private:
01178 const GU_Detail *myCurGdp[2];
01179 GU_DetailHandle myCurGdh[2];
01180
01181 protected:
01182 const GEO_Vertex *myCurVtx[2];
01183 int myCurVtxNum[2];
01184 const GEO_Point *myCurPt[2];
01185 const GEO_Primitive *myCurPrim[2];
01186 int myCurBuiltPtBox[2];
01187 UT_BoundingBox myCurPtBox[2];
01188 int myCurBuiltPrimBox[2];
01189 UT_BoundingBox myCurPrimBox[2];
01190
01191 int myCurGdpVal;
01192
01193
01194 int myLocalVarOrderCache;
01195 int myCurrentLayerCache;
01196
01197
01198
01199 UT_RefArray<sop_attribRef> myAttribCache[2][4];
01200 UT_String myVarMapCache[2];
01201 };
01202
01203
01204
01205 SOP_API extern void
01206 SOPgetVexReservedTemplateLists(UT_PtrArray<PRM_Template *> &tplatelists);
01207
01208 #endif