HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Node.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SOP Library (C++)
7  *
8  * COMMENTS: The base class for all SOP operators
9  * Every SOP is responsible for filling in the following methods:
10  * cookMe(float t);
11  *
12  */
13 
14 #ifndef __SOP_Node_h__
15 #define __SOP_Node_h__
16 
17 #include "SOP_API.h"
18 
19 #include "SOP_Error.h"
20 #include "SOP_Guide.h"
21 #include "SOP_NodeFlags.h"
23 #include "SOP_SelectionOwner.h"
24 
25 #include <GOP/GOP_Manager.h>
26 #include <GU/GU_Detail.h>
27 #include <GU/GU_DetailHandle.h>
28 #include <GU/GU_DetailGroupPair.h>
29 #include <GU/GU_SelectType.h>
30 #include <GU/GU_SelectionSet.h>
31 #include <GEO/GEO_Detail.h>
32 #include <GA/GA_AttributeRef.h>
33 #include <GA/GA_Types.h>
34 #include <CH/CH_LocalVariable.h>
36 #include <OP/OP_Network.h>
37 #include <PRM/PRM_Shared.h>
38 #include <UT/UT_Lock.h>
39 #include <UT/UT_SymbolTable.h>
40 #include <UT/UT_IntArray.h>
41 #include <UT/UT_Array.h>
42 #include <UT/UT_String.h>
43 #include <SYS/SYS_Deprecated.h>
44 
45 class UT_InfoTree;
46 class UT_Undo;
47 class GU_Selection;
48 class OP_OperatorTable;
49 class SOP_Node;
50 class SOP_SoftLockData;
51 class DD_Source;
52 
53 class sop_AttributeEvaluator;
54 class SOP_NodeVerb;
55 class SOP_NodeParms;
56 class SOP_NodeCache;
57 
59 {
61 };
62 
63 extern "C" {
65 };
66 
67 class sopVarInfo;
68 
70 {
71 public:
73  int mySize;
75 };
76 
77 // A call back operator for local variables:
79  (sopVarInfo *varinfo);
80 
82 {
83 public:
84  CH_LocalVariable myVar; // Actual variable name.
85  int myTable; // Which table to use
86  UT_String myAttribName; // Name of the attribute
87  GA_ROAttributeRef myOffset; // Offset in attrib
88  sopVarInfo *mySecondaryVariable; // For LIFE that needs two.
89  int myTupleIndex; // Component in tuple
90  fpreal myDefault; // Default value if not present
91  GA_StorageClass myStorageClass; // Float, Int, or String
92  GA_AttributeOwner myDictionary; // Vertex, Point, Primitive, or Detail
93  int myVaridx; // Call back parameter.
94  SOP_LocalVarFunc myCallback; // Call back function
95 };
96 
97 // Handy function to build a meta kernel menu. Used in several sops.
98 SOP_API extern void SOPfillMetaKernelMenu(
99  void *, PRM_Name *names, int size,
100  const PRM_SpareData *, const PRM_Parm *);
101 
102 #define SOP_LOCALVAR_START 1000000 // Start of local variable indices
103 
104 //___________________________________________________________________________
105 
106 typedef void sopVisualizeCallback(void * /*data*/, SOP_Node *, OP_Context &, GU_Detail *);
107 
109  public OP_Network,
110  public SOP_SelectionOwner
111 {
112 public:
113  virtual const char *getChildType() const override;
114  virtual const char *getOpType() const override;
115 
116  static const char *theChildTableName;
117  virtual OP_OpTypeId getChildTypeID() const override;
118  virtual OP_OpTypeId getOpTypeID() const override;
119 
120  const SOP_NodeFlags &getFlags() const { return mySopFlags; }
121 
122  // Whether a SOP is cooking render is whether its object creator is.
123  virtual int isCookingRender() const override
124  { return getCreator()->isCookingRender(); }
125 
126  // This allows us to tap into flag changes and perform unloads
127  // if necessary.
128  virtual void opChanged(OP_EventType reason,
129  void *data=0) override;
130 
131  // SOP networks need some logic to switch between using
132  // output nodes, display nodes, or render nodes. This function can
133  // also be used to just return the Output SOPs by passing false to
134  // "fallback_to_display_render".
135  SOP_Node *getOutputSop(int outputidx,
136  bool fallback_to_display_render = true);
137 
138  //
139  // Local variable functions:
140  //
141 
142  // Used to accumulate local variables:
143  virtual const CH_LocalVariable *resolveVariable(
144  const char *name) override;
146  const char *name) override;
147 
148  // Each one gets a precedence from 0-3. Resolution within
149  // a precedence is undefined.
150  // 0 is highest precedence.
151  // This is used for generic variables like Cd
152  void setVariableOrder(int detail, int prim,
153  int pt, int vtx);
154  // Gets the index of specified level. Index is same as the parameter
155  // order in setVariableOrder
156  int getVariableOrder(int level) const;
157  // Given a variable idx, gives the precedence.
158  int getVariablePrecedence(int var) const;
159 
160  // Wipe the table of local variables
161  // This is automatically called by the setup function so
162  // shouldn't be called outside it.
163 
164  virtual bool usesFootprint() const override
165  { return true; }
166 
167  void setVisualizeCallback(sopVisualizeCallback *callback, void *data);
168 
169  /// Moves visualizer into our output list
170  virtual bool addOrMoveVisualizerToOutput(int outputidx) override;
171 
172 private:
173  void clearLocalVars();
174  void updateLocalVarOffsets();
175 
176  // invalidate any cached data
177  virtual void clearCache() override;
178 
179  // This resets the attribute caches for @ style local variables.
180  // It is implied by setupLocalVars, resetLocalVarRefs,
181  // and clearLocalVars.
182  void clearAttributeEvalCaches();
183 public:
184 
185  // the flag indicating the capture override state (on/off)
186  // This override is mirroring the kinematic override at the OBJ level.
187  // It is used to determine whether capture related SOPs use the
188  // capture parameter or regular animation parameters for cooking
189  static void setCaptureOverrideFlag( bool flag )
190  {
191  theGlobalCaptOverride = flag;
192  }
193  static bool getCaptureOverrideFlag()
194  {
195  return theGlobalCaptOverride;
196  }
197 
198 
199  // Build the local variable table
200  // This should be done AFTER you have set the local variable
201  // order & AFTER you have initialized your myGdp[*].
202  bool setupLocalVars();
203 
204  // This resets all the myCur*s to zero so we can be sure they
205  // are all cleared out. It does NOT clear the bounding box
206  // build states.
207  void resetLocalVarRefs();
208 
209  void setCurGdh(int index,
210  const GU_DetailHandle &gdh);
211  void clearCurGdh(int index);
212  const GU_DetailHandle &getCurGdh(int index);
213 
214  void setCurPoint(int index,
215  GA_Offset ptoff);
216  void clearCurPoint(int index);
217  void setCurVertex(int index,
218  GA_Offset ptoff);
219  void clearCurVertex(int index);
220  void setCurPrim(int index,
221  GA_Offset primoff);
222  void clearCurPrim(int index);
223  void setCurVertexNum(int index,
224  exint vtxnum);
225  void clearCurVertexNum(int index);
226 
227  // Called by evalVariableValue() to resolve local variables.
228  // Note that this will not resolve global variables like $F!
229  bool getVariableValueFP(fpreal &val, int index);
230 
231  // This gets the variable value as an fpreal value.
232  // Note that you should call the base class if you don't handle the given
233  // index.
234  virtual bool evalVariableValue(fpreal &val, int index,
235  int thread) override;
236 
237  // This gets the variable value as a string. Not the string
238  // corresponding to the specified index.
239  // Note that you should call the base class if you don't handle the given
240  // index.
241  virtual bool evalVariableValue(UT_String &value, int index,
242  int thread) override;
243 
244  /// A simple wrapper class to help in the semantic transition of specific
245  /// addGenericVariable() and addSpecificVariable() overloads that now use
246  /// higher level tuple index arguments instead of lower level byte offset
247  /// arguments.
249  {
250  public:
251  explicit AttribTupleIndexArg(int index) : myIndex(index) {}
252  operator int() const { return myIndex; }
253  private:
254  int myIndex;
255 
256  };
257 
258  // Tries to add the variable to each of our gdps, using the appropriate
259  // "" or "2" suffix.
260  void addGenericVariable(const char *varname,
262  const AttribTupleIndexArg &tuple_idx,
264  GA_Defaults const& defaults = GA_Defaults(0.0f));
265  void addGenericVariable(const char *varname,
266  const char *attribname,
267  const AttribTupleIndexArg &tuple_idx,
269  GA_Defaults const& defaults = GA_Defaults(0.0f));
270  void addGenericVariable(const char *varname,
271  int varidx,
272  SOP_LocalVarFunc callback,
273  GA_Defaults const& defaults = GA_Defaults(0.0f));
274  // Add variables to our look up table, provided they exist in the GDP
275  // The addGeneric adds all the prefixed versions, then finds the first
276  // one which is valid and sets itself to that.
277  void addGenericVariable(const GU_Detail *gdp,
278  int gdpidx,
279  const char *varname,
280  const char *attribname,
281  const AttribTupleIndexArg &tuple_idx,
283  GA_Defaults const& defaults = GA_Defaults(0.0f));
284  void addGenericVariable(int gpdidx,
285  const char *varname,
286  int varidx,
287  SOP_LocalVarFunc callback,
288  GA_Defaults const& defaults = GA_Defaults(0.0f));
289  void addSpecificVariable(const GU_Detail *gdp,
290  int gdpidx,
291  const char *varname,
292  const char *attribname,
293  const AttribTupleIndexArg &tuple_idx,
295  GA_AttributeOwner dictionary,
296  GA_Defaults const& defaults = GA_Defaults(0.0f));
297  void addSpecificVariable(int gpidx,
298  const char *varname,
299  int varidx,
300  GA_AttributeOwner dictionary,
301  SOP_LocalVarFunc callback,
302  GA_Defaults const& defaults = GA_Defaults(0.0f));
303 
304  static int addCustomVariableCallback(const char *attr,
305  const char *varname, void *data);
306  void addCustomVariable(const char *attr,
307  const char *varname);
308 
309  void cacheVarPtBox(int gpdidx);
310  void cacheVarPrimBox(int gpdidx);
311 
312  //
313  // These are the call back functions to evaluate various variable
314  // types.
315  //
316  fpreal varCallbackT(sopVarInfo *varinfo);
317 
318  fpreal varCallbackPT(sopVarInfo *varinfo);
319  fpreal varCallbackPR(sopVarInfo *varinfo);
320  fpreal varCallbackVTX(sopVarInfo *varinfo);
321 
322  fpreal varCallbackNPT(sopVarInfo *varinfo);
323  fpreal varCallbackNPR(sopVarInfo *varinfo);
324  fpreal varCallbackNVTX(sopVarInfo *varinfo);
325 
326  fpreal varCallbackCE(sopVarInfo *varinfo);
327  fpreal varCallbackMIN(sopVarInfo *varinfo);
328  fpreal varCallbackMAX(sopVarInfo *varinfo);
329  fpreal varCallbackSIZE(sopVarInfo *varinfo);
330  fpreal varCallbackLIFE(sopVarInfo *varinfo);
331  fpreal varCallbackAGE(sopVarInfo *varinfo);
332  fpreal varCallbackBB(sopVarInfo *varinfo);
333  fpreal varCallbackWEIGHT(sopVarInfo *varinfo);
334 
335  // These methods return the variables being iterated over. The index
336  // must be 0 or 1.
337  const GU_DetailHandle &curGdh(int index) const
338  { UT_ASSERT(index == 0 || index == 1); return myCurGdh[index]; }
339 
340  // Note that the current vertex num will be 0 even if there is no
341  // current vertex. Use curVertex() to check if there is a current
342  // vertex.
343  int curVertexNum(int index) const
344  { UT_ASSERT(index == 0 || index == 1); return myCurVtxNum[index]; }
345 
346  const GU_Detail *curGdp(int index) const
347  { UT_ASSERT(index == 0 || index == 1); return myCurGdp[index]; }
348 
349  GA_Offset curVertex(int local_var_gdp_index) const
350  { UT_ASSERT(local_var_gdp_index == 0 || local_var_gdp_index == 1);
351  if (!myCurGdp[local_var_gdp_index]) return GA_INVALID_OFFSET;
352  return myCurVtxOff[local_var_gdp_index]; }
353 
355  { UT_ASSERT(index == 0 || index == 1); if (!myCurGdp[index]) return GA_INVALID_OFFSET; return myCurPtOff[index]; }
356 
357  const GEO_Primitive *curPrim(int index) const
358  { UT_ASSERT(index == 0 || index == 1); if (!myCurGdp[index]) return 0; return myCurGdp[index]->getGEOPrimitive(myCurPrimOff[index]); }
359 
360  // The point bounding box is used from $BBX, $BBY, and $BBZ.
362  {
363  UT_ASSERT(index == 0 || index == 1);
364  cacheVarPtBox(index);
365  return myCurPtBox[index];
366  }
367 
368  // The primitive bounding box is used from $MINX, $MINY, and $MINZ.
370  {
371  UT_ASSERT(index == 0 || index == 1);
372  cacheVarPrimBox(index);
373  return myCurPrimBox[index];
374  }
375 
376 
377  // Function to set the pivot parm to the centroid of the input group
378  void setPivotParmToGroupCentroid(OP_Context &context);
379 
380 private:
381  // Helper function for building the drop down group menus.
382  void getGroupMenuHeader(int sourcenum, const char * title,
383  UT_String & header);
384 
385  static int buildSopGroups(const GU_Detail *src,
386  const char *prim_header,
387  const char *pt_header,
388  const char *edge_header,
389  const char *vertex_header,
390  PRM_Name *menuEntries, int themenusize,
391  unsigned type, int start,
392  bool includeselection, const PRM_Parm *parm);
393 
394  static int buildSopEdgeGroups(const GU_Detail *src,
395  const char * edge_header,
396  const char *prim_header, const char *pt_header,
397  const char *vertex_header,
398  PRM_Name *menuEntries, int themenusize,
399  bool addprim, int start,
400  const PRM_Parm *parm);
401 
402  static int buildSopBreakpointGroups(const GU_Detail *src,
403  const char * brkpt_header,
404  const char * prim_header, const char *pt_header,
405  const char * edge_header,
406  const char *vertex_header,
407  PRM_Name *choicenames, int menusize,
408  bool addprim, int start,
409  const PRM_Parm *parm);
410 
411 public:
412  // The following method has to be public for some static functions in
413  // the code
414  static void buildGroupsFromSop( SOP_Node * src_sop,
415  const PRM_Parm *parm,
416  const PRM_SpareData *spare,
417  unsigned type, int start,
418  PRM_Name *menuEntries, int thelistsize );
419 
420  static int buildEdgeGroupsFromSop( SOP_Node * src_sop,
421  const PRM_Parm *parm,
422  const PRM_SpareData *spare,
423  bool addprim, int start,
424  PRM_Name *menuEntries, int thelistsize );
425 
426  static int buildBreakpointGroupsFromSop( SOP_Node * src_sop,
427  const PRM_Parm *parm,
428  const PRM_SpareData *spare,
429  bool addprim, int start,
430  PRM_Name *menuEntries, int thelistsize );
431 
432  void buildNamedPrims(int thesourcenum,
433  PRM_Name *thechoicenames,
434  int themenusize,
435  const PRM_Parm *parm,
436  bool globvectors,
437  bool numberedvolumes);
438 
439  void buildInputGroups(int thesourcenum,
440  PRM_Name *thechoicenames,
441  int themenusize,
442  unsigned type, int start,
443  bool includeselection,
444  const PRM_Parm *parm);
445 
446  int buildInputEdgeGroups(int sourcenum,
447  PRM_Name *choicenames, int menusize,
448  bool addprim, int start,
449  const PRM_Parm *parm);
450 
451  int buildInputBreakpointGroups(int sourcenum,
452  PRM_Name *choicenames, int menusize,
453  bool addprim, int start,
454  const PRM_Parm *parm);
455 
456  virtual int setModelLock(int lock_type,
457  void *modeler = 0,
458  int allow_softlock_promotion=0,
459  UT_Undo *undo = 0) override;
460 
461  // Nobody should have to override this, but it's public for other people
462  virtual OP_DataType getCookedDataType() const override;
463 
464  virtual void *getCookedData(OP_Context &ctx) override;
465 
466  virtual bool getBoundingBox(UT_BoundingBox &box,
467  OP_Context &ctx) override;
468 
469  // Get cooked geometry. If "forced" is true and cooking fails, we create
470  // an empty gdp and clear the cooking flags.
471  // Note that the resulting handle may be reused in future cooks!
472  // To prevent the handle from being reused, call addPreserveRequest()
473  // on the handle.
474  const GU_Detail *getCookedGeo(OP_Context &, int forced = 0);
475  GU_DetailHandle getCookedGeoHandle(OP_Context &, int forced = 0);
476  GU_DetailHandle cookOutput(OP_Context &context, int outputidx, SOP_Node *interests);
477  const SOP_Guide *getCookedGuide1() const;
478  const SOP_Guide *getCookedGuide2() const;
479 
480  // This is similar to the getCookedGeo except it merely returns the
481  // cached GEO, if any. If none, it returns NULL without trying to cook.
482  const GU_Detail *getLastGeo();
483 
484  // Returns the equivalent of getLastGeo of the given input. This lets
485  // you get an input geometry without locking the input and without
486  // risking cooking it. It can, and will, return NULL without trying
487  // to cook in many cases.
488  const GU_Detail *getInputLastGeo(int input, fpreal time);
489 
490  OP_ERROR cookGuide1(OP_Context &context);
491  OP_ERROR cookGuide2(OP_Context &context);
492 
493  OP_ERROR cookGuideList(OP_Context &context,
495 
496  // The guide list can consist of either GOP_Guide derived objects or simple
497  // GU_Detail objects (but not a combination). This method is used to query
498  // which of the two, if any, the node generates.
500  { return OP_GUIDELIST_GUDETAIL; }
501 
502  virtual OP_ERROR lockInput(unsigned idx,
503  OP_Context &context) override;
504  void unlockInput(unsigned idx) override;
505  virtual OP_ERROR lockInputs(OP_Context &context) override;
506  void unlockInputs() override;
507 
508  static void buildOperatorTable(OP_OperatorTable &table);
509  static void initializeExpressions();
510 
511  // Change the string into a valid group name. A return value of true
512  // indicates that the string needed changing, in which case severity
513  // specifies the level of error this method generated (UT_ERROR_NONE,
514  // UT_ERROR_WARNING, or UT_ERROR_ABORT).
515  // Note that this does not force the name to be non-zero in length.
516  bool forceValidGroupName(UT_String &name,
518  static bool forceValidGroupName(UT_String &name,
519  UT_ErrorManager *error,
521  // Change the string into a valid group prefix. A return value of true
522  // indicates that the string needed changing, in which case severity
523  // specifies the level of error this method generated (UT_ERROR_NONE,
524  // UT_ERROR_WARNING, or UT_ERROR_ABORT).
525  // Note that this does not force the prefix to be non-zero in length.
526  bool forceValidGroupPrefix(UT_String &prefix,
528 
529  void expandGroupMask(const char *pattern,
530  UT_String &outNames,
532  const GU_Detail *pgdp);
533  void expandGroupMask(const char *pattern,
534  UT_String &outNames,
536  { expandGroupMask(pattern, outNames, type, gdp); }
537 
538  /// Typedef to help make use of GroupCreator less verbose.
540 
541  const GA_PrimitiveGroup *parsePrimitiveGroups(const char *pattern,
542  const GroupCreator &creator,
543  bool allow_numeric = true,
544  bool ordered = false,
545  bool strict = false,
546  GA_Index offset = GA_Index(0));
547  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
548  const GA_PrimitiveGroup *parsePrimitiveGroups(const char *pattern,
549  GU_Detail *pgdp,
550  int allow_numeric=1,
551  int ordered = 1,
552  bool strict = false,
553  int offset = 0);
554  const GA_PrimitiveGroup *parsePrimitiveGroups(const char *pattern)
555  { return parsePrimitiveGroups(pattern, GroupCreator(gdp, false), true, true); }
556 
557  GA_PrimitiveGroup *parsePrimitiveGroupsCopy(const char *pattern,
558  const GroupCreator &creator,
559  bool allow_numeric = true,
560  bool ordered = false,
561  bool strict = false);
562  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
563  GA_PrimitiveGroup *parsePrimitiveGroupsCopy(const char *pattern,
564  GU_Detail *pgdp,
565  int allow_numeric=1,
566  int ordered = 1,
567  bool strict = false);
569  { return parsePrimitiveGroupsCopy(pattern, GroupCreator(gdp, false), true, true); }
570 
571  const GA_PointGroup *parsePointGroups(const char *pattern,
572  const GroupCreator &creator,
573  bool allow_numeric = true,
574  bool ordered = false,
575  bool strict = false,
576  GA_Index offset = GA_Index(0));
577  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
578  const GA_PointGroup *parsePointGroups(const char *pattern,
579  GU_Detail *pgdp,
580  int allow_numeric=1,
581  int ordered = 1,
582  bool strict = false,
583  int offset = 0);
584  const GA_PointGroup *parsePointGroups(const char *pattern)
585  { return parsePointGroups(pattern, GroupCreator(gdp, false), true, true); }
586 
587  GA_PointGroup *parsePointGroupsCopy(const char *pattern,
588  const GroupCreator &creator,
589  bool allow_numeric = true,
590  bool ordered = false,
591  bool strict = false);
592  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
593  GA_PointGroup *parsePointGroupsCopy(const char *pattern,
594  GU_Detail *pgdp,
595  int allow_numeric=1,
596  int ordered = 1,
597  bool strict = false);
598  GA_PointGroup *parsePointGroupsCopy(const char *pattern)
599  { return parsePointGroupsCopy(pattern, GroupCreator(gdp, false), true, true); }
600 
601  const GA_EdgeGroup *parseEdgeGroups(const char *pattern,
602  const GU_Detail *pgdp,
603  bool strict = true,
604  GA_Index prim_offset = GA_Index(0),
605  GA_Index point_offset = GA_Index(0));
606  const GA_EdgeGroup *parseEdgeGroups(const char *pattern)
607  { return parseEdgeGroups(pattern, (const GU_Detail *)gdp); }
608 
609  GA_EdgeGroup *parseEdgeGroupsCopy(const char *pattern,
610  const GU_Detail *pgdp);
611  GA_EdgeGroup *parseEdgeGroupsCopy(const char *pattern)
612  { return parseEdgeGroupsCopy(pattern, (const GU_Detail *)gdp); }
613 
614  const GA_BreakpointGroup *parseBreakpointGroups(const char *pattern,
615  const GU_Detail *pgdp,
616  bool strict = true,
617  GA_Index offset = GA_Index(0));
618  const GA_BreakpointGroup *parseBreakpointGroups(const char *pattern)
619  { return parseBreakpointGroups(pattern, (const GU_Detail *)gdp); }
620 
621  GA_BreakpointGroup *parseBreakpointGroupsCopy(const char *pattern,
622  const GU_Detail *pgdp);
624  {return parseBreakpointGroupsCopy(pattern,(const GU_Detail *)gdp);}
625 
626  const GA_VertexGroup *parseVertexGroups(const char *pattern,
627  const GU_Detail *pgdp,
628  bool strict = true,
629  GA_Index offset = GA_Index(0));
630  const GA_VertexGroup *parseVertexGroups(const char *pattern)
631  { return parseVertexGroups(pattern, (const GU_Detail *)gdp); }
632 
633  GA_VertexGroup *parseVertexGroupsCopy(const char *pattern,
634  const GU_Detail *pgdp);
635  GA_VertexGroup *parseVertexGroupsCopy(const char *pattern)
636  { return parseVertexGroupsCopy(pattern, (const GU_Detail *)gdp); }
637 
638  const GA_Group *parseAllGroups(const char *pattern,
639  const GroupCreator &creator,
640  bool allow_numeric = true,
641  bool ordered = false,
643  GA_GroupType bestguess=GA_GROUP_PRIMITIVE);
644  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
645  const GA_Group *parseAllGroups(const char *pattern,
646  GU_Detail *pgdp,
647  int allow_numeric=1,
648  int ordered=1,
650  const GA_Group *parseAllGroups(const char *pattern)
651  { return parseAllGroups(pattern, GroupCreator(gdp, false), true, true); }
652 
653  GA_Group *parseAllGroupsCopy(const char *pattern,
654  const GroupCreator &creator,
655  bool allow_numeric = true,
656  bool ordered = false,
658  GA_GroupType bestguess=GA_GROUP_PRIMITIVE);
659  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function and dont cast away const on input geo)
660  GA_Group *parseAllGroupsCopy(const char *pattern,
661  GU_Detail *pgdp,
662  int allow_numeric=1,
663  int ordered=1,
665  GA_Group *parseAllGroupsCopy(const char *pattern)
666  { return parseAllGroupsCopy(pattern, GroupCreator(gdp, false), true, true); }
667 
668  // Explicitly destroy an adhoc group. Usually this is done on your behalf
669  // internally, after the SOP cooks, but this method allows you to delete
670  // an adhoc group within the cooking methods. Return is 0 if not found.
671  // An adhoc group is created when the SOP groups are parsed, or when you
672  // call createAdhocPrimGroup() or createAdhocPointGroup().
673 
674  int destroyAdhocGroup (const GA_Group *group)
675  { return myGroupParse.destroyAdhocGroup(group); }
677  { myGroupParse.destroyAdhocGroups(); }
679  { myGroupParse.destroyAdhocGroups(g); }
680 
681  // Set the selection based on the given geometry:
682 
683  /// Update the selection object on the detail to match the one for this
684  /// SOP node.
685  SYS_DEPRECATED(16.0)
686  void updateUserSelectionOnDetail();
687 
688  /// Set a specific override selection for this node only. Automatically
689  /// updates the selection object on the detail.
690  SYS_DEPRECATED(16.0)
691  void setNodeSelectionSet(GU_SelectionSetHandle selection_set);
692 
693  SYS_DEPRECATED(16.0)
694  GU_SelectionSetHandle nodeSelectionSet() const;
695 
696  /// Clears the override selection. Automatically updates the selection
697  /// object on the detail.
698  SYS_DEPRECATED(16.0)
699  void clearNodeSelectionSet();
700 
701  /// Copies the cooked selection generated by the SOP to the detail-external
702  /// user selection. If \c context is NULL, then the last successful cook,
703  /// if any, is used.
704  SYS_DEPRECATED(16.0)
705  void copyCookedSelectionToUserSelection(OP_Context *context = 0);
706 
707 public:
708 
710  SYS_DEPRECATED_REPLACE(14.0, "SOP_Node::select(GA_GroupType gtype)")
711  void select(GU_SelectionType stype);
713 
714  void select(GA_GroupType gtype = GA_GROUP_PRIMITIVE);
715 
716  void select(GU_SelectionHandle selection,
717  bool add_to_sel = false);
718 
719  // Select the group. opt use its type as sel type
720  void select(const GA_Group &group, bool use_gtype = true,
721  bool add_to_sel = false);
722 
723  void select(const GEO_Primitive &prim, bool sel_prim = true,
724  bool add_to_sel = false);
725  void selectPrimitive(GA_Offset primoff,
726  bool prim_sel = true,
727  bool add_to_sel = false);
728  void selectPoint(GA_Offset ptoff, bool point_sel = true,
729  bool add_to_sel = false);
730  void selectFrom(const GEO_Primitive &prim, bool sel_prim = true,
731  bool add_to_sel = false);
732  void selectPointsFrom(GA_Offset ptoff, bool point_sel = true,
733  bool add_to_sel = false);
734  void select(const GA_Range &range, bool use_rtype = true,
735  bool add_to_sel = false);
736 
737  // Selects input based on the group supplied and the group type. If
738  // group is not null, then it's type is used, otherwise the group type
739  // is used.
740  void selectInputGroup(const GA_Group *group,
741  GA_GroupType grouptype);
742  // FIXME: Delete this function once it's swept out, because
743  // the int corresponds with PRM_GroupType instead of
744  // GA_GroupType.
745  void selectInputGroup(const GA_Group *group,
746  int grouptype);
747 
748  // If no selection is present, then create a new empty primitive cook
749  // selection group. Otherwise, clear the selection.
750  void clearSelection();
751 
753  SYS_DEPRECATED_REPLACE(14.0, "SOP_Node::clearSelection(GA_GroupType gtype)")
754  void clearSelection(GU_SelectionType stype);
756 
757  /// If the cook selection group is not of the given type, create an empty
758  /// cook selection group of that type. Otherwise, clear the existing cook
759  /// selection group.
760  void clearSelection(GA_GroupType gtype);
761 
762  // Blow away the selection and reinitialize it to 0. Much more radical
763  // than clearSelection(), which leaves behind a clean, empty selection.
764  // This method returns 1 if it had anything to destroy, else 0.
765  bool destroySelection();
766 
767  // Return 1 if selection is enabled, 0 if false.
768  bool selectionEnabled() const
769  {
770  return getHighlight();
771  }
772 
773  bool hasCookedSelection() const
774  {
775  return myHasCookedSelection;
776  }
777 
778  // Copy all the temp selections from the given SOP into this one. All
779  // existing selections on this SOP will be destroyed first. If there are
780  // no temp selections, then the cook selection is copied into a temp
781  // selection.
782  bool copyTempSelections(OP_Context &context, SOP_Node *src);
783 
784  /// Functions to convert between different group type representations.
785  /// When no group type can be guessed, GA_GROUP_INVALID,
786  /// PRM_GROUPTYPE_GUESS, PRM_UVGROUPTYPE_GUESS, or GA_ATTRIB_INVALID
787  /// Will be returned.
788  /// @{
789  static GA_GroupType getGAGroupType(PRM_GroupType prmgrouptype, GA_GroupType guess = GA_GROUP_INVALID);
790  static GA_GroupType getGAGroupType(PRM_UVGroupType prmuvgrouptype, GA_GroupType guess = GA_GROUP_INVALID);
792  static GA_GroupType getGAGroupType(GU_SelectionType guseltype);
794  static GA_GroupType getGAGroupType(GA_AttributeOwner owner);
795  static GA_GroupType getGAGroupType(const char *possiblename, GA_GroupType guess = GA_GROUP_INVALID);
796  static PRM_GroupType getPRMGroupType(GA_GroupType gagrouptype);
797  static PRM_UVGroupType getPRMUVGroupType(GA_GroupType gagrouptype);
799  static GU_SelectionType getGUSelType(GA_GroupType gagrouptype, GU_SelectionType guess = GU_SPrimitive);
801  static GA_AttributeOwner getGroupAttribOwner(GA_GroupType gagrouptype, GA_AttributeOwner guess = GA_ATTRIB_INVALID);
802  static const char *getGroupTypeName(GA_GroupType gagrouptype, const char *guess = "guess");
803  /// @}
804 
805 
806  virtual void resetSimulation () {}
807 
808  virtual int getNetOverviewColor( UT_Color &color ) override;
809 
810  void addInstanceReference(SOP_Node *node);
811  void clearInstanceReference(SOP_Node *node);
812 
813  /// This makes *this an instance of node. It must be called within
814  /// a cookMySop. myGdpHandle is assumed to have an active write lock.
815  /// this->gdp is updated to point to the new gdp. It is assumed
816  /// that clearInstance() has already been called.
817  /// The node that you pass in must be cooked prior to instancing!
818  /// This has occured for free if it was lockInputed. Otherwise,
819  /// one must use getCookedGeoHandle to cook the SOP.
820  void makeInstanceOf(SOP_Node *node, OP_Context &context, int inputidx);
821 
822  /// This makes us shallow copy the given gu_detailhandle.
823  /// We are marked as a preserve request so with our next
824  /// cook we will not re-use this gdp. This should be
825  /// called while cooking - ie, gdp is locked.
826  /// While you can alter gdp afterwards, it is a bad idea as
827  /// you will also alter the source.
828  void makeInstanceOf(GU_ConstDetailHandle gdh);
829 
830  /// A hint to this node that it is about to be cooked at an
831  /// unexpected time so shouldn't reuse the existing GDP.
832  /// Should not be used without understanding the consequences.
833  void makePreserveRequest();
834 
835  virtual void setVisualization(int) {}
836  virtual void setForceCapture(int) {}
837 
838  virtual void getNodeSpecificInfoText(OP_Context &context,
839  OP_NodeInfoParms &iparms) override;
840 
841  /// Fill in tree with this SOP's details
842  virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree,
843  const OP_NodeInfoTreeParms &parms) override;
844  /// Helper class that puts our geometry info into a branch.
845  void fillInfoTreeForGeometry(UT_InfoTree &branch,
846  const OP_NodeInfoTreeParms &parms);
847 
848  /// Return an interface to apply appearance operations. The default
849  /// behaviour is to return a NULL pointer.
850  virtual SOP_ObjectAppearancePtr getObjectAppearance();
851 
852  /// This method has to do with 'fillInfoTreeNodeSpecific()' above. When the
853  /// call to OP_Node::fillInfoTree() completes (which is what called
854  /// fillInfoTreeNodeSpecific()), the UT_InfoTree 'tree' will be parsed and
855  /// displayed in a dialog box by OPUI_OpInfoDialog, at which point, that
856  /// class will want to ask us - which branch of the tree would you like to
857  /// be selected by default when the dialog is displayed for the first time?
858  virtual const char *getDefaultSelectedInfoTreeBranchName() const override;
859 
860  /// Spare data used to determine which input the group menu is associated
861  /// with.
862  /// Because these rely on static initialization, do NOT use,
863  /// use the sparedata functions instead.
868  /// Uses the second input if present, else the first input.
869  /// FIXME: Support for this has only been added to allAttribsMenu.
871 
872  /// Spare data to determine whcih input the group menu is associated
873  /// with.
874  static PRM_SpareData *sparedataFirstInput();
875  static PRM_SpareData *sparedataSecondInput();
876  static PRM_SpareData *sparedataThirdInput();
877  static PRM_SpareData *sparedataFourthInput();
878  static PRM_SpareData *sparedataSecondElseFirstInput();
879 
880  ///Absolute Width
881  virtual fpreal getW() const override;
882  ///Absolute Height
883  virtual fpreal getH() const override;
884 
885 
886  /// Provide a verb interface to this SOP. Verb interfaces are designed
887  /// to ensure thread safety and prevent any persistent storage between
888  /// cooks.
889  virtual const SOP_NodeVerb *cookVerb() const { return 0; }
890 
891 protected:
892  SOP_Node(OP_Network *parent, const char *name, OP_Operator *entry);
893  virtual ~SOP_Node();
894 
895  // We listen to these as our Cache relies on unique ids, so must
896  // know when they are no longer valid.
897  virtual void setUniqueId(int id) override;
898  virtual void clearUniqueId() override;
899 
900  // Remove the adhoc group(s) from the list of adhocs to be deleted when
901  // cooking ends. This way, deletion of the group becomes your
902  // responsibility. You should rarely and cautiously use these methods.
903  // Most of the time you need destroyAdhocGroup[s] instead.
904  // You *MUST* use the parse.*Copy methods to get the adhoc group.
905  // Otherwise, you may delete a group which you don't have ownership of.
906  int removeAdhocGroup (const GA_Group *group)
907  { return myGroupParse.removeAdhocGroup(group); }
909  { myGroupParse.removeAdhocGroups(); }
910 
911  /// This method is called at the conclusion of cooking to notify the gdp
912  /// that it's data has changed. By default, this will call: @code
913  /// gdp->incrementMetaCacheCount();
914  /// gdp->cacheDirty();
915  /// @endcode
916  /// Sub-classes may choose to send out more surgical cache changes on the
917  /// gdp (member data).
918  virtual void markDetailDirty();
919 
920  // Protected virtuals:
921  //
922  // "cookMe" is where the actual work is done.
923  // The error is returned (OP_ERR_NONE on success).
924  //
925  virtual OP_ERROR cookMe (OP_Context &context) override;
926  virtual OP_ERROR bypassMe (OP_Context &context,
927  int &copied_input) override;
928 
929  virtual OP_ERROR cookMySop(OP_Context &context) = 0;
930 
931  /// This is meant to be called within cookMySop() if all you
932  /// want to do is invoke the verb returned by cookVerb().
933  OP_ERROR cookMyselfAsVerb(OP_Context &context);
934 
935  // The interests node is the node to get an extra input on whatever
936  // actual real data node is at the source of this chain.
937  virtual GU_DetailHandle cookMySopOutput(OP_Context &context, int outputidx, SOP_Node *interests);
938  virtual OP_ERROR cookMyGuide1(OP_Context &context);
939  virtual OP_ERROR cookMyGuide2(OP_Context &context);
940  virtual OP_ERROR cookMyGuideList(OP_Context &context,
942 
943  virtual OP_ERROR pubCookInputGroups(OP_Context &context,
944  int alone = 0) override;
945 
946  void notifyGroupParmListeners(
947  int parm_index, int group_type_index,
948  const GU_Detail *pgdp, const GA_Group *group);
949 
950  /// The cookInput.+Groups functions are helper functions that look at
951  /// your Group Name and Group Type parameters (the offsets for which
952  /// are passed in parm_index, for Group Name, and group_type_index,
953  /// for group_type), evaluate them, and then call parse.+Group on that
954  /// group name. For every method other than cookInputAllGroups,
955  /// group_type_index is used only to determine whether the parm is dirty.
956  /// The pointer group is set as a return value.
957  /// If alone is true, we are cooking for a selector, and can't assume that
958  /// our gdp is valid (because it might not have been constructed by now).
959  /// If allow_reference is true, the group returned may not be modified.
960  /// If fetchgdp is true and alone is true, these new groups will be
961  /// created on the input_index-th input (because the gdp isn't constructed
962  /// yet).
963  /// If fetchgdp is true and alone is false, false, groups will be
964  /// constructed on the current gdp.
965  /// If fetchgdp is false, you must supply a gdp to create groups on in
966  /// the paramerer pgdp.
967  OP_ERROR cookInputPrimitiveGroups(OP_Context &context,
968  const GA_PrimitiveGroup *&group,
969  bool alone = false, bool do_selection = true,
970  int parm_index = 0,
971  int group_type_index = -1,
972  bool allow_reference = true,
973  bool ordered = false,
974  bool detached = true,
975  int input_index = 0);
976  OP_ERROR cookInputPrimitiveGroups(OP_Context &context,
977  const GA_PrimitiveGroup *&group,
978  bool alone, bool do_selection,
979  int parm_index,
980  int group_type_index,
981  bool allow_reference,
982  bool ordered,
983  const GroupCreator &creator);
984  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo and be careful since defaults have changed)
985  virtual OP_ERROR cookInputPrimitiveGroups(OP_Context &context,
986  const GA_PrimitiveGroup *&group,
987  GU_DetailGroupPair &detail_group_pair,
988  int alone = 0, bool do_selection = true,
989  int input_index = 0, int parm_index = 0,
990  int group_type_index = -1,
991  bool allow_reference = true,
992  bool fetchgdp = true,
993  GU_Detail *pgdp = NULL);
994 
995  /// See cookInputPrimitiveGroups.
996  OP_ERROR cookInputPointGroups(OP_Context &context,
997  const GA_PointGroup *&group,
998  bool alone = false, bool do_selection = true,
999  int parm_index = 0,
1000  int group_type_index = -1,
1001  bool allow_reference = true,
1002  bool ordered = false,
1003  bool detached = true,
1004  int input_index = 0);
1005  OP_ERROR cookInputPointGroups(OP_Context &context,
1006  const GA_PointGroup *&group,
1007  bool alone, bool do_selection,
1008  int parm_index,
1009  int group_type_index,
1010  bool allow_reference,
1011  bool ordered,
1012  const GroupCreator &creator);
1013  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo and be careful since defaults have changed)
1014  virtual OP_ERROR cookInputPointGroups(OP_Context &context,
1015  const GA_PointGroup *&group,
1016  GU_DetailGroupPair &detail_group_pair,
1017  int alone = 0, bool do_selection = true,
1018  int input_index = 0, int parm_index = 0,
1019  int group_type_index = -1,
1020  bool allow_reference = true,
1021  bool fetchgdp = true,
1022  GU_Detail *pgdp = NULL);
1023 
1024  /// See cookInputPrimitiveGroups.
1025  OP_ERROR cookInputEdgeGroups(OP_Context &context,
1026  const GA_EdgeGroup *&group,
1027  bool alone = false, bool do_selection = true,
1028  int parm_index = 0,
1029  int group_type_index = -1,
1030  bool allow_reference = true,
1031  int input_index = 0);
1032  OP_ERROR cookInputEdgeGroups(OP_Context &context,
1033  const GA_EdgeGroup *&group,
1034  bool alone, bool do_selection,
1035  int parm_index,
1036  int group_type_index,
1037  bool allow_reference,
1038  const GU_Detail *pgdp);
1039  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo and be careful since defaults have changed)
1040  virtual OP_ERROR cookInputEdgeGroups(OP_Context &context,
1041  const GA_EdgeGroup *&group,
1042  GU_DetailGroupPair &detail_group_pair,
1043  int alone = 0, bool do_selection = true,
1044  int input_index = 0, int parm_index = 0,
1045  int group_type_index = -1,
1046  // JML: I do not know why Edge Groups
1047  // used Copy instead of the reference version.
1048  // They are left like this so as to not cause
1049  // problems unforeseen.
1050  bool allow_reference = false,
1051  bool fetchgdp = true,
1052  GU_Detail *pgdp = NULL);
1053 
1054  /// See cookInputPrimitiveGroups. Also, is_default_prim only affects
1055  /// cases when we're not able to guess the type of groups; in those
1056  /// cases, we try again with primitive groups if is_default_prim is
1057  /// true, and point groups otherwise.
1058  OP_ERROR cookInputAllGroups(OP_Context &context,
1059  const GA_Group *&group,
1060  bool alone = false, bool do_selection = true,
1061  int parm_index = 0,
1062  int group_type_index = -1,
1063  GA_GroupType grouptype = GA_GROUP_INVALID,
1064  bool allow_reference = true,
1065  bool is_default_prim = true,
1066  bool ordered = false,
1067  bool detached = true,
1068  int input_index = 0);
1069  OP_ERROR cookInputAllGroups(OP_Context &context,
1070  const GA_Group *&group,
1071  bool alone, bool do_selection,
1072  int parm_index,
1073  int group_type_index,
1074  GA_GroupType grouptype,
1075  bool allow_reference,
1076  bool is_default_prim,
1077  bool ordered,
1078  const GroupCreator &creator);
1079  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo and be careful since defaults have changed)
1080  virtual OP_ERROR cookInputAllGroups(OP_Context &context,
1081  const GA_Group *&group,
1082  GU_DetailGroupPair &detail_group_pair,
1083  int alone = 0, bool do_selection = true,
1084  int input_index = 0, int parm_index = 0,
1085  int group_type_index = -1,
1086  bool allow_reference = false,
1087  bool is_default_prim = true,
1088  bool fetchgdp = true,
1089  GU_Detail *pgdp = NULL);
1090 
1091  /// Parse the input group specified by groupname, of type grouptype,
1092  /// in detail gdp. If allow_reference is true, this group cannot be
1093  /// later modified. If is_default_prim is true, if the group's type cannot
1094  /// be guessed, we'll try with a primitive group; otherwise, we'll try
1095  /// with a point group.
1096  const GA_Group *parseInputGroup(const UT_String &groupname,
1097  GA_GroupType grouptype, const GroupCreator &creator,
1098  bool allow_reference, bool is_default_prim,
1099  bool ordered=false);
1100  const GA_Group *parseInputGroup(const UT_String &groupname,
1101  int grouptype, GU_Detail *gdp,
1102  bool allow_reference, bool is_default_prim);
1103 
1104  /// Retrieve a list of the local variables visible to this node.
1105  /// This list is unsorted and may contain duplicates.
1106  virtual void buildLocalVarNames(UT_StringArray &out_vars) override;
1107 
1108 private:
1109  /// Helper function for cookInput.+Groups. You shouldn't need to use it.
1110  OP_ERROR cookInputGroupsPrologue(OP_Context &context,
1111  bool alone, int input_index, bool detached,
1112  GroupCreator &creator);
1113  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function)
1114  OP_ERROR cookInputGroupsPrologue(OP_Context &context, bool fetchgdp,
1115  bool alone, int input_index,
1116  GU_Detail *&pgdp);
1117 
1118  /// Helper function for cookInput.+Groups. You shouldn't need to use it.
1119  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator version of function)
1120  void cookInputGroupsEpilogue(int parm_index, int group_type_index,
1121  const GU_Detail *pgdp, const GA_Group *group,
1122  int input_index, bool fetchgdp, bool alone);
1123 
1124 protected:
1125  virtual void inputConnectChanged(int which_input) override;
1126 
1127 //_________________________________________________________________________
1128 //
1129 // Some very useful methods used in cooking SOPs, convenience if you will
1130 //_________________________________________________________________________
1131 //
1132 
1133  // Note that the context parameter is unused!
1135  { return inputGeo(index); }
1136  const GU_Detail *inputGeo(int index) const;
1137  GU_DetailHandle inputGeoHandle(int index) const;
1138 
1139 //_________________________________________________________________________
1140 //
1141 // Convenience Error methods...
1142 //_________________________________________________________________________
1143 //
1144 public:
1145  void addError(int code, const char *msg = 0)
1146  { getLockedErrorManager()->addError(SOP_OPTYPE_NAME,
1147  code, msg); }
1148  void addMessage(SOP_ErrorCodes code, const char *msg = 0)
1149  { getLockedErrorManager()->addMessage(SOP_OPTYPE_NAME,
1150  code, msg); }
1151  void addWarning(SOP_ErrorCodes code, const char *msg = 0)
1152  { getLockedErrorManager()->addWarning(SOP_OPTYPE_NAME,
1153  code, msg); }
1154  void addFatal(SOP_ErrorCodes code, const char *msg = 0)
1155  { getLockedErrorManager()->addFatal(SOP_OPTYPE_NAME,
1156  code, msg); }
1157  void addSystemError(const char *msg = 0)
1158  { getLockedErrorManager()->systemError(msg);}
1160  const char *msg = 0)
1161  { getLockedErrorManager()->commonError(what, msg);}
1163  const char *msg = 0)
1164  { getLockedErrorManager()->commonWarning(what, msg);}
1165 
1166 protected:
1167  //
1168  // Methods for dealing with groups in SOPs
1169 
1170  /// We want these public as we it is perfectly fine to use them in
1171  /// static parm templates. This occurs, for example, when instancing
1172  /// multiparms.
1173 public:
1174  static PRM_ChoiceList allGroupMenu; // All the groups
1175  static PRM_ChoiceList groupMenu; // Prim and point groups
1179  static PRM_ChoiceList edgePointGroupMenu; // Edge and point groups
1181  static PRM_ChoiceList primNamedGroupMenu; // Named prim grps only
1182  static PRM_ChoiceList pointNamedGroupMenu; // Named pt groups only
1183  static PRM_ChoiceList edgeNamedGroupMenu; // Named edge groups only
1184  static PRM_ChoiceList vertexNamedGroupMenu;// Named vertex groups only
1189 
1195 
1198 
1199  /// Returns spare data that adds a "group select" button which runs a
1200  /// python script to invoke soputils.selectGroupParm. The group_type
1201  /// should be used if only one group type is supported by the group parm.
1202  /// The group_type_parm value should be used (with group_type set to
1203  /// GA_GROUP_INVALID) if there is a separate menu parameter to specify
1204  /// the group type. The input_index indicates which input of the SOP
1205  /// the group refers to. The merge_spare_data can contain any other
1206  /// PRM_SpareData that you want on the parameter (the most common being
1207  /// "&SOP_Node::theSecondInput" to control the input used by the
1208  /// SOP_Node::primGroupMenu, SOP_Node::pointGroupMenu, or other SOP_Node
1209  /// standard parameter group menus.
1210  /// If the SOP requires or supports multi-stage selection, then it's
1211  /// possible to show previous selections during this picking sessions to
1212  /// assist the user. To do this, a comma-separated list of group types /
1213  /// group parm names can be given with assoc_groups
1214  /// (e.g. "point my_point_group_parm, edge my_edge_group_parm").
1216  {
1217  /// AUTO: Use any bound selectors to determine whether the selection
1218  /// should be ordered or not.
1219  AUTO,
1220  /// FORCE_UNORDERED: Force an unordered selection.
1221  FORCE_UNORDERED,
1222  /// FORCE_ORDERED: Force an ordered selection.
1223  FORCE_ORDERED
1224  };
1225  static PRM_SpareData *getGroupSelectButton(
1226  GA_GroupType group_type,
1227  const char *group_type_parm = NULL,
1228  int input_index = 0,
1229  PRM_SpareData *merge_spare_data = NULL,
1230  const char *assoc_groups = NULL,
1231  GroupSelectAsOrdered ordered =
1232  GroupSelectAsOrdered::AUTO);
1233  static PRM_SpareData *getGroupSelectButton(
1234  GA_GroupMaskType group_mask,
1235  const char *group_type_parm = NULL,
1236  int input_index = 0,
1237  PRM_SpareData *merge_spare_data = NULL,
1238  const char *assoc_groups = NULL,
1239  GroupSelectAsOrdered ordered =
1240  GroupSelectAsOrdered::AUTO);
1241 
1242 protected:
1243  /// Open a tree chooser populated by the values from the @c path_attrib
1244  /// string values so the user can select primitives. The @c stringparm
1245  /// parameter is evaluated to choose the selected primitives, and the
1246  /// result is written back to the @c stringparm when the user makes their
1247  /// selection. If the @c path_attrib doesn't exist, then optionally,
1248  /// packed primitive intrinsic names can be used to populate the tree.
1249  void pickPrimitivesUsingPathAttribute(
1250  const GU_Detail &gdp,
1251  const GA_Range &srcrange,
1252  const char *stringparm,
1253  fpreal t,
1254  const char *path_attrib="path",
1255  bool use_packed_names=true);
1256  /// Pick assuming that the range is a full range of primitives. This
1257  /// method gets the primitive range from the specified @c input_number.
1258  void pickPrimitivesUsingPathAttribute(
1259  const char *stringparm,
1260  fpreal t,
1261  int input_number=0,
1262  const char *path_attrib="path",
1263  bool use_packed_names=true);
1264  /// Create a GA_Range containing the primitives specified by the values in
1265  /// the @c pickedstring. The primitives are selected from the @c
1266  /// srcrange in the given @c gdp.
1267  static GA_Range getPickedRangeUsingPathAttribute(
1268  const GU_Detail &gdp,
1269  const GA_Range &srcrange,
1270  const char *pickedstring,
1271  const char *path_attrib="path",
1272  bool use_packed_names=true);
1273 
1274  /// WARNING: The groups returned are const and should not be modified
1275  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo)
1276  int parseGroups(const char *pattern,
1277  GU_Detail *gdp,
1278  const GA_PrimitiveGroup *&prim,
1279  const GA_PointGroup *&points,
1280  bool strict = false);
1281 
1282  SYS_DEPRECATED_HDK_REPLACE(15.0,GroupCreator or other version of function and dont cast away const on input geo)
1283  int parseGroupsCopy(const char *pattern,
1284  GU_Detail *gdp,
1285  GA_PrimitiveGroup *&prim,
1286  GA_PointGroup *&points,
1287  GA_EdgeGroup *&edges,
1288  int unify,
1289  bool strict = false,
1290  GA_GroupType numeric_type
1291  = GA_GROUP_PRIMITIVE);
1292 
1293 public:
1294  /// Method to help fill in the menu entries representing attributes
1295  /// It will iterate though the attributes of the 'dictionary' supplied
1296  /// from the input 'input_index'. The 'approve' filter callback is applied
1297  /// (if present) and if it returns ture for an attribute, this attribute
1298  /// is appended to the 'menu_entries'. If not present, all attributes
1299  /// are appended. The number of entries appended does not exceed
1300  /// 'max_menu_size' (including the terminating sentinel). 'menu_entries' are
1301  /// sorted alphabetically and the function returns the number of entries
1302  /// appended (excluding the terminating sentinel).
1303  int fillAttribNameMenu(PRM_Name *menu_entries,
1304  int max_menu_size,
1305  GA_AttributeOwner dictionary,
1306  int input_index,
1307  bool (*approve)(const GA_Attribute*,void*)=NULL,
1308  void *approve_data = NULL);
1309 
1310  /// utility method for pruning the duplicate entries in a sorted menu
1311  static void removeMenuDuplicates(PRM_Name *menuEntries, int size);
1312 
1313  /// Obtains pointers to the vertex, point, and primitive vector attributes.
1314  /// Only vector attributes are considered.
1315  /// NB: it needs access to the gdp, so use it only in the cook methods
1316  void getVectorAttribs( const char * attrib_names,
1317  UT_Array<GA_Attribute *> &vertex_attribs,
1318  UT_Array<GA_Attribute *> &point_attribs,
1319  UT_Array<GA_Attribute *> &prim_attribs);
1320  static void getVectorAttribs( GU_Detail *gdp,
1321  const char * attrib_names,
1322  UT_Array<GA_Attribute *> &vertex_attribs,
1323  UT_Array<GA_Attribute *> &point_attribs,
1324  UT_Array<GA_Attribute *> &prim_attribs);
1325 
1326  /// parses the vector attrib parameter and fills attribs array
1327  static void getVectorAttribs(const GA_AttributeDict &dict,
1328  const char * attrib_string,
1329  UT_Array<GA_Attribute *> &attribs,
1330  UT_String &bad_attribs);
1331 
1332 protected:
1333 
1334  /// Drag-n-drop receiver functions
1335 
1336  virtual int acceptDragDrop(DD_Source &src,
1337  const char *l) override;
1338  virtual int testDragDrop(DD_Source &src) override;
1339  virtual void getDragDropChoice(DD_Source &src,
1340  DD_ChoiceList &choices) override;
1341 
1342  typedef void (SOP_Node::*GroupOperation)(const GA_Group *, void *);
1343 
1344  /// Perform an operation on each group matching the specified mask.
1345  int forEachGroupMatchingMask(
1346  const char *pattern,
1347  GroupOperation operation,
1348  void *data,
1349  GA_GroupType grpType,
1350  const GEO_Detail *pgdp=nullptr,
1351  bool maintainorder=false);
1352 public:
1353  static int invokeForEachGroupMatchingMask(
1354  const GU_Detail *gdp,
1355  const char *pattern,
1356  GA_GroupType grpType,
1357  const std::function<void(const GA_Group *)> &operation,
1358  bool maintainorder);
1359 protected:
1360 
1361  /// Take an optional group and subdivide it into smaller groups as
1362  /// input to operation
1363 
1364  void subdividePrimitiveGroup(
1365  GroupOperation operation,
1366  const GA_PrimitiveGroup *group,
1367  void *data, int optype,
1368  int opstep, const char *oplabel,
1369  const GU_Detail *gdp=0);
1370  void subdivideMixPrimitiveGroup(
1371  GroupOperation operation,
1372  const GA_PrimitiveGroup *group,
1373  void *data, int optype,
1374  int opstep, const char *oplabel,
1375  GU_Detail *gdp=0);
1376  void subdividePointGroup(
1377  GroupOperation operation,
1378  const GA_PointGroup *group,
1379  void *data, int optype,
1380  int opstep, const char *oplabel,
1381  GU_Detail *gdp=0);
1382 
1383 
1384  /// Create an adhoc (internal) group and add it to the list of adhoc groups.
1385  /// The group will be deleted for you after cooking.
1387  const char *p="adhoc")
1388  { return myGroupParse.createPrimitiveGroup(geo, p); }
1390  const char *p="adhoc")
1391  { return myGroupParse.createPointGroup(geo, p); }
1393  const char *p="adhoc")
1394  { return myGroupParse.createEdgeGroup(geo, p); }
1396  const char *p="adhoc")
1397  { return myGroupParse.createVertexGroup(geo, p); }
1399  {
1401  myGroupParse.appendAdhocGroup(group, true);
1402  return group;
1403  }
1405  {
1406  GA_PointGroup *group = geo.newDetachedPointGroup();
1407  myGroupParse.appendAdhocGroup(group, true);
1408  return group;
1409  }
1411  {
1412  GA_EdgeGroup *group = geo.newDetachedEdgeGroup();
1413  myGroupParse.appendAdhocGroup(group, true);
1414  return group;
1415  }
1417  {
1418  GA_VertexGroup *group = geo.newDetachedVertexGroup();
1419  myGroupParse.appendAdhocGroup(group, true);
1420  return group;
1421  }
1423  {
1424  return myGroupParse.createBreakpointGroup(geo);
1425  }
1426 
1427  /// This is only called when the instance flag is set.
1428  /// The gdp will be modified shortly after this function is called. After
1429  /// the return, the gdp member data should contain an empty (or full)
1430  /// GU_Detail. Setting the duplicate flag will duplicate the current gdp
1431  /// in the new one.
1432  /// This used to require one to derive from it to clear references
1433  /// to myInstanceOp. This is now handled at this level.
1434  void clearInstance(int duplicate = 0);
1435  /// True if another SOP has an instance of our geometry.
1436  bool hasInstances();
1437  /// Counts the number SOPs that are descended instances of our geometry.
1438  int countInstances();
1439  /// Clears SOPs with descended instances of our geometry.
1440  void clearAllInstances();
1441 
1442  /// In between cooks, the gdp pointer might be reset by the cooking engine
1443  /// (eg. if its gdp was instanced by some other SOP). If this function
1444  /// returns true, then it will be reset to an empty gdp. If this function
1445  /// returns false, then the contents of the old gdp will be duplicated into
1446  /// the new gdp. SOPs performing simulation which rely on the cooked
1447  /// contents of its gdp from the last frame should override this to return
1448  /// false.
1449  virtual bool shouldResetGeoToEmpty() const { return true; }
1450 
1451  /// The duplicate*Source methods take a context parameter but do not
1452  /// use it for anything.
1453  /// The specified input must already be locked. The context used to
1454  /// lock the input is the context used for duplication.
1455  OP_ERROR duplicateSource(unsigned index, OP_Context &context,
1456  GU_Detail *gdp, bool clean=true);
1458  {
1459  return duplicateSource(index, context, gdp, true);
1460  }
1461 
1462  /// Only duplicates the source if the source has changed. Otherwise,
1463  /// it copies the points from the source to our gdp. It's meant to be
1464  /// used by most deformer SOPs, which simply transform the points and
1465  /// or the primitives. If wattrib is true, we check if any transforming
1466  /// primitive or vertex attributes are present and if any point attribs
1467  /// exist, and copy those too.
1468  ///
1469  /// NOTE: Do not use this if you are creating or destroying point
1470  /// attributes.
1471  ///
1472  /// NOTE: While this takes a gdp to operate on, if it is not the SOP's
1473  /// own gdp, it will just do a duplicateSource.
1474  OP_ERROR duplicatePointSource(unsigned index, OP_Context &ctx,
1475  GU_Detail *gdp, bool clean = true,
1476  bool wattrib = true,
1477  bool *fully = 0);
1479  {
1480  return duplicatePointSource(index, ctx, gdp, 1,
1481  true, 0);
1482  }
1483 
1484  /// This copies all the point positions from the given input gdp into
1485  /// the current one.
1486  /// @pre input_i has already been locked via lockInput
1487  bool copyPointPosFromSource(
1488  unsigned input_i, OP_Context &ctx);
1489 
1490  /// @brief Only duplicates the source if the source has changed since the
1491  /// last call to this method.
1492  OP_ERROR duplicateChangedSource(unsigned idx, OP_Context &ctx,
1493  int *changed = 0, bool force=false);
1494 
1495  /// Only duplicates primitives in primgroup from src_gdp to dest_gdp
1496  OP_ERROR duplicateSourceGroup(const GU_Detail *src_gdp,
1497  const GA_PrimitiveGroup *primgroup,
1498  GU_Detail *dest_gdp=0);
1499 
1500  /// Forces duplicateChangedSource() to do the duplication on its next call.
1501  void resetChangedSourceFlags();
1502 
1503  /// @brief Checks if a duplication will occur on the next call to
1504  /// duplicateChangedSource().
1505  ///
1506  /// Similar to useInputSource() except it doesn't affect the flags. It's
1507  /// used to simply query whether the given input has changed. Returns false
1508  /// if there's errors on the input. Upon return, @c changed is updated.
1509  OP_ERROR checkChangedSourceFlags(unsigned idx, OP_Context &ctx,
1510  int *changed);
1511 
1512  /// @brief Mark the given input as used for cooking by this node.
1513  ///
1514  /// This updates source flags to mark the input as now clean, returning
1515  /// whether the input has changed since the last time this function was
1516  /// called. If force is true, then we treat the input as always dirty.
1517  /// Returns false if the input has errors.
1518  /// @note duplicateChangedSource() calls this function.
1519  bool useInputSource(unsigned idx, bool &changed, bool force)
1520  {
1521  return myInputChangeHelper.useInput(
1522  *this, idx, changed, force);
1523  }
1524 
1525  virtual void deleteCookedData() override;
1526  virtual int deleteNodeData(void *) override;
1527 
1528  /// Convenience wrappers for several common pasting operations. The last
1529  /// method destroys both groups:
1531  {
1532  return gdp->getPastedSurfaces("_sop_all_pasted_");
1533  }
1535  {
1536  return gdp->getPastedSurfaces(used,
1537  "_sop_all_pasted_",
1538  "_sop_used_pasted_");
1539  }
1541  const GA_PrimitiveGroup *all,
1542  GA_PrimitiveGroup *used)
1543  {
1544  gdp->updatePastedDisplacement(ptoff, all, used);
1545  }
1547  {
1548  // return 1 if pasted surfaces found
1549  return gdp->updatePastedDisplacements();
1550  }
1552  GA_PrimitiveGroup *used)
1553  {
1554  // all and used are deleted if they exist
1555  return gdp->updatePastedDependents(all, used);
1556  }
1557 
1558  /// Methods for dealing with group centroid
1559  void convertPivotAboutGroupCentroid(
1560  PRM_Parm &grppivot_parm,
1561  int pivot_parm_idx,
1562  const UT_Vector3 *centroid = 0);
1563  void convertPivotAboutGroupCentroid(
1564  PRM_Parm &grppivot_parm,
1565  const char *pivot_parm_name,
1566  const UT_Vector3 *centroid = 0);
1567 
1568 
1569  /// subclasses override this to return the group centroid if they support
1570  /// it.
1571  virtual bool getGroupCentroid(OP_Context & /*context*/,
1572  UT_Vector3 & /*centroid*/)
1573  { return false; }
1574 
1575  //
1576  // I/O methods
1577  //
1578  virtual OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags,
1579  const char *pathPrefix,
1580  const UT_String &name_override = UT_String()) override;
1581  virtual bool load(UT_IStream &is, const char *extension,
1582  const char *path=0) override;
1583 
1584  void refreshGdp();
1585 
1586 
1587  //
1588  // Data for the SOP class
1589  //
1590 
1591  /// The gdp handle provides a indirect reference to the current
1592  /// gdp of this SOP.
1594 
1595  /// During cooks, myGdpHandle is writelocked and stored in the
1596  /// gdp variable. This is to provide backwards compatibility.
1597  /// The gdp variable should not be trusted or accessed elsewhere.
1599  SOP_Guide *myGuide1; // primary guide geometry
1600  SOP_Guide *myGuide2; // secondary guide geometry
1602 
1603 private:
1604  //
1605  // These virtuals are methods that nobody should override...
1606  //
1607  // I/O methods
1608  //
1609  virtual OP_ERROR saveIntrinsic(std::ostream &os,
1610  const OP_SaveFlags &flags) override;
1611 
1612  virtual bool loadPacket(UT_IStream &is,
1613  short class_id, short sig,
1614  const char *path=0) override;
1615  virtual bool loadPacket(UT_IStream &is, const char *token,
1616  const char *path=0) override;
1617 
1618  virtual void clearAndDestroy() override;
1619 
1620  virtual int saveCookedData(const char *,
1621  OP_Context &) override;
1622  virtual int saveCookedData(std::ostream &os,
1623  OP_Context &,
1624  int binary = 0) override;
1625  virtual bool loadCookedData(UT_IStream &is,
1626  const char *path=0) override;
1627 
1628  /// loadHardCookedData is just like loadCookedData, except it doesn't
1629  /// check if this SOP is softlocked. Use it only if you know you are
1630  /// loading hardlocked data (as in SOP_UndoModel)
1631  bool loadHardCookedData(UT_IStream &is, const char *path=0);
1632 
1633  virtual const char *getFileExtension(int binary) const override;
1634 
1635  int softLockable(const GU_Detail &unmodelled_gdp,
1636  const GU_Detail &modelled_gdp) const;
1637  /// take a snapshot of the current gdp and stores the soft lock data.
1638  /// copies the previous slock data to the given reference (so caller
1639  /// can use it for undo)
1640  /// returns 1 on success, 0 otherwise
1641  int storeSoftLockData(OP_Context &context, int prev_lock,
1642  SOP_SoftLockData *old_slockdata=0);
1643 
1644  sopVisualizeCallback *myVisualizeCallback;
1645  void *myVisualizeCallbackData;
1646 
1647 public:
1648 
1649  // compact the weight data of an index pair attribute
1650  static void compactIndexPair(GA_Attribute *attrib);
1651 
1652 public:
1653  /// Do not use this function! Using it will likely cause crashes.
1654  virtual void unloadDataHack();
1655 
1656  virtual bool unloadData() override;
1657 
1658  /// Returns the amount of memory owned by this node, *NOT* including
1659  /// any cooked geometry.
1660  virtual int64 getMemoryUsage(bool inclusive) const override;
1661 
1662  /// Returns the amount of memory used by this SOP, that will
1663  /// be unloaded by an unload call. Baseclass defaults to
1664  /// returning the GDP's data.
1665  virtual int64 getLoadedMemoryUsage() const;
1666 
1667  /// Returns whether this node currently has cooked data or not.
1668  bool isLoaded() const override;
1669 
1670  /// Returns if the sop cache manager will allow unloading.
1671  bool shouldUnload() const;
1672 
1673  /// Convenience method to prepare newly allocated GU_Detail objects to
1674  /// act as the output.
1675  static GU_Detail *prepNewDetail(GU_Detail *gdp);
1676 
1677 private:
1678  OP_InputChangeHelper myInputChangeHelper;
1679 
1680  /// We store all locked inputs in this list. We can then allow
1681  /// the same source node to be cooked with different contexts
1682  /// and let copy on write semantics avoid problems.
1683  /// Any non-null handle here has PreserveRequest set and should
1684  /// have it removed before removing.
1685  UT_ValArray<GU_DetailHandle *> myInputGeoHandles;
1686 
1687  GOP_Manager myGroupParse;
1688 
1689  friend class SOP_UndoModel; // needs access to gdp
1690  friend class SOP_CacheManager; // needs access to handle.
1691  friend class SOP_CacheData; // needs access to handle.
1692  friend class sop_AttributeEvaluator; // needs access to local var info
1693 
1694  //
1695  // Private data
1696  //
1697  SOP_SoftLockData *mySoftLockData;
1698 
1699  bool myHasCookedSelection;
1700 
1701  /// the capture override flag is used to indicate wheter the SOPs should
1702  /// use their capture parameters or cook capture geometry. (e.g.,
1703  /// SOP_CaptureRegion). This flag is mirrored from OBJ_Bone, which
1704  /// allows to view bones and capture region in their capture configuration
1705  static bool theGlobalCaptOverride;
1706 
1707  UT_Lock myInstancingOpsLock;
1708  UT_Set<int> myInstancingOps;
1709  int myInstanceOp; // Which op we are instancing.
1710 
1711 public:
1712  // This method needs to be public so HOM can flag an expression as needing
1713  // corresponding to local variables.
1715  { myUsesSOPLocalVar = true; }
1716 
1717  sop_AttributeEvaluator *createAttributeEvaluator(const char *attribname);
1718 protected:
1719  /// Local variable items:
1723 
1724  /// Tracks if any expression has triggered a local variable,
1725  /// like $PT, etc. If this is false, it is safe to only
1726  /// evaluate the parm once for all subtypes.
1727  /// The higher level code is expected to clear this flag, evaluate their
1728  /// relevant parms, and then test this flag.
1730 private:
1731  // myFlagUnused used to be myLocalVarActive, which has been moved down to
1732  // OP_Node. It's still here to avoid breaking HDK binary compatibility.
1733  bool myFlagUnused;
1734  const GU_Detail *myCurGdp[2];
1735  GU_DetailHandle myCurGdh[2];
1736 
1737  /// This is the selection set we use when the footprint flag is on.
1738  GU_SelectionSetHandle myFootprintSelectionSet;
1739 
1740  /// This is a complete override for all selection sets. Used temporarily
1741  /// by selectors.
1742  GU_SelectionSetHandle mySelectionSetOverride;
1743 
1744 protected:
1745  GA_Offset myCurVtxOff[2];
1746  int myCurVtxNum[2];
1747  GA_Offset myCurPtOff[2];
1748  GA_Offset myCurPrimOff[2];
1749  int myCurBuiltPtBox[2];
1750  UT_BoundingBox myCurPtBox[2];
1751  int myCurBuiltPrimBox[2];
1752  UT_BoundingBox myCurPrimBox[2];
1753 
1754  int myCurGdpVal; // Which gdp is being traversed
1755 
1756  /// Cached values so we can tell if we have to rebuild.
1759  /// This is all the old attribute information, one for each of the
1760  /// dictionary types... If this (including the order) matches the
1761  /// new attribute data, no offsets will have changed.
1762  UT_Array<sop_attribRef> myAttribCache[2][4];
1763  UT_String myVarMapCache[2];
1764  int myAttribCacheOffsetGdpId[2];
1765  int myAttribCacheOffsetMetaCacheCount[2];
1766  unsigned int myAttribCacheTotalDictSize[2];
1767  /// Stores the @ cache lookups generated JIT.
1769 
1770  /// Stores the parms & cache for old-style node cooking of verb
1771  /// based nodes.
1774  friend class SOP_NodeVerb;
1775  friend class SOP_NodeParms;
1776  friend class sop_NodeInputs;
1777 };
1778 
1779 /// Function to get a list of template arrays containing parm names that must
1780 /// be reserved when compiling VEX SOPs.
1781 SOP_API extern void
1783 
1784 #endif
static PRM_ChoiceList primGroupMenu
Definition: SOP_Node.h:1176
virtual bool usesFootprint() const override
Definition: SOP_Node.h:164
GA_VertexGroup * parseVertexGroupsCopy(const char *pattern)
Definition: SOP_Node.h:635
GA_PointGroup * newDetachedPointGroup() const
Definition: GA_Detail.h:1257
int curVertexNum(int index) const
Definition: SOP_Node.h:343
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
GA_VertexGroup * createAdhocVertexGroup(GU_Detail &geo, const char *p="adhoc")
Definition: SOP_Node.h:1395
GA_PrimitiveGroup * getPastedSurfaces()
Definition: SOP_Node.h:1530
static PRM_ChoiceList allGroupMenu
Definition: SOP_Node.h:1174
static PRM_ChoiceList vertexTextureCoordMenu
Definition: SOP_Node.h:1197
static PRM_SpareData theFourthInput
Definition: SOP_Node.h:867
GLenum GLint * range
Definition: glcorearb.h:1924
virtual const SOP_NodeVerb * cookVerb() const
Definition: SOP_Node.h:889
#define SOP_Guide
Definition: SOP_Guide.h:17
#define SYS_DEPRECATED(__V__)
GA_StorageClass myStorageClass
Definition: SOP_Node.h:91
GA_ROAttributeRef myOffset
Definition: SOP_Node.h:87
const GA_Group * parseAllGroups(const char *pattern)
Definition: SOP_Node.h:650
GA_Offset curVertex(int local_var_gdp_index) const
Definition: SOP_Node.h:349
GA_PointGroup * createAdhocPointGroup(const GEO_Detail &geo)
Definition: SOP_Node.h:1404
static PRM_ChoiceList namedPrimsMenu
Definition: SOP_Node.h:1185
static PRM_ChoiceList namedVolumesGlobMenu
Definition: SOP_Node.h:1188
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
#define SYS_VISIBILITY_EXPORT
GA_StorageClass
Definition: GA_Types.h:68
UT_StringMap< sop_AttributeEvaluator * > myAttributeEvaluatorCache
Stores the @ cache lookups generated JIT.
Definition: SOP_Node.h:1768
#define SYS_DEPRECATED_PUSH_DISABLE()
const GA_PrimitiveGroup * parsePrimitiveGroups(const char *pattern)
Definition: SOP_Node.h:554
static PRM_ChoiceList allAttribMenu
Definition: SOP_Node.h:1190
GA_AttributeOwner myDictionary
Definition: SOP_Node.h:92
#define SYS_DEPRECATED_POP_DISABLE()
GLuint start
Definition: glcorearb.h:474
GLuint color
Definition: glcorearb.h:1260
virtual OP_OpTypeId getOpTypeID() const =0
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GroupSelectAsOrdered
Definition: SOP_Node.h:1215
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
void destroyAdhocGroups(const GU_Detail *g)
Definition: SOP_Node.h:678
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
void updatePastedDisplacement(GA_Offset ptoff, const GA_PrimitiveGroup *all, GA_PrimitiveGroup *used)
static PRM_ChoiceList breakpointGroupMenu
Definition: SOP_Node.h:1180
int removeAdhocGroup(const GA_Group *group)
Definition: SOP_Node.h:906
void addSystemError(const char *msg=0)
Definition: SOP_Node.h:1157
static PRM_ChoiceList pointAttribMenu
Definition: SOP_Node.h:1193
bool useInputSource(unsigned idx, bool &changed, bool force)
Mark the given input as used for cooking by this node.
Definition: SOP_Node.h:1519
GLboolean GLboolean g
Definition: glcorearb.h:1221
void addMessage(SOP_ErrorCodes code, const char *msg=0)
Definition: SOP_Node.h:1148
GLint level
Definition: glcorearb.h:107
void updatePastedDisplacement(GA_Offset ptoff, const GA_PrimitiveGroup *all, GA_PrimitiveGroup *used)
Definition: SOP_Node.h:1540
SOP_UIChangeType
Definition: SOP_Node.h:58
PRM_UVGroupType
Definition: PRM_Shared.h:34
GLint GLuint mask
Definition: glcorearb.h:123
UT_ErrorSeverity
Definition: UT_Error.h:25
void addCommonError(UT_CommonErrorCode what, const char *msg=0)
Definition: SOP_Node.h:1159
GLbitfield flags
Definition: glcorearb.h:1595
static PRM_ChoiceList primNamedGroupMenu
Definition: SOP_Node.h:1181
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
CH_LocalVariable myVar
Definition: SOP_Node.h:84
fpreal(SOP_Node::* SOP_LocalVarFunc)(sopVarInfo *varinfo)
Definition: SOP_Node.h:79
static PRM_SpareData theSecondElseFirstInput
Definition: SOP_Node.h:870
GU_DetailHandle myGdpHandle
Definition: SOP_Node.h:1593
SOP_ErrorCodes
Definition: SOP_Error.h:16
const GEO_Primitive * curPrim(int index) const
Definition: SOP_Node.h:357
SOP_Guide * myGuide1
Definition: SOP_Node.h:1599
3D Vector class.
const GA_PointGroup * parsePointGroups(const char *pattern)
Definition: SOP_Node.h:584
static PRM_ChoiceList pointGroupMenu
Definition: SOP_Node.h:1177
OP_Network * getCreator() const
virtual void setForceCapture(int)
Definition: SOP_Node.h:836
void addError(int code, const char *msg=0)
Definition: SOP_Node.h:1145
fpreal myDefault
Definition: SOP_Node.h:90
bool hasCookedSelection() const
Definition: SOP_Node.h:773
GLsizeiptr size
Definition: glcorearb.h:663
int myLocalVarOrder
Definition: SOP_Node.h:1722
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
static PRM_ChoiceList pointNamedGroupMenu
Definition: SOP_Node.h:1182
int myCurGdpVal
Definition: SOP_Node.h:1754
virtual const CH_LocalVariable * resolveExtraVariableForSyntaxHighlight(const char *name)
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_EdgeGroup * parseEdgeGroupsCopy(const char *pattern)
Definition: SOP_Node.h:611
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
GA_Offset curPoint(int index) const
Definition: SOP_Node.h:354
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GA_Size GA_Offset
Definition: GA_Types.h:617
virtual void opChanged(OP_EventType reason, void *data=0)
SYS_VISIBILITY_EXPORT void newSopOperator(OP_OperatorTable *table)
Definition: SOP_Euclid.C:44
PRM_GroupType
Definition: PRM_Shared.h:23
long long int64
Definition: SYS_Types.h:106
const GU_DetailHandle & curGdh(int index) const
Definition: SOP_Node.h:337
static PRM_SpareData theFirstInput
Definition: SOP_Node.h:864
GLfloat f
Definition: glcorearb.h:1925
virtual const char * getOpType() const =0
static PRM_ChoiceList edgePointGroupMenu
Definition: SOP_Node.h:1179
static PRM_ChoiceList vertexNamedGroupMenu
Definition: SOP_Node.h:1184
int myLocalVarOrderCache
Cached values so we can tell if we have to rebuild.
Definition: SOP_Node.h:1757
UT_String myName
Definition: SOP_Node.h:72
static PRM_ChoiceList namedVolumesMenu
Definition: SOP_Node.h:1187
int updatePastedDependents(GA_PrimitiveGroup *all, GA_PrimitiveGroup *used)
void expandGroupMask(const char *pattern, UT_String &outNames, GA_GroupType type)
Definition: SOP_Node.h:533
void destroyAdhocGroups()
Definition: SOP_Node.h:676
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
const GU_Detail * inputGeo(int index, OP_Context &)
Definition: SOP_Node.h:1134
This class provides a way to manage a reference to an attribute permitting Read-Only access...
GOP_Manager::GroupCreator GroupCreator
Typedef to help make use of GroupCreator less verbose.
Definition: SOP_Node.h:539
void addWarning(SOP_ErrorCodes code, const char *msg=0)
Definition: SOP_Node.h:1151
static PRM_ChoiceList namedPrimsGlobMenu
Definition: SOP_Node.h:1186
int64 exint
Definition: SYS_Types.h:115
GA_VertexGroup * createAdhocVertexGroup(const GEO_Detail &geo)
Definition: SOP_Node.h:1416
bool myUsesSOPLocalVar
Definition: SOP_Node.h:1729
SOP_NodeCache * myNodeVerbCache
Definition: SOP_Node.h:1772
SOP_Guide * myGuide2
Definition: SOP_Node.h:1600
static bool getCaptureOverrideFlag()
Definition: SOP_Node.h:193
virtual int isCookingRender() const override
Definition: SOP_Node.h:123
GA_PrimitiveGroup * newDetachedPrimitiveGroup() const
Definition: GA_Detail.h:1261
UT_ValArray< sopVarInfo * > myLocalVarArray
Definition: SOP_Node.h:1721
GA_EdgeGroup * createAdhocEdgeGroup(GU_Detail &geo, const char *p="adhoc")
Definition: SOP_Node.h:1392
UT_String myAttribName
Definition: SOP_Node.h:86
void removeAdhocGroups()
Definition: SOP_Node.h:908
GLintptr offset
Definition: glcorearb.h:664
virtual GOP_GuideListType getGuideListType() const
Definition: SOP_Node.h:499
virtual bool addOrMoveVisualizerToOutput(int outputidx)
Definition: OP_Node.h:2906
UT_BoundingBox curPointBBox(int index)
Definition: SOP_Node.h:361
int myTupleIndex
Definition: SOP_Node.h:89
sopVarInfo * mySecondaryVariable
Definition: SOP_Node.h:88
int updatePastedDisplacements()
Definition: SOP_Node.h:1546
SOP_NodeFlags mySopFlags
Definition: SOP_Node.h:1601
GA_EdgeGroup * newDetachedEdgeGroup() const
Definition: GA_Detail.h:1269
GA_PointGroup * parsePointGroupsCopy(const char *pattern)
Definition: SOP_Node.h:598
GLenum GLenum severity
Definition: glcorearb.h:2538
GLboolean * data
Definition: glcorearb.h:130
GA_Storage myStorage
Definition: SOP_Node.h:74
GA_PrimitiveGroup * getPastedSurfaces(GA_PrimitiveGroup *&used)
Definition: SOP_Node.h:1534
SOP_API void SOPfillMetaKernelMenu(void *, PRM_Name *names, int size, const PRM_SpareData *, const PRM_Parm *)
GLuint const GLchar * name
Definition: glcorearb.h:785
int destroyAdhocGroup(const GA_Group *group)
Definition: SOP_Node.h:674
virtual const CH_LocalVariable * resolveVariable(const char *name)
GA_BreakpointGroup * parseBreakpointGroupsCopy(const char *pattern)
Definition: SOP_Node.h:623
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
virtual bool getGroupCentroid(OP_Context &, UT_Vector3 &)
Definition: SOP_Node.h:1571
GA_PrimitiveGroup * createAdhocPrimGroup(GU_Detail &geo, const char *p="adhoc")
Definition: SOP_Node.h:1386
const GA_VertexGroup * parseVertexGroups(const char *pattern)
Definition: SOP_Node.h:630
static PRM_ChoiceList groupMenu
Definition: SOP_Node.h:1175
OP_OpTypeId
Definition: OP_Node.h:263
#define SOP_OPTYPE_NAME
Definition: OP_Node.h:243
GU_SelectionType
Definition: GU_SelectType.h:29
GU_Detail * gdp
Definition: SOP_Node.h:1598
SOP_API void SOPgetVexReservedTemplateLists(UT_ValArray< PRM_Template * > &tplatelists)
static PRM_ChoiceList edgeGroupMenu
Definition: SOP_Node.h:1178
void setUsesSOPLocalVar()
Definition: SOP_Node.h:1714
const GU_Detail * curGdp(int index) const
Definition: SOP_Node.h:346
UT_CommonErrorCode
Definition: UT_Error.h:42
static PRM_ChoiceList vertexAttribMenu
Definition: SOP_Node.h:1194
const SOP_NodeFlags & getFlags() const
Definition: SOP_Node.h:120
virtual const char * getChildType() const
void addFatal(SOP_ErrorCodes code, const char *msg=0)
Definition: SOP_Node.h:1154
virtual bool shouldResetGeoToEmpty() const
Definition: SOP_Node.h:1449
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GA_VertexGroup * newDetachedVertexGroup() const
Definition: GA_Detail.h:1265
GA_AttributeOwner
Definition: GA_Types.h:33
double fpreal
Definition: SYS_Types.h:269
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
static PRM_ChoiceList primAttribMenu
Definition: SOP_Node.h:1192
void sopVisualizeCallback(void *, SOP_Node *, OP_Context &, GU_Detail *)
Definition: SOP_Node.h:106
static void setCaptureOverrideFlag(bool flag)
Definition: SOP_Node.h:189
void addCommonWarning(UT_CommonErrorCode what, const char *msg=0)
Definition: SOP_Node.h:1162
typedef int
Definition: png.h:1175
static PRM_ChoiceList edgeNamedGroupMenu
Definition: SOP_Node.h:1183
int updatePastedDisplacements(void)
SOP_LocalVarFunc myCallback
Definition: SOP_Node.h:94
GA_Group * parseAllGroupsCopy(const char *pattern)
Definition: SOP_Node.h:665
GA_PrimitiveGroup * getPastedSurfaces(const char *n="__gu_all_pasted__")
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:138
const GA_BreakpointGroup * parseBreakpointGroups(const char *pattern)
Definition: SOP_Node.h:618
GLuint index
Definition: glcorearb.h:785
GA_PrimitiveGroup * parsePrimitiveGroupsCopy(const char *pattern)
Definition: SOP_Node.h:568
SOP_NodeParms * myNodeVerbParms
Definition: SOP_Node.h:1773
GLuint GLfloat * val
Definition: glcorearb.h:1607
UT_SymbolMap< sopVarInfo * > myLocalVarTable
Local variable items:
Definition: SOP_Node.h:1720
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
static PRM_ChoiceList detailAttribMenu
Definition: SOP_Node.h:1191
#define SOP_API
Definition: SOP_API.h:10
GA_PrimitiveGroup * createAdhocPrimGroup(const GEO_Detail &geo)
Definition: SOP_Node.h:1398
OP_DataType
Definition: OP_DataTypes.h:27
virtual OP_OpTypeId getChildTypeID() const =0
virtual void setVisualization(int)
Definition: SOP_Node.h:835
static PRM_SpareData theThirdInput
Definition: SOP_Node.h:866
GA_PointGroup * createAdhocPointGroup(GU_Detail &geo, const char *p="adhoc")
Definition: SOP_Node.h:1389
virtual bool evalVariableValue(UT_String &val, int index, int thread)
int myVaridx
Definition: SOP_Node.h:93
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
OP_ERROR duplicatePointSource(unsigned index, OP_Context &ctx)
Definition: SOP_Node.h:1478
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
GOP_GuideListType
Definition: GOP_Guide.h:24
GA_GroupMaskType
Definition: GA_Types.h:151
virtual int isCookingRender() const
Definition: OP_Node.h:2334
#define const
Definition: zconf.h:214
static PRM_SpareData theSecondInput
Definition: SOP_Node.h:865
png_infop png_uint_32 flag
Definition: png.h:2242
UT_BoundingBox curPrimBBox(int index)
Definition: SOP_Node.h:369
const GA_EdgeGroup * parseEdgeGroups(const char *pattern)
Definition: SOP_Node.h:606
GEO_Standard_Attributes
Definition: GEO_Detail.h:141
int myCurrentLayerCache
Definition: SOP_Node.h:1758
GA_BreakpointGroup * createAdhocBreakpointGroup(const GEO_Detail &geo)
Definition: SOP_Node.h:1422
GA_Storage
Definition: GA_Types.h:48
OP_ERROR duplicateSource(unsigned index, OP_Context &context)
Definition: SOP_Node.h:1457
static PRM_ChoiceList allTextureCoordMenu
Definition: SOP_Node.h:1196
GA_EdgeGroup * createAdhocEdgeGroup(const GEO_Detail &geo)
Definition: SOP_Node.h:1410
int updatePastedDependents(GA_PrimitiveGroup *all, GA_PrimitiveGroup *used)
Definition: SOP_Node.h:1551
virtual void clearCache()
static const char * theChildTableName
Definition: SOP_Node.h:116
GLenum src
Definition: glcorearb.h:1792
int myTable
Definition: SOP_Node.h:85