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