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