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