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