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  /// Whether the underlying verb manages data ids. All new nodes
752  /// should manage data ids, this is purely for the
753  /// SOP_NodeParmsOptions wrapper.
754  bool getManagesDataIDs() const
755  {
756  if (!myNode) return true;
757  return myNode->getFlags().getManagesDataIDs();
758  }
759 
760  /// Accessors designed to simplify porting from old cook code.
761  /// Just becaues you have nInputs does not mean all are wired or
762  /// cooked. But, the number demanded by your OP_Operator shall
763  /// be present.
764  /// Inputs have been locked & preserve request set
765  exint nInputs() const { return myInputs.size(); }
766  bool hasInput(exint idx) const
767  {
768  if (idx < 0 || idx >= myInputs.size())
769  return false;
770  return myInputs(idx).isValid();
771  }
772  const GU_Detail *inputGeo(exint idx) const
773  {
774  if (!hasInput(idx)) return 0;
775  return myInputs(idx).gdp();
776  }
778  {
779  if (!hasInput(idx)) return GU_ConstDetailHandle();
780  return myInputs(idx);
781  }
782 
783  template <typename T>
784  const T &parms() const
785  { return *UTverify_cast<const T*>(myParms); }
786 
787  /// Cache may, or may not, persist between cooks. But it is
788  /// guaranteed this is the only thread using the cache.
789  SOP_NodeCache *cache() const { return myCache; }
790 
791  /// Error managers are not locked, so do not pass this to
792  /// something that forks.
793  UT_ErrorManager *error() const { return myError; }
794  DEP_MicroNode *depnode() const { return myDepNode; }
795 
796  /// Methods to wire directly to the optional depnode.
797  void addExplicitInput(DEP_MicroNode &inp, bool check_dup=true) const
798  { if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
799 
800  /// Methods to add directly to any present error manager.
801  UT_ErrorSeverity addMessage (const char *type, int code, const char *msg=0,
802  const UT_SourceLocation *loc=0) const
803  { if (myError) return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
804  return UT_ERROR_MESSAGE; }
805  UT_ErrorSeverity addWarning (const char *type, int code, const char *msg=0,
806  const UT_SourceLocation *loc=0) const
807  { if (myError) return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
808  return UT_ERROR_WARNING; }
809  UT_ErrorSeverity addError (const char *type, int code, const char *msg=0,
810  const UT_SourceLocation *loc=0) const
811  { if (myError) return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
812  return UT_ERROR_ABORT; }
813 
814  UT_ErrorSeverity sopAddMessage (int code, const char *msg=0,
815  const UT_SourceLocation *loc=0) const
816  { return addMessage("SOP", code, msg, loc); }
817  UT_ErrorSeverity sopAddWarning (int code, const char *msg=0,
818  const UT_SourceLocation *loc=0) const
819  { return addWarning("SOP", code, msg, loc); }
820  UT_ErrorSeverity sopAddError (int code, const char *msg=0,
821  const UT_SourceLocation *loc=0) const
822  { return addError("SOP", code, msg, loc); }
823 
824  void addTransformError(const OP_Node &node, const char *label=0) const
825  {
826  UT_String path;
827  node.getFullPath(path);
828  if (UTisstring(label))
829  {
830  path += "(as "; path += label; path += ")";
831  }
832  addError("OP", OP_ERR_TRANSFORM, path);
833  }
834 
836  bool borrow_only = false) const
837  { if (myError) getLockedErrorManager()->stealErrors(src,0, -1, UT_ERROR_NONE, borrow_only); }
838 
840  { if (getNode())
841  getNode()->select(gtype); }
842 
844  bool add_to_sel = false) const
845  { if (getNode())
846  getNode()->select(selection, add_to_sel); }
847 
848  // Select the group. opt use its type as sel type
849  void select(const GA_Group &group, bool use_gtype = true,
850  bool add_to_sel = false) const
851  { if (getNode())
852  getNode()->select(group, use_gtype, add_to_sel); }
853 
854  void select(const GEO_Primitive &prim, bool sel_prim = true,
855  bool add_to_sel = false) const
856  { if (getNode())
857  getNode()->select(prim, sel_prim, add_to_sel); }
858  void selectPrimitive(GA_Offset primoff, bool prim_sel = true,
859  bool add_to_sel = false) const
860  { if (getNode())
861  getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
862  void selectPoint(GA_Offset ptoff, bool point_sel = true,
863  bool add_to_sel = false) const
864  { if (getNode())
865  getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
866  void selectFrom(const GEO_Primitive &prim, bool sel_prim = true,
867  bool add_to_sel = false) const
868  { if (getNode())
869  getNode()->selectFrom(prim, sel_prim, add_to_sel); }
870  void selectPointsFrom(GA_Offset ptoff, bool point_sel = true,
871  bool add_to_sel = false) const
872  { if (getNode())
873  getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
874  void select(const GA_Range &range, bool use_rtype = true,
875  bool add_to_sel = false) const
876  { if (getNode())
877  getNode()->select(range, use_rtype, add_to_sel); }
878 
879  // Selects input based on the group supplied and the group type. If
880  // group is not null, then it's type is used, otherwise the group type
881  // is used.
883  GA_GroupType grouptype) const
884  { if (getNode())
885  getNode()->selectInputGroup(group, grouptype); }
886 
887  // If no selection is present, then create a new empty primitive cook
888  // selection group. Otherwise, clear the selection.
889  void clearSelection() const
890  { if (getNode())
891  getNode()->clearSelection(); }
892 
893  /// If the cook selection group is not of the given type, create an empty
894  /// cook selection group of that type. Otherwise, clear the existing cook
895  /// selection group.
896  void clearSelection(GA_GroupType gtype) const
897  { if (getNode())
898  getNode()->clearSelection(gtype); }
899 
900  // Blow away the selection and reinitialize it to 0. Much more radical
901  // than clearSelection(), which leaves behind a clean, empty selection.
902  // This method returns 1 if it had anything to destroy, else 0.
903  bool destroySelection() const
904  { if (getNode())
905  return getNode()->destroySelection();
906  return false;
907  }
908 
909  // Return 1 if selection is enabled, 0 if false.
910  bool selectionEnabled() const
911  {
912  if (!getNode())
913  return false;
914  return getNode()->getHighlight();
915  }
916 
917  /// Shims for local variables
918  bool setupLocalVars() const
919  { if (getNode()) return getNode()->setupLocalVars(); return false; }
920  void resetLocalVarRefs() const
921  { if (getNode()) getNode()->resetLocalVarRefs(); }
922  void setCurGdh(int index, const GU_DetailHandle &gdh) const
923  { if (getNode()) getNode()->setCurGdh(index, gdh); }
924  void clearCurGdh(int index) const
925  { if (getNode()) getNode()->clearCurGdh(index); }
926  void setCurPoint(int index, GA_Offset off) const
927  { if (getNode()) getNode()->setCurPoint(index, off); }
928  void clearCurPoint(int index) const
929  { if (getNode()) getNode()->clearCurPoint(index); }
930  void setCurVertex(int index, GA_Offset off) const
931  { if (getNode()) getNode()->setCurVertex(index, off); }
932  void clearCurVertex(int index) const
933  { if (getNode()) getNode()->clearCurVertex(index); }
934  void setCurPrim(int index, GA_Offset off) const
935  { if (getNode()) getNode()->setCurPrim(index, off); }
936  void clearCurPrim(int index) const
937  { if (getNode()) getNode()->clearCurPrim(index); }
938  void setCurVertexNum(int index, exint num) const
939  { if (getNode()) getNode()->setCurVertexNum(index, num); }
940  void clearCurVertexNum(int index) const
941  { if (getNode()) getNode()->clearCurVertexNum(index); }
942  void setVariableOrder(int detail, int prim,
943  int pt, int vtx) const
944  { if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
945 
946  /// Tracks if any local variables were accessed by op functions.
948  { if (getNode()) getNode()->myUsesSOPLocalVar = false; }
950  { if (!getNode()) return false;
951  return getNode()->myUsesSOPLocalVar; }
952 
953 
954  protected:
955  /// Prefix errors so we can get sensible results.
956  UT_StringHolder formatError(const char *msg) const
957  {
958  // Do not prefix with the path in traditional cook
959  // as it is properly assigned.
960  if (myCookEngine == SOP_COOK_TRADITIONAL)
961  return msg;
963  if (!msg || !*msg)
964  return result;
966  UT_String fullpath;
967  if (myNode)
968  myNode->getFullPath(fullpath);
969  else
970  fullpath = "<internal>";
971  buf.sprintf("%s: %s", (const char *) fullpath, msg);
972  result = buf;
973  return result;
974  }
975 
976  // NOTE: Do not hold onto the ptr object longer than necessary!
979  {
981  *myError, myErrorLock);
982  }
983 
994  };
995 
996  /// If doPartialInputCook is false, we do assume cookInputs() will
997  /// apply to all inputs regardless of node parameters. If local
998  /// variables require the inputs, it is required for this to be false
999  /// for the inputs to be available when parameters are evaluated.
1000  virtual bool doPartialInputCook() const { return false; }
1001  virtual bool cookInputs(const InputParms &parms) const
1002  {
1003  for (exint i = 0; i < parms.inputs().nInputs(); i++)
1004  if (parms.inputs().hasInput(i))
1005  {
1006  if (!parms.inputs().cookInput(i))
1007  return false;
1008  }
1009  return true;
1010  }
1011 
1012  /// These are for the old-cook path to allow nodes to store relevant
1013  /// local variable information inside the SOP for callbacks. The
1014  /// evalVariableValue() should be guarded to ensure it doesn't
1015  /// run from a forbidden node.
1016  /// These can be used if the local variables depend only on the inputs
1017  /// and are not change for every parameter. If they change for
1018  /// every parameter, traditional cook paths will need to setup &
1019  /// evaluate explicitly in the cook method.
1020  virtual void setupLocalVariables(SOP_Node *sop, const UT_Array<GU_ConstDetailHandle> &inputs) const {}
1021  virtual void resetLocalVariables(SOP_Node *sop) const {}
1022 
1023  /// Traditional nodes may evaluate parameters while cooking, this is
1024  /// required for dynamic local variables. If this is true, no pre-cooking
1025  /// of the parameter struture will be done in the traditional cook
1026  /// path avoiding double cooking parameters. Remember other cook paths
1027  /// will not have access to the sop so should use the parameter structure!
1028  virtual bool evaluatesParametersDuringCook() const { return false; }
1029 
1030  virtual CookMode cookMode(const SOP_NodeParms *parms) const { return COOK_DUPLICATE; }
1031 
1032  /// Attributes can end up cached on the GPU. Some SOPs are able
1033  /// to handle this. Some are ambivalent (such as switch or null)
1034  /// And some expect all GPU buffers to be flushed prior to
1035  /// operating. If a node requires a CE flush, all inputs
1036  /// will be clean.
1037  virtual bool requiresCEFlush() const { return true; }
1038  virtual bool usesCE() const { return false; }
1039 
1040  /// Compute the output geometry.
1041  virtual void cook(const CookParms &cookparms) const = 0;
1042 
1043  /// This is used to update handles, it only has an effect
1044  /// if oldsop is non-null, ie, we are in the old cook path.
1045  /// Neither the group nor the gdp have to persist beyond this call.
1046  /// Pass -1 for the grouptype if there is no grouptype parameter.
1047  void notifyGroupParmListeners(SOP_Node *oldsop,
1048  int groupparm_idx,
1049  int grouptype_idx,
1050  const GU_Detail *gdp,
1051  const GA_Group *group) const;
1052 
1053 protected:
1054 };
1055 
1056 #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:1535
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:922
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
bool getManagesDataIDs() const
Definition: SOP_NodeVerb.h:754
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:794
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:83
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:814
GLenum clamp
Definition: glcorearb.h:1233
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:824
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:817
SOP_NodeCache * myCache
Definition: SOP_NodeVerb.h:990
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:924
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:3340
void selectPoint(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:862
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:801
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:940
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:920
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:835
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:874
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:986
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:244
GLuint const GLchar * name
Definition: glcorearb.h:785
UT_Vector3T< int64 > UT_Vector3I
GLenum src
Definition: glcorearb.h:1792
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:918
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:479
static void unregisterVerb(SOP_NodeVerb *verb)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:690
GU_DetailHandle & myDestGdh
Definition: SOP_NodeVerb.h:985
virtual bool doPartialInputCook() const
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:928
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:820
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:992
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:777
const char * getFullPath(UT_String &str) const
Definition: PRM_ParmOwner.h:46
const T & parms() const
Definition: SOP_NodeVerb.h:784
const SOP_NodeParms * myParms
Definition: SOP_NodeVerb.h:989
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:797
void selectPrimitive(GA_Offset primoff, bool prim_sel=true, bool add_to_sel=false) const
Definition: SOP_NodeVerb.h:858
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:934
UT_ErrorManager * myError
Definition: SOP_NodeVerb.h:698
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
bool destroySelection() const
Definition: SOP_NodeVerb.h:903
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:843
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:30
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:170
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:866
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:889
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:926
void selectInputGroup(const GA_Group *group, GA_GroupType grouptype) const
Definition: SOP_NodeVerb.h:882
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:2544
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:870
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:936
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:938
void select(GA_GroupType gtype=GA_GROUP_PRIMITIVE) const
Definition: SOP_NodeVerb.h:839
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
UT_ErrorManager * error() const
Definition: SOP_NodeVerb.h:793
bool hasInput(exint idx) const
Definition: SOP_NodeVerb.h:766
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:988
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:2539
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:854
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Definition: SOP_NodeVerb.h:805
**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:978
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:930
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:849
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:655
OP_API OP_Director * OPgetDirector()
bool selectionEnabled() const
Definition: SOP_NodeVerb.h:910
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:809
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:159
GLuint index
Definition: glcorearb.h:785
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:956
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:947
#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:772
GLsizei const GLfloat * value
Definition: glcorearb.h:823
void setVariableOrder(int detail, int prim, int pt, int vtx) const
Definition: SOP_NodeVerb.h:942
void clearCurVertex(int index) const
Definition: SOP_NodeVerb.h:932
virtual bool cookInput(exint idx)=0
SOP_NodeCache * cache() const
Definition: SOP_NodeVerb.h:789
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:1924
virtual void setParmValue(exint idx, const UT_Matrix4D &value)
Definition: SOP_NodeVerb.h:243
void clearSelection(GA_GroupType gtype) const
Definition: SOP_NodeVerb.h:896
const T & parms() const
Definition: SOP_NodeVerb.h:104
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:949
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
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:175
void coerceValue(T &result, const S &src) const
Definition: SOP_NodeVerb.h:320
#define SYSmin(a, b)
Definition: SYS_Math.h:1536
exint nInputs() const
Definition: SOP_NodeVerb.h:765
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:991
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