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