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