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