HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_NodeVerb.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_NodeVerb.h ( SOP Library, C++)
7  *
8  * COMMENTS:
9  * Verb-based API for SOP cooking mechanisms. SOPs can return
10  * one of these objects to describe how they cook, allowing the
11  * cook engine to perform additional optimizations.
12  */
13 
14 #ifndef __SOP_NodeVerb_h__
15 #define __SOP_NodeVerb_h__
16 
17 #include "SOP_API.h"
18 #include "SOP_Node.h"
19 #include <OP/OP_Director.h>
20 #include <PRM/PRM_Parm.h>
21 #include <UT/UT_Array.h>
22 #include <UT/UT_Assert.h>
23 #include <SYS/SYS_Types.h>
24 
25 #include <initializer_list>
26 
27 #include <VEX/VEX_PodTypes.h>
28 template <VEX_Precision PREC> class CVEX_ContextT;
30 class CVEX_Function;
31 class DEP_MicroNode;
32 class SOP_GraphProxy;
33 
35 {
36 public:
37  int64 getMemoryUsage(bool inclusive) const
38  {
39  int64 mem = inclusive ? sizeof(*this) : 0;
40  mem += UTarrayDeepMemoryUsage(stringdata, false);
41  return mem;
42  }
43 
44 public:
45  fpreal32 floatdata[16];
48 };
49 
51 {
54 };
55 
56 
58 {
59 public:
61  {
62  }
63  virtual ~SOP_NodeCache();
64 
65  virtual int64 getMemoryUsage(bool inclusive) const;
66 
67 protected:
68  friend class SOP_NodeParms;
69 };
70 
72 {
73 public:
75  virtual ~SOP_NodeParms() {}
76 
78  {
79  public:
81  SOP_CookEngine cookengine,
82  const SOP_GraphProxy *graph,
83  exint nodeidx,
84  const OP_Context &context,
85  SOP_NodeCache *cache,
87  DEP_MicroNode *depnode)
88  : myParms(parms)
89  , myCookEngine(cookengine)
90  , myGraph(graph)
91  , myNodeIdx(nodeidx)
92  , myContext(context)
93  , myCache(cache)
94  , myError(error)
95  , myDepNode(depnode)
96  {
97  }
98  virtual ~LoadParms();
99 
100  const OP_Node *node() const;
101  const SOP_GraphProxy *graph() const { return myGraph; }
102  exint nodeIdx() const { return myNodeIdx; }
103  template <typename T>
104  const T &parms() const
105  { return *UTverify_cast<const T*>(myParms); }
106  SOP_NodeCache *cache() const { return myCache; }
107  const OP_Context &context() const { return myContext; }
108  UT_ErrorManager *error() const { return myError; }
109  DEP_MicroNode *depnode() const { return myDepNode; }
110 
111  /// Methods to wire directly to the optional depnode.
112  void addExplicitInput(DEP_MicroNode &inp, bool check_dup)
113  { if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
115  { addExplicitInput(inp, /*check_dup*/true); }
116 
117  /// Methods to add directly to any present error manager.
118  UT_ErrorSeverity addMessage (const char *type, int code, const char *msg=0,
119  const UT_SourceLocation *loc=0) const
120  { if (myError) return myError->addMessage(type, code, formatError(msg), loc);
121  return UT_ERROR_MESSAGE; }
122  UT_ErrorSeverity addWarning (const char *type, int code, const char *msg=0,
123  const UT_SourceLocation *loc=0) const
124  { if (myError) return myError->addWarning(type, code, formatError(msg), loc);
125  return UT_ERROR_WARNING; }
126  UT_ErrorSeverity addError (const char *type, int code, const char *msg=0,
127  const UT_SourceLocation *loc=0) const
128  { if (myError) return myError->addError(type, code, formatError(msg), loc);
129  return UT_ERROR_ABORT; }
130 
131  UT_ErrorSeverity sopAddMessage (int code, const char *msg=0,
132  const UT_SourceLocation *loc=0) const
133  { return addMessage("SOP", code, msg, loc); }
134  UT_ErrorSeverity sopAddWarning (int code, const char *msg=0,
135  const UT_SourceLocation *loc=0) const
136  { return addWarning("SOP", code, msg, loc); }
137  UT_ErrorSeverity sopAddError (int code, const char *msg=0,
138  const UT_SourceLocation *loc=0) const
139  { return addError("SOP", code, msg, loc); }
140 
142  bool borrow_only = false) const
143  { if (myError) myError->stealErrors(src,0, -1, UT_ERROR_NONE, borrow_only); }
144 
145  protected:
146  /// Prefix errors so we can get sensible results.
147  UT_StringHolder formatError(const char *msg) const;
148 
157  };
158 
159  void loadFromOp(const LoadParms &loadparms);
160 
161 
162  /// Overloads all the parmaeters according to matching entries in
163  /// the provided options table.
164  bool applyOptionsOverride(const UT_Options *options);
165 
166  /// Overloads all the parameters according to matching attributes
167  /// in provided geometry.
168  bool applyGeometryOverride(GU_ConstDetailHandle gdh);
169 
170  /// Detects specially named parameters, cooks required inputs using
171  /// the traditional cook engine.
172  bool applyGeometryOverrideFromNode(
173  SOP_Node *node, OP_Context &context,
174  SOP_NodeCache *cache);
175  /// Returns if the node has the specially named parameters that
176  /// may require a parameter override. This will disable traditional
177  /// cooking.
178  static bool nodeHasGeometryOverride(SOP_Node *node, OP_Context &context);
179 
180  virtual void copyFrom(const SOP_NodeParms *src) { }
181 
182 
183  enum ParmType
184  {
197  PARM_UNSUPPORTED
198  };
199 
200  /// Marshalling interface to rest of world
201  /// These all use index based notation.
202  virtual exint getNumParms() const { return getNestNumParms({}); }
203  virtual const char *getParmName(exint idx) const { return getNestParmName({idx}); }
204  virtual ParmType getParmType(exint idx) const { return getNestParmType({idx}); }
205 
206  virtual void getParmValue(exint idx, exint &value) const
207  { getNestParmValue( {idx}, {}, value ); }
208  virtual void getParmValue(exint idx, fpreal &value) const
209  { getNestParmValue( {idx}, {}, value ); }
210  virtual void getParmValue(exint idx, UT_Vector2D &value) const
211  { getNestParmValue( {idx}, {}, value ); }
212  virtual void getParmValue(exint idx, UT_Vector3D &value) const
213  { getNestParmValue( {idx}, {}, value ); }
214  virtual void getParmValue(exint idx, UT_Vector4D &value) const
215  { getNestParmValue( {idx}, {}, value ); }
216  virtual void getParmValue(exint idx, UT_Matrix2D &value) const
217  { getNestParmValue( {idx}, {}, value ); }
218  virtual void getParmValue(exint idx, UT_Matrix3D &value) const
219  { getNestParmValue( {idx}, {}, value ); }
220  virtual void getParmValue(exint idx, UT_Matrix4D &value) const
221  { getNestParmValue( {idx}, {}, value ); }
222  virtual void getParmValue(exint idx, UT_StringHolder &value) const
223  { getNestParmValue( {idx}, {}, value ); }
224  virtual void getParmValue(exint idx, UT_SharedPtr<UT_Ramp> &value) const
225  { getNestParmValue( {idx}, {}, value ); }
226  virtual void getParmValue(exint idx, PRM_DataItemHandle &value) const
227  { getNestParmValue( {idx}, {}, value ); }
228 
229  virtual void setParmValue(exint idx, const exint &value)
230  { setNestParmValue( {idx}, {}, value ); }
231  virtual void setParmValue(exint idx, const fpreal &value)
232  { setNestParmValue( {idx}, {}, value ); }
233  virtual void setParmValue(exint idx, const UT_Vector2D &value)
234  { setNestParmValue( {idx}, {}, value ); }
235  virtual void setParmValue(exint idx, const UT_Vector3D &value)
236  { setNestParmValue( {idx}, {}, value ); }
237  virtual void setParmValue(exint idx, const UT_Vector4D &value)
238  { setNestParmValue( {idx}, {}, value ); }
239  virtual void setParmValue(exint idx, const UT_Matrix2D &value)
240  { setNestParmValue( {idx}, {}, value ); }
241  virtual void setParmValue(exint idx, const UT_Matrix3D &value)
242  { setNestParmValue( {idx}, {}, value ); }
243  virtual void setParmValue(exint idx, const UT_Matrix4D &value)
244  { setNestParmValue( {idx}, {}, value ); }
245  virtual void setParmValue(exint idx, const UT_StringHolder &value)
246  { setNestParmValue( {idx}, {}, value ); }
247  virtual void setParmValue(exint idx, const UT_SharedPtr<UT_Ramp> &value)
248  { setNestParmValue( {idx}, {}, value ); }
249  virtual void setParmValue(exint idx, const PRM_DataItemHandle &value)
250  { setNestParmValue( {idx}, {}, value ); }
251 
252  /// This makes a temporary index structure out of either an
253  /// initializer list or an exint array. It does *NOT* own
254  /// the data so should never be explicitly constructed.
255  class TempIndex
256  {
257  public:
258  TempIndex(std::initializer_list<exint> list)
259  {
260  if (list.size())
261  myVec = &*list.begin();
262  else
263  myVec = 0;
264  mySize = list.size();
265  }
267  {
268  myVec = list.data();
269  mySize = list.size();
270  }
271 
272  const exint *begin() const { return myVec; }
273  exint size() const { return mySize; }
274  exint operator[](const exint off) const
275  {
276  UT_ASSERT_P(off >= 0 && off < mySize);
277  return myVec[off];
278  }
279  protected:
280  const exint *myVec;
282  };
283 
284  virtual exint getNestNumParms(TempIndex idx) const { return 0; }
285  virtual const char *getNestParmName(TempIndex idx) const { return 0; }
286  virtual ParmType getNestParmType(TempIndex idx) const { return PARM_UNSUPPORTED; }
287 
288  virtual void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const {}
289  virtual void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const {}
290  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const {}
291  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const {}
292  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const {}
293  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const {}
294  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const {}
295  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const {}
296  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const {}
297  virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const {}
298  virtual void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const {}
299 
300  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) {}
301  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) {}
302  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) {}
303  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) {}
304  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) {}
305  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) {}
306  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) {}
307  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) {}
308  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) {}
309  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) {}
310  virtual void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) {}
311 
312  virtual int64 getMemoryUsage(bool inclusive) const
313  { return inclusive ? sizeof(*this) : 0; }
314 
315 protected:
316  virtual void loadFromOpSubclass(const LoadParms &loadparms) = 0;
317 
318  // Used for coercing one type to another
319  template <typename T, typename S>
320  void coerceValue(T &result, const S &src) const
321  {
322  result = T{};
323  }
324 
325  template <typename T>
326  T clampMinValue(fpreal minvalue, const T &src) const
327  {
328  return src;
329  }
330 
331  template <typename T>
332  T clampMaxValue(fpreal maxvalue, const T &src) const
333  {
334  return src;
335  }
336 
337 };
338 
339 template <>
340 void inline SOP_NodeParms::coerceValue(exint &result, const exint &src) const
341 { result = src; }
342 template <>
343 void inline SOP_NodeParms::coerceValue(bool &result, const exint &src) const
344 { result = src; }
345 template <>
346 void inline SOP_NodeParms::coerceValue(exint &result, const bool &src) const
347 { result = src; }
348 template <>
349 void inline SOP_NodeParms::coerceValue(bool &result, const bool &src) const
350 { result = src; }
351 template <>
352 void inline SOP_NodeParms::coerceValue(fpreal &result, const fpreal &src) const
353 { result = src; }
354 template <>
356 { result = src; }
357 template <>
359 { result = src; }
360 template <>
362 { result = src; }
363 template <>
365 { result = src; }
366 template <>
368 { result = src; }
369 template <>
371 { result = src; }
372 template <>
374 { result = src; }
375 template <>
377 { result = src; }
378 template <>
380 { result = src; }
381 template <>
383 { result = src; }
384 template <>
386 { result = src; }
387 template <>
389 { result = src; }
390 
391 template <>
393 { return SYSmax((exint)clamp, src); }
394 template <>
395 bool inline SOP_NodeParms::clampMinValue(fpreal clamp, const bool &src) const
396 { return SYSmax((exint)clamp, src); }
397 template <>
399 { return SYSmax(clamp, src); }
400 template <>
402 { return SYSmax(UT_Vector2D(clamp, clamp), src); }
403 template <>
405 { return SYSmax(UT_Vector3D(clamp, clamp, clamp), src); }
406 template <>
408 { return SYSmax(UT_Vector4D(clamp, clamp, clamp, clamp), src); }
409 template <>
411 { return SYSmax(UT_Matrix2D(clamp, clamp, clamp, clamp), src); }
412 template <>
414 { return SYSmax(UT_Matrix3D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
415 template <>
417 { return SYSmax(UT_Matrix4D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
418 template <>
420 { return SYSmax(UT_Vector2I(clamp, clamp), src); }
421 template <>
423 { return SYSmax(UT_Vector3I(clamp, clamp, clamp), src); }
424 template <>
426 { return SYSmax(UT_Vector4I(clamp, clamp, clamp, clamp), src); }
427 
428 template <>
430 { return SYSmin((exint)clamp, src); }
431 template <>
432 bool inline SOP_NodeParms::clampMaxValue(fpreal clamp, const bool &src) const
433 { return SYSmin((exint)clamp, src); }
434 template <>
436 { return SYSmin(clamp, src); }
437 template <>
439 { return SYSmin(UT_Vector2D(clamp, clamp), src); }
440 template <>
442 { return SYSmin(UT_Vector3D(clamp, clamp, clamp), src); }
443 template <>
445 { return SYSmin(UT_Vector4D(clamp, clamp, clamp, clamp), src); }
446 template <>
448 { return SYSmin(UT_Matrix2D(clamp, clamp, clamp, clamp), src); }
449 template <>
451 { return SYSmin(UT_Matrix3D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
452 template <>
454 { return SYSmin(UT_Matrix4D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
455 template <>
457 { return SYSmin(UT_Vector2I(clamp, clamp), src); }
458 template <>
460 { return SYSmin(UT_Vector3I(clamp, clamp, clamp), src); }
461 template <>
463 { return SYSmin(UT_Vector4I(clamp, clamp, clamp, clamp), src); }
464 
465 ///
466 /// SOP_NodeVerb
467 ///
468 /// This should be a singleton class. Build it with the Register
469 /// template to allow it to be discoverable by name.
470 ///
472 {
473 public:
475  virtual ~SOP_NodeVerb() {}
476 
477  template <typename T>
478  class Register
479  {
480  public:
482  {
483  myVerb = new T();
485  }
487  {
489  delete myVerb;
490  }
491 
492  const T *get() const { return myVerb; }
493 
494  private:
495  T *myVerb;
496 
497  };
498 
499  virtual SOP_NodeCache *allocCache() const
500  { return new SOP_NodeCache; }
501 
502  virtual SOP_NodeParms *allocParms() const = 0;
503 
504  virtual UT_StringHolder name() const = 0;
505 
506  /// Finds a verb which matches the given name
507  static const SOP_NodeVerb *lookupVerb(const UT_StringRef &name);
508  static void listVerbs(UT_StringArray &verbnames);
509  static void registerVerb(SOP_NodeVerb *verb);
510  static void unregisterVerb(SOP_NodeVerb *verb);
511 
513  {
514  public:
515  void clear()
516  {
517  myExprInputs.clear();
518  myTimeDeps.clear();
519  }
521  const UT_IntArray &timedeps)
522  {
523  myExprInputs = inputs;
524  myTimeDeps = timedeps;
525  }
526  const UT_Array<GU_ConstDetailHandle> &exprinputs() const { return myExprInputs; }
527  const UT_IntArray &timedeps() const { return myTimeDeps; }
528 
529  protected:
532  };
533 
535 
536  /// During execution of a verb chain you may wish to disable
537  /// the traditional cooking of nodes. This provides a set of
538  /// nodes you do not want recursed into during the verb cook.
539  /// It will be NULL if there are none or this thread isn't in
540  /// a compiled execution path.
541  static const ForbiddenNodeMap *forbiddenNodes();
542  static const ForbiddenNodeMap *forbiddenNodes(int thread);
543 
544  /// This scope class will push the given list of nodes marking
545  /// them as inelligible for cooking in the traditional path.
546  /// Needless to say, the invoker needs to ensure the set's lifetime
547  /// persists.
549  {
550  public:
551  ScopeForbiddenNodes(const ForbiddenNodeMap *forbiddennodes);
553  protected:
555  };
556 
557  enum CookMode
558  {
559  // With in place the destination gdp will be the first input or
560  // a copy.
561  // The first input will be null.
563  // With duplicate, the destination gdp will be a copy of the
564  // first input. All inputs will be valid.
566  // With generator, the destination gdp is empty, possibly
567  // a stashAll(). All inputs will be valid.
569  // With instance, the destination gdp is invalid. All inputs
570  // will be valid.
572  // There will be a destination gdp, but its contents are unspecified
573  // It may contain the results of the last cook. All inputs are
574  // valid.
576  // If cookMode is pass through, the cook method will not be
577  // invoked at all. Instead, the first input will be passed through
578  // unchanged. If there is no first input, an empty gdp is
579  // created.
581  };
582 
584  {
585  public:
587  virtual ~NodeInputs() {}
588 
589  virtual exint nInputs() const = 0;
590  /// Returns if the input is wired.
591  virtual bool hasInput(exint idx) const = 0;
592 
593  /// Demands the input be cooked. After this, the inputGeo()
594  /// will return the contents.
595  /// Returns false if the cook failed for some reason.
596  virtual bool cookInput(exint idx) = 0;
597 
598  /// Returns an invalid handle if the input isn't wired or not yet cooked.
599  virtual GU_DetailHandle inputGeo(exint idx) = 0;
600 
601  /// Unlocks/forgets the given input. Returns an invalid handle if
602  /// not wired or not cooked.
603  virtual GU_DetailHandle unloadInput(exint idx, bool flushce) = 0;
604 
605  /// Marks the given input used. Needed if the input isn't cooked,
606  /// as unload will not mark it unused (as it must be marked such
607  /// ASAP to free up earlier nodes)
608  virtual void markInputUnused(exint idx) = 0;
609  };
610 
612  {
613  public:
615  : myGdps(gdps)
616  { }
617  ~PreCookedNodeInputs() override {}
618 
619  exint nInputs() const override { return myGdps.entries(); }
620  bool hasInput(exint idx) const override
621  {
622  if (idx < 0 || idx >= nInputs())
623  return false;
624  return myGdps(idx).gdp() != nullptr;
625  }
626 
627  bool cookInput(exint idx) override
628  {
629  // Precooked, so if we have it it successfully cooked.
630  return hasInput(idx);
631  }
632 
634  {
635  if (!hasInput(idx))
636  return GU_DetailHandle();
637  return myGdps(idx).castAwayConst();
638  }
639 
640  GU_DetailHandle unloadInput(exint idx, bool flushce) override
641  {
642  // It would make sense to clear out the gdp at this point,
643  // but we don't have ownership of the array.
644  return inputGeo(idx);
645  }
646 
647  void markInputUnused(exint idx) override {}
648  protected:
650  };
651 
653  {
654  public:
655  InputParms(NodeInputs &inputs, NodeInputs &exprinputs,
656  const OP_Context &context,
657  const SOP_NodeParms *parms,
658  SOP_NodeCache *cache,
660  : myInputs(inputs)
661  , myExprInputs(exprinputs)
662  , myContext(context)
663  , myParms(parms)
664  , myCache(cache)
665  , myError(error)
666  , myDepNode(depnode)
667  {
668  }
669 
670  virtual ~InputParms() {}
671 
672  NodeInputs &inputs() const { return myInputs; }
673 
674  NodeInputs &exprinputs() const { return myExprInputs; }
675 
676  template <typename T>
677  const T &parms() const
678  { return *UTverify_cast<const T*>(myParms); }
679 
680  template <typename T>
681  T *cache() const
682  { return UTverify_cast<T *>(myCache); }
683 
684  UT_ErrorManager *error() const { return myError; }
685 
686  DEP_MicroNode *depnode() const { return myDepNode; }
687 
688  const OP_Context &getContext() const
689  { return myContext; }
691  { return myContext.getTime(); }
692 
693  protected:
701  };
702 
703  class CookParms
704  {
705  public:
707  const UT_Array<GU_ConstDetailHandle> &inputs,
708  SOP_CookEngine cookengine,
709  OP_Node *node,
710  const OP_Context &context,
711  const SOP_NodeParms *parms,
712  SOP_NodeCache *cache,
714  DEP_MicroNode *depnode)
715  : myDestGdh(destgdh)
716  , myInputs(inputs)
717  , myCookEngine(cookengine)
718  , myNode(CAST_SOPNODE(node))
719  , myContext(context)
720  , myParms(parms)
721  , myCache(cache)
722  , myError(error)
723  , myDepNode(depnode)
724  {}
725  virtual ~CookParms() {}
726 
727  /// The initial state of gdh depends on the cookMode()
728  GU_DetailHandle &gdh() const { return myDestGdh; }
729 
730  /// The currently cooking SOP. This is only non-null if in
731  /// the old cook path. When executing compiled nodes it will
732  /// be null as the verb is supposed to operate independently
733  /// of the original SOP.
734  SOP_Node *getNode() const { return (myCookEngine == SOP_COOK_TRADITIONAL) ? myNode : 0; }
735 
736  template <typename T>
737  T *getCookNode() const
738  { if (myCookEngine != SOP_COOK_TRADITIONAL)
739  return 0;
740  return UTverify_cast<T *>(myNode); }
741 
742  /// The node that generated this verb, if any...
743  SOP_Node *getSrcNode() const { return myNode; }
744  /// The getCwd() should be used to evaluate relative paths.
745  OP_Node *getCwd() const { if (myNode) return myNode; return OPgetDirector(); }
746  const OP_Context &getContext() const
747  { return myContext; }
749  { return myContext.getTime(); }
750 
751  /// Accessors designed to simplify porting from old cook code.
752  /// Just becaues you have nInputs does not mean all are wired or
753  /// cooked. But, the number demanded by your OP_Operator shall
754  /// be present.
755  /// Inputs have been locked & preserve request set
756  exint nInputs() const { return myInputs.size(); }
757  bool hasInput(exint idx) const
758  {
759  if (idx < 0 || idx >= myInputs.size())
760  return false;
761  return myInputs(idx).isValid();
762  }
763  const GU_Detail *inputGeo(exint idx) const
764  {
765  if (!hasInput(idx)) return 0;
766  return myInputs(idx).gdp();
767  }
769  {
770  if (!hasInput(idx)) return GU_ConstDetailHandle();
771  return myInputs(idx);
772  }
773 
774  template <typename T>
775  const T &parms() const
776  { return *UTverify_cast<const T*>(myParms); }
777 
778  /// Cache may, or may not, persist between cooks. But it is
779  /// guaranteed this is the only thread using the cache.
780  SOP_NodeCache *cache() const { return myCache; }
781 
782  /// Error managers are not locked, so do not pass this to
783  /// something that forks.
784  UT_ErrorManager *error() const { return myError; }
785  DEP_MicroNode *depnode() const { return myDepNode; }
786 
787  /// Methods to wire directly to the optional depnode.
788  void addExplicitInput(DEP_MicroNode &inp, bool check_dup=true) const
789  { if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
790 
791  /// Methods to add directly to any present error manager.
792  UT_ErrorSeverity addMessage (const char *type, int code, const char *msg=0,
793  const UT_SourceLocation *loc=0) const
794  { if (myError) return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
795  return UT_ERROR_MESSAGE; }
796  UT_ErrorSeverity addWarning (const char *type, int code, const char *msg=0,
797  const UT_SourceLocation *loc=0) const
798  { if (myError) return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
799  return UT_ERROR_WARNING; }
800  UT_ErrorSeverity addError (const char *type, int code, const char *msg=0,
801  const UT_SourceLocation *loc=0) const
802  { if (myError) return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
803  return UT_ERROR_ABORT; }
804 
805  UT_ErrorSeverity sopAddMessage (int code, const char *msg=0,
806  const UT_SourceLocation *loc=0) const
807  { return addMessage("SOP", code, msg, loc); }
808  UT_ErrorSeverity sopAddWarning (int code, const char *msg=0,
809  const UT_SourceLocation *loc=0) const
810  { return addWarning("SOP", code, msg, loc); }
811  UT_ErrorSeverity sopAddError (int code, const char *msg=0,
812  const UT_SourceLocation *loc=0) const
813  { return addError("SOP", code, msg, loc); }
814 
815  void addTransformError(const OP_Node &node, const char *label=0) const
816  {
817  UT_String path;
818  node.getFullPath(path);
819  if (UTisstring(label))
820  {
821  path += "(as "; path += label; path += ")";
822  }
823  addError("OP", OP_ERR_TRANSFORM, path);
824  }
825 
827  bool borrow_only = false) const
828  { if (myError) getLockedErrorManager()->stealErrors(src,0, -1, UT_ERROR_NONE, borrow_only); }
829 
831  { if (getNode())
832  getNode()->select(gtype); }
833 
835  bool add_to_sel = false) const
836  { if (getNode())
837  getNode()->select(selection, add_to_sel); }
838 
839  // Select the group. opt use its type as sel type
840  void select(const GA_Group &group, bool use_gtype = true,
841  bool add_to_sel = false) const
842  { if (getNode())
843  getNode()->select(group, use_gtype, add_to_sel); }
844 
845  void select(const GEO_Primitive &prim, bool sel_prim = true,
846  bool add_to_sel = false) const
847  { if (getNode())
848  getNode()->select(prim, sel_prim, add_to_sel); }
849  void selectPrimitive(GA_Offset primoff, bool prim_sel = true,
850  bool add_to_sel = false) const
851  { if (getNode())
852  getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
853  void selectPoint(GA_Offset ptoff, bool point_sel = true,
854  bool add_to_sel = false) const
855  { if (getNode())
856  getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
857  void selectFrom(const GEO_Primitive &prim, bool sel_prim = true,
858  bool add_to_sel = false) const
859  { if (getNode())
860  getNode()->selectFrom(prim, sel_prim, add_to_sel); }
861  void selectPointsFrom(GA_Offset ptoff, bool point_sel = true,
862  bool add_to_sel = false) const
863  { if (getNode())
864  getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
865  void select(const GA_Range &range, bool use_rtype = true,
866  bool add_to_sel = false) const
867  { if (getNode())
868  getNode()->select(range, use_rtype, add_to_sel); }
869 
870  // Selects input based on the group supplied and the group type. If
871  // group is not null, then it's type is used, otherwise the group type
872  // is used.
874  GA_GroupType grouptype) const
875  { if (getNode())
876  getNode()->selectInputGroup(group, grouptype); }
877 
878  // If no selection is present, then create a new empty primitive cook
879  // selection group. Otherwise, clear the selection.
880  void clearSelection() const
881  { if (getNode())
882  getNode()->clearSelection(); }
883 
884  /// If the cook selection group is not of the given type, create an empty
885  /// cook selection group of that type. Otherwise, clear the existing cook
886  /// selection group.
887  void clearSelection(GA_GroupType gtype) const
888  { if (getNode())
889  getNode()->clearSelection(gtype); }
890 
891  // Blow away the selection and reinitialize it to 0. Much more radical
892  // than clearSelection(), which leaves behind a clean, empty selection.
893  // This method returns 1 if it had anything to destroy, else 0.
894  bool destroySelection() const
895  { if (getNode())
896  return getNode()->destroySelection();
897  return false;
898  }
899 
900  // Return 1 if selection is enabled, 0 if false.
901  bool selectionEnabled() const
902  {
903  if (!getNode())
904  return false;
905  return getNode()->getHighlight();
906  }
907 
908  /// Shims for local variables
909  bool setupLocalVars() const
910  { if (getNode()) return getNode()->setupLocalVars(); return false; }
911  void resetLocalVarRefs() const
912  { if (getNode()) getNode()->resetLocalVarRefs(); }
913  void setCurGdh(int index, const GU_DetailHandle &gdh) const
914  { if (getNode()) getNode()->setCurGdh(index, gdh); }
915  void clearCurGdh(int index) const
916  { if (getNode()) getNode()->clearCurGdh(index); }
917  void setCurPoint(int index, GA_Offset off) const
918  { if (getNode()) getNode()->setCurPoint(index, off); }
919  void clearCurPoint(int index) const
920  { if (getNode()) getNode()->clearCurPoint(index); }
921  void setCurVertex(int index, GA_Offset off) const
922  { if (getNode()) getNode()->setCurVertex(index, off); }
923  void clearCurVertex(int index) const
924  { if (getNode()) getNode()->clearCurVertex(index); }
925  void setCurPrim(int index, GA_Offset off) const
926  { if (getNode()) getNode()->setCurPrim(index, off); }
927  void clearCurPrim(int index) const
928  { if (getNode()) getNode()->clearCurPrim(index); }
929  void setCurVertexNum(int index, exint num) const
930  { if (getNode()) getNode()->setCurVertexNum(index, num); }
931  void clearCurVertexNum(int index) const
932  { if (getNode()) getNode()->clearCurVertexNum(index); }
933  void setVariableOrder(int detail, int prim,
934  int pt, int vtx) const
935  { if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
936 
937  /// Tracks if any local variables were accessed by op functions.
939  { if (getNode()) getNode()->myUsesSOPLocalVar = false; }
941  { if (!getNode()) return false;
942  return getNode()->myUsesSOPLocalVar; }
943 
944 
945  protected:
946  /// Prefix errors so we can get sensible results.
947  UT_StringHolder formatError(const char *msg) const
948  {
949  // Do not prefix with the path in traditional cook
950  // as it is properly assigned.
951  if (myCookEngine == SOP_COOK_TRADITIONAL)
952  return msg;
954  if (!msg || !*msg)
955  return result;
957  UT_String fullpath;
958  if (myNode)
959  myNode->getFullPath(fullpath);
960  else
961  fullpath = "<internal>";
962  buf.sprintf("%s: %s", (const char *) fullpath, msg);
963  result = buf;
964  return result;
965  }
966 
967  // NOTE: Do not hold onto the ptr object longer than necessary!
970  {
972  *myError, myErrorLock);
973  }
974 
985  };
986 
987  /// If doPartialInputCook is false, we do assume cookInputs() will
988  /// apply to all inputs regardless of node parameters. If local
989  /// variables require the inputs, it is required for this to be false
990  /// for the inputs to be available when parameters are evaluated.
991  virtual bool doPartialInputCook() const { return false; }
992  virtual bool cookInputs(const InputParms &parms) const
993  {
994  for (exint i = 0; i < parms.inputs().nInputs(); i++)
995  if (parms.inputs().hasInput(i))
996  {
997  if (!parms.inputs().cookInput(i))
998  return false;
999  }
1000  return true;
1001  }
1002 
1003  /// These are for the old-cook path to allow nodes to store relevant
1004  /// local variable information inside the SOP for callbacks. The
1005  /// evalVariableValue() should be guarded to ensure it doesn't
1006  /// run from a forbidden node.
1007  /// These can be used if the local variables depend only on the inputs
1008  /// and are not change for every parameter. If they change for
1009  /// every parameter, traditional cook paths will need to setup &
1010  /// evaluate explicitly in the cook method.
1011  virtual void setupLocalVariables(SOP_Node *sop, const UT_Array<GU_ConstDetailHandle> &inputs) const {}
1012  virtual void resetLocalVariables(SOP_Node *sop) const {}
1013 
1014  /// Traditional nodes may evaluate parameters while cooking, this is
1015  /// required for dynamic local variables. If this is true, no pre-cooking
1016  /// of the parameter struture will be done in the traditional cook
1017  /// path avoiding double cooking parameters. Remember other cook paths
1018  /// will not have access to the sop so should use the parameter structure!
1019  virtual bool evaluatesParametersDuringCook() const { return false; }
1020 
1021  virtual CookMode cookMode(const SOP_NodeParms *parms) const { return COOK_DUPLICATE; }
1022 
1023  /// Attributes can end up cached on the GPU. Some SOPs are able
1024  /// to handle this. Some are ambivalent (such as switch or null)
1025  /// And some expect all GPU buffers to be flushed prior to
1026  /// operating. If a node requires a CE flush, all inputs
1027  /// will be clean.
1028  virtual bool requiresCEFlush() const { return true; }
1029  virtual bool usesCE() const { return false; }
1030 
1031  /// Compute the output geometry.
1032  virtual void cook(const CookParms &cookparms) const = 0;
1033 
1034  /// This is used to update handles, it only has an effect
1035  /// if oldsop is non-null, ie, we are in the old cook path.
1036  /// Neither the group nor the gdp have to persist beyond this call.
1037  /// Pass -1 for the grouptype if there is no grouptype parameter.
1038  void notifyGroupParmListeners(SOP_Node *oldsop,
1039  int groupparm_idx,
1040  int grouptype_idx,
1041  const GU_Detail *gdp,
1042  const GA_Group *group) const;
1043 
1044 protected:
1045 };
1046 
1047 #endif
const OP_Context & myContext
Definition: SOP_NodeVerb.h:153
virtual void getParmValue(exint idx, UT_Matrix3D &value) const
Definition: SOP_NodeVerb.h:218
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const
Definition: SOP_NodeVerb.h:295
UT_Vector2T< int64 > UT_Vector2I
#define SYSmax(a, b)
Definition: SYS_Math.h:1513
const T & parms() const
Definition: SOP_NodeVerb.h:677
exint nInputs() const override
Definition: SOP_NodeVerb.h:619
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const
Definition: SOP_NodeVerb.h:293
GT_API const UT_StringHolder selection
UT_Matrix4T< fpreal64 > UT_Matrix4D
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:686
const UT_Array< GU_ConstDetailHandle > & exprinputs() const
Definition: SOP_NodeVerb.h:526
TempIndex(const UT_ExintArray &list)
Definition: SOP_NodeVerb.h:266
void setCurGdh(int index, const GU_DetailHandle &gdh) const
Definition: SOP_NodeVerb.h:913
exint nodeIdx() const
Definition: SOP_NodeVerb.h:102
static void registerVerb(SOP_NodeVerb *verb)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:734
const ForbiddenNodeMap * myPrevNodes
Definition: SOP_NodeVerb.h:554
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:785
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value)
Definition: SOP_NodeVerb.h:306
PreCookedNodeInputs(const UT_Array< GU_ConstDetailHandle > &gdps)
Definition: SOP_NodeVerb.h:614
Unsorted map container.
Definition: UT_Map.h:107
virtual ParmType getNestParmType(TempIndex idx) const
Definition: SOP_NodeVerb.h:286
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:805
GLenum clamp
Definition: glcorearb.h:1234
virtual void getParmValue(exint idx, UT_Vector2D &value) const
Definition: SOP_NodeVerb.h:210
virtual void setParmValue(exint idx, const exint &value)
Definition: SOP_NodeVerb.h:229
void addTransformError(const OP_Node &node, const char *label=0) const
Definition: SOP_NodeVerb.h:815
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:808
SOP_NodeCache * myCache
Definition: SOP_NodeVerb.h:981
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const
Definition: SOP_NodeVerb.h:294
bool cookInput(exint idx) override
Definition: SOP_NodeVerb.h:627
exint operator[](const exint off) const
Definition: SOP_NodeVerb.h:274
void clearCurGdh(int index) const
Definition: SOP_NodeVerb.h:915
UT_Vector2T< fpreal64 > UT_Vector2D
virtual void setParmValue(exint idx, const UT_Vector4D &value)
Definition: SOP_NodeVerb.h:237
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value)
Definition: SOP_NodeVerb.h:307
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) const
Definition: SOP_NodeVerb.h:141
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void selectPoint(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:853
UT_ErrorSeverity addMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Methods to add directly to any present error manager.
Definition: SOP_NodeVerb.h:792
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const
Definition: SOP_NodeVerb.h:297
const OP_Context & getContext() const
Definition: SOP_NodeVerb.h:688
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:122
void clearCurVertexNum(int index) const
Definition: SOP_NodeVerb.h:931
int64 exint
Definition: SYS_Types.h:125
UT_ErrorSeverity addMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Methods to add directly to any present error manager.
Definition: SOP_NodeVerb.h:118
void resetLocalVarRefs() const
Definition: SOP_NodeVerb.h:911
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:101
UT_ErrorSeverity
Definition: UT_Error.h:25
UT_Array< GU_ConstDetailHandle > myExprInputs
Definition: SOP_NodeVerb.h:530
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value)
Definition: SOP_NodeVerb.h:310
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value)
Definition: SOP_NodeVerb.h:301
UT_Vector4T< int64 > UT_Vector4I
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) const
Definition: SOP_NodeVerb.h:826
OP_Node * getCwd() const
The getCwd() should be used to evaluate relative paths.
Definition: SOP_NodeVerb.h:745
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:131
void select(const GA_Range &range, bool use_rtype=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:865
virtual ParmType getParmType(exint idx) const
Definition: SOP_NodeVerb.h:204
TempIndex(std::initializer_list< exint > list)
Definition: SOP_NodeVerb.h:258
const UT_Array< GU_ConstDetailHandle > & myInputs
Definition: SOP_NodeVerb.h:977
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:226
GLuint const GLchar * name
Definition: glcorearb.h:786
UT_Vector3T< int64 > UT_Vector3I
GLenum src
Definition: glcorearb.h:1793
virtual void setParmValue(exint idx, const UT_Matrix3D &value)
Definition: SOP_NodeVerb.h:241
bool setupLocalVars() const
Shims for local variables.
Definition: SOP_NodeVerb.h:909
virtual void getParmValue(exint idx, UT_Vector4D &value) const
Definition: SOP_NodeVerb.h:214
float fpreal32
Definition: SYS_Types.h:200
exint size() const
Definition: UT_Array.h:609
static void unregisterVerb(SOP_NodeVerb *verb)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:690
GU_DetailHandle & myDestGdh
Definition: SOP_NodeVerb.h:976
virtual bool doPartialInputCook() const
Definition: SOP_NodeVerb.h:991
NodeInputs & exprinputs() const
Definition: SOP_NodeVerb.h:674
UT_ErrorManager * error() const
Definition: SOP_NodeVerb.h:684
virtual void resetLocalVariables(SOP_Node *sop) const
UT_ErrorManager * error() const
Definition: SOP_NodeVerb.h:108
void clearCurPoint(int index) const
Definition: SOP_NodeVerb.h:919
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:811
const UT_Array< GU_ConstDetailHandle > & myGdps
Definition: SOP_NodeVerb.h:649
A range of elements in an index-map.
Definition: GA_Range.h:42
DEP_MicroNode * myDepNode
Definition: SOP_NodeVerb.h:983
const SOP_NodeParms * myParms
Definition: SOP_NodeVerb.h:696
virtual void setParmValue(exint idx, const UT_Vector2D &value)
Definition: SOP_NodeVerb.h:233
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const
Definition: SOP_NodeVerb.h:290
GA_Size GA_Offset
Definition: GA_Types.h:640
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const
Definition: SOP_NodeVerb.h:296
virtual void getParmValue(exint idx, PRM_DataItemHandle &value) const
Definition: SOP_NodeVerb.h:226
virtual void getParmValue(exint idx, UT_Matrix4D &value) const
Definition: SOP_NodeVerb.h:220
virtual void getParmValue(exint idx, fpreal &value) const
Definition: SOP_NodeVerb.h:208
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:126
GU_DetailHandle unloadInput(exint idx, bool flushce) override
Definition: SOP_NodeVerb.h:640
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value)
Definition: SOP_NodeVerb.h:304
GU_ConstDetailHandle inputGeoHandle(exint idx) const
Definition: SOP_NodeVerb.h:768
const char * getFullPath(UT_String &str) const
Definition: PRM_ParmOwner.h:46
const T & parms() const
Definition: SOP_NodeVerb.h:775
const SOP_NodeParms * myParms
Definition: SOP_NodeVerb.h:980
virtual void setupLocalVariables(SOP_Node *sop, const UT_Array< GU_ConstDetailHandle > &inputs) const
const exint * begin() const
Definition: SOP_NodeVerb.h:272
T * getCookNode() const
Definition: SOP_NodeVerb.h:737
void addExplicitInput(DEP_MicroNode &inp, bool check_dup=true) const
Methods to wire directly to the optional depnode.
Definition: SOP_NodeVerb.h:788
void selectPrimitive(GA_Offset primoff, bool prim_sel=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:849
GLuint64EXT * result
Definition: glew.h:14311
virtual void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
Definition: SOP_NodeVerb.h:247
void setCurPrim(int index, GA_Offset off) const
Definition: SOP_NodeVerb.h:925
UT_ErrorManager * myError
Definition: SOP_NodeVerb.h:698
bool destroySelection() const
Definition: SOP_NodeVerb.h:894
UT_Array< UT_StringHolder > stringdata
Definition: SOP_NodeVerb.h:47
T clampMaxValue(fpreal maxvalue, const T &src) const
Definition: SOP_NodeVerb.h:332
void select(GU_SelectionHandle selection, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:834
virtual void setParmValue(exint idx, const fpreal &value)
Definition: SOP_NodeVerb.h:231
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
void addExplicitInput(DEP_MicroNode &inp)
Definition: SOP_NodeVerb.h:114
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const
Definition: SOP_NodeVerb.h:292
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:152
virtual exint nInputs() const =0
void selectFrom(const GEO_Primitive &prim, bool sel_prim=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:857
UT_ErrorManager * myError
Definition: SOP_NodeVerb.h:155
int hasInput() override
virtual const char * getNestParmName(TempIndex idx) const
Definition: SOP_NodeVerb.h:285
void clearSelection() const
Definition: SOP_NodeVerb.h:880
virtual bool usesCE() const
SOP_Node * getSrcNode() const
The node that generated this verb, if any...
Definition: SOP_NodeVerb.h:743
bool hasInput(exint idx) const override
Returns if the input is wired.
Definition: SOP_NodeVerb.h:620
GLuint num
Definition: glew.h:2695
virtual void setParmValue(exint idx, const UT_Matrix2D &value)
Definition: SOP_NodeVerb.h:239
void setCurPoint(int index, GA_Offset off) const
Definition: SOP_NodeVerb.h:917
void selectInputGroup(const GA_Group *group, GA_GroupType grouptype) const
Definition: SOP_NodeVerb.h:873
const UT_IntArray & timedeps() const
Definition: SOP_NodeVerb.h:527
virtual exint getNumParms() const
Definition: SOP_NodeVerb.h:202
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const
Definition: SOP_NodeVerb.h:291
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
void setExprInputs(const UT_Array< GU_ConstDetailHandle > &inputs, const UT_IntArray &timedeps)
Definition: SOP_NodeVerb.h:520
virtual bool hasInput(exint idx) const =0
Returns if the input is wired.
virtual SOP_NodeCache * allocCache() const
Definition: SOP_NodeVerb.h:499
virtual exint getNestNumParms(TempIndex idx) const
Definition: SOP_NodeVerb.h:284
void selectPointsFrom(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:861
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value)
Definition: SOP_NodeVerb.h:309
CookParms(GU_DetailHandle &destgdh, const UT_Array< GU_ConstDetailHandle > &inputs, SOP_CookEngine cookengine, OP_Node *node, const OP_Context &context, const SOP_NodeParms *parms, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
Definition: SOP_NodeVerb.h:706
long long int64
Definition: SYS_Types.h:116
void markInputUnused(exint idx) override
Definition: SOP_NodeVerb.h:647
const OP_Context & getContext() const
Definition: SOP_NodeVerb.h:746
UT_Vector3T< fpreal64 > UT_Vector3D
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:137
void clearCurPrim(int index) const
Definition: SOP_NodeVerb.h:927
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value)
Definition: SOP_NodeVerb.h:302
virtual void setParmValue(exint idx, const UT_Vector3D &value)
Definition: SOP_NodeVerb.h:235
SOP_CookEngine
Definition: SOP_NodeVerb.h:50
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value)
Definition: SOP_NodeVerb.h:303
virtual void getParmValue(exint idx, exint &value) const
Definition: SOP_NodeVerb.h:206
virtual ~SOP_NodeParms()
Definition: SOP_NodeVerb.h:75
virtual bool evaluatesParametersDuringCook() const
virtual void getParmValue(exint idx, UT_Vector3D &value) const
Definition: SOP_NodeVerb.h:212
void setCurVertexNum(int index, exint num) const
Definition: SOP_NodeVerb.h:929
void select(GA_GroupType gtype=GA_GROUP_PRIMITIVE) const
Definition: SOP_NodeVerb.h:830
LoadParms(SOP_NodeParms *parms, SOP_CookEngine cookengine, const SOP_GraphProxy *graph, exint nodeidx, const OP_Context &context, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
Definition: SOP_NodeVerb.h:80
UT_SharedPtr< GU_Selection > GU_SelectionHandle
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value)
Definition: SOP_NodeVerb.h:300
virtual bool cookInputs(const InputParms &parms) const
Definition: SOP_NodeVerb.h:992
UT_ErrorManager * error() const
Definition: SOP_NodeVerb.h:784
bool hasInput(exint idx) const
Definition: SOP_NodeVerb.h:757
UT_Matrix2T< fpreal64 > UT_Matrix2D
virtual void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const
Definition: SOP_NodeVerb.h:298
const OP_Context & myContext
Definition: SOP_NodeVerb.h:979
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
virtual ~SOP_NodeVerb()
Definition: SOP_NodeVerb.h:475
virtual void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const
Definition: SOP_NodeVerb.h:289
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:109
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
GU_DetailHandle inputGeo(exint idx) override
Returns an invalid handle if the input isn't wired or not yet cooked.
Definition: SOP_NodeVerb.h:633
void select(const GEO_Primitive &prim, bool sel_prim=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:845
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:796
**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
UT_LockedRawPtr< UT_ErrorManager, OP_Lock > getLockedErrorManager() const
Definition: SOP_NodeVerb.h:969
InputParms(NodeInputs &inputs, NodeInputs &exprinputs, const OP_Context &context, const SOP_NodeParms *parms, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
Definition: SOP_NodeVerb.h:655
void setCurVertex(int index, GA_Offset off) const
Definition: SOP_NodeVerb.h:921
A map of string to various well defined value types.
Definition: UT_Options.h:84
void select(const GA_Group &group, bool use_gtype=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:840
A class holding a VEX function.
Definition: CVEX_Function.h:30
virtual void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const
Definition: SOP_NodeVerb.h:288
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value)
Definition: SOP_NodeVerb.h:308
fpreal64 fpreal
Definition: SYS_Types.h:277
const SOP_GraphProxy * myGraph
Definition: SOP_NodeVerb.h:151
SOP_NodeCache * cache() const
Definition: SOP_NodeVerb.h:106
T * data()
Definition: UT_Array.h:785
OP_API OP_Director * OPgetDirector()
bool selectionEnabled() const
Definition: SOP_NodeVerb.h:901
DEP_MicroNode * myDepNode
Definition: SOP_NodeVerb.h:699
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:800
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:159
GLuint index
Definition: glcorearb.h:786
virtual const char * getParmName(exint idx) const
Definition: SOP_NodeVerb.h:203
UT_Map< const OP_Node *, NodeExecuteInfo > ForbiddenNodeMap
Definition: SOP_NodeVerb.h:534
virtual int64 getMemoryUsage(bool inclusive) const
Definition: SOP_NodeVerb.h:312
SYS_FORCE_INLINE bool UTisstring(const char *s)
UT_StringHolder formatError(const char *msg) const
Prefix errors so we can get sensible results.
Definition: SOP_NodeVerb.h:947
int64 getMemoryUsage(bool inclusive) const
Definition: SOP_NodeVerb.h:37
A global error manager scope.
void resetLocalVariableAccessed() const
Tracks if any local variables were accessed by op functions.
Definition: SOP_NodeVerb.h:938
#define SOP_API
Definition: SOP_API.h:10
GLboolean GLuint group
Definition: glew.h:2750
const GU_Detail * inputGeo(exint idx) const
Definition: SOP_NodeVerb.h:763
GLsizei const GLfloat * value
Definition: glcorearb.h:824
void setVariableOrder(int detail, int prim, int pt, int vtx) const
Definition: SOP_NodeVerb.h:933
void clearCurVertex(int index) const
Definition: SOP_NodeVerb.h:923
virtual bool cookInput(exint idx)=0
SOP_NodeCache * cache() const
Definition: SOP_NodeVerb.h:780
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:748
virtual void setParmValue(exint idx, const UT_StringHolder &value)
Definition: SOP_NodeVerb.h:245
GLenum GLint * range
Definition: glcorearb.h:1925
virtual void setParmValue(exint idx, const UT_Matrix4D &value)
Definition: SOP_NodeVerb.h:243
void clearSelection(GA_GroupType gtype) const
Definition: SOP_NodeVerb.h:887
const T & parms() const
Definition: SOP_NodeVerb.h:104
Definition: core.h:1131
NodeInputs & inputs() const
Definition: SOP_NodeVerb.h:672
virtual void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
Definition: SOP_NodeVerb.h:224
SOP_NodeCache * myCache
Definition: SOP_NodeVerb.h:154
bool wasLocalVariableAccessed() const
Definition: SOP_NodeVerb.h:940
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value)
Definition: SOP_NodeVerb.h:305
UT_Vector4T< fpreal64 > UT_Vector4D
virtual bool requiresCEFlush() const
type
Definition: core.h:1059
virtual void getParmValue(exint idx, UT_Matrix2D &value) const
Definition: SOP_NodeVerb.h:216
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:134
Call VEX from C++.
Definition: CVEX_Context.h:203
void coerceValue(T &result, const S &src) const
Definition: SOP_NodeVerb.h:320
#define SYSmin(a, b)
Definition: SYS_Math.h:1514
exint nInputs() const
Definition: SOP_NodeVerb.h:756
SOP_NodeParms * myParms
Definition: SOP_NodeVerb.h:150
const OP_Context & myContext
Definition: SOP_NodeVerb.h:700
const OP_Context & context() const
Definition: SOP_NodeVerb.h:107
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
virtual void setParmValue(exint idx, const PRM_DataItemHandle &value)
Definition: SOP_NodeVerb.h:249
virtual CookMode cookMode(const SOP_NodeParms *parms) const
void addExplicitInput(DEP_MicroNode &inp, bool check_dup)
Methods to wire directly to the optional depnode.
Definition: SOP_NodeVerb.h:112
GU_DetailHandle & gdh() const
The initial state of gdh depends on the cookMode()
Definition: SOP_NodeVerb.h:728
UT_ErrorManager * myError
Definition: SOP_NodeVerb.h:982
virtual void copyFrom(const SOP_NodeParms *src)
Definition: SOP_NodeVerb.h:180
T clampMinValue(fpreal minvalue, const T &src) const
Definition: SOP_NodeVerb.h:326
DEP_MicroNode * myDepNode
Definition: SOP_NodeVerb.h:156
UT_Matrix3T< fpreal64 > UT_Matrix3D
virtual void getParmValue(exint idx, UT_StringHolder &value) const
Definition: SOP_NodeVerb.h:222
SOP_NodeCache * myCache
Definition: SOP_NodeVerb.h:697