HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Parameters.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: OP Library (C++)
7  *
8  * COMMENTS: OP_Parameters encapsulates the parameter lists used
9  * by the OP library.
10  *
11  */
12 
13 #ifndef __OP_Parameters_h__
14 #define __OP_Parameters_h__
15 
16 #include "OP_API.h"
17 #include "OP_Context.h"
18 #include "OP_Error.h"
19 #include "OP_Lock.h"
20 #include "OP_Stat.h"
21 #include "OP_Value.h"
22 
23 #include <PRM/PRM_ChanState.h>
24 #include <PRM/PRM_ParmList.h>
25 #include <PRM/PRM_ParmOwner.h>
26 #include <CH/CH_ExprLanguage.h>
27 #include <EXPR/EX_Error.h>
28 
29 #include <UT/UT_Assert.h>
30 #include <UT/UT_LockedRawPtr.h>
31 #include <UT/UT_String.h>
32 #include <UT/UT_StringHolder.h>
33 #include <UT/UT_StringSet.h>
34 #include <UT/UT_Thread.h>
35 #include <SYS/SYS_Types.h>
36 
37 #include <iosfwd>
38 
39 class UT_BitArray;
40 class UT_Ramp;
41 class UT_JSONValueMap;
42 class PRM_Parm;
43 class PRM_ParmList;
44 class PRM_ScriptPage;
45 class PRM_ScriptImports;
46 class PRM_BatchList;
47 class CH_LocalVariable;
48 class CMD_Args;
49 class OP_Channels;
50 class OP_Operator;
51 class OP_ParmCache;
52 class OP_PostIt;
53 class OP_MultiparmInfo;
55 class OP_SpareParms;
56 
57 
58 enum OP_ScopeOp {
62  OP_SCOPE_NUM_OPS // sentinel
63 };
64 
70 };
71 
73 {
74 public:
75  // allow_nonchannels - determines whether or not we should scope parameters
76  // that don't have CH_Channel pointers associated with
77  // them.
78  //
79  // exclude_animated - determines whether or not to exclude channels that
80  // are time dependent.
81  //
82  // exclude_constant - determines whether or not to exclude channels that
83  // are not time dependent.
84  //
85  // include_only_nonint_keys - determines whether or not to include only
86  // those channels that have non integer
87  // keyframes.
88  // scoped_related_layers - scope the related animation layers
89  // scope_type - modify the scope or display flags
90  OP_ScopeOptions(bool allow_nonchannels, bool exclude_animated,
91  bool exclude_constant, bool include_only_nonint_keys,
92  bool scoped_related_layers,
93  OP_ScopeType scope_type) :
94  myAllowNonChannels(allow_nonchannels),
95  myExcludeAnimated(exclude_animated),
96  myExcludeConstant(exclude_constant),
97  myIncludeOnlyNonIntKeys(include_only_nonint_keys),
98  myScopedRelatedLayers(scoped_related_layers),
99  myScopeType( scope_type )
100  {}
101 
107 
109 };
110 
112 {
113 public:
115  : myTime(t)
116  , myFollowCHOPLayerOverrides(true)
117  , myFollowReferences(true)
118  , myStopAtEditabledHDA(false)
119  , myFollowedParmMicroNodes(nullptr)
120  {
121  }
122 
128 };
129 
131 {
132 public:
133  OP_GetAutoScopedOptions( fpreal t, bool follow_layer_overrides,
134  bool include_animated, bool follow_channel_refs, bool include_autoscope )
135  : myOpt(t)
136  , myOpt2(t)
137  , myIncludeAnimated(include_animated)
138  , myIncludeAutoScope(include_autoscope)
139  {
140  myOpt.myFollowCHOPLayerOverrides = follow_layer_overrides;
141  myOpt.myFollowReferences = follow_channel_refs;
142 
143  OP_FollowChanRefsOptions opt2(t);
144  myOpt2.myFollowCHOPLayerOverrides = false;
145  myOpt2.myFollowReferences = true;
146  myOpt2.myStopAtEditabledHDA = true;
147  }
148 
153 
155 };
156 
158 {
159 public:
161  const UT_String &getName() const { return myName; }
162 
164  OP_Operator *getOperator() const { return myTableEntry; }
165 
166  // This function updates the hidden/disable flags on all parameters by
167  // asking both the conditionals and the overridden updateParmsFlags
168  // functions.
169  // Returns true if something was changed.
170  bool updateParmsAndSpareParmsFlags();
171 
172  // Clone a parameter by referencing all the parameters of the "from"
173  // OP_Parameters.
174  virtual unsigned referenceAllParameters(OP_Parameters *from,
175  bool relative_references = true);
176  /// Reference a single parameter from the @c from node. This builds a
177  /// channel reference for the given parameter index.
178  /// If the @c relative_path isn't specified, it will be computed as @code
179  /// from->getFullPath(frompath);
180  /// this->getFullPath(thispath);
181  /// relative_path.getRelativePath(thispath, frompath);
182  /// @endcode
183  virtual bool referenceSingleParameter(OP_Parameters *from,
184  int parm_idx,
185  const char *relative_path = NULL);
186 
187  // Methods for dealing with channels & key frames
188  void animate(unsigned idx);
189  void animate(const char *name);
190  void deAnimate(unsigned idx);
191  void deAnimate(const char *name);
192  CH_Channel *addChannel(const char *name);
193  CH_Channel *getChannel(const char *name);
194  const CH_Channel *getChannel(const char *name) const;
195  int destroyChannel(const char *name);
196 
197  bool isObsoleteChannel(const char *name) const;
198 
199  void takeActivateParm(uint idx, bool enable=true);
200  void takeActivateParm(const char *name, bool enable=true);
201  void takeActivateParm(PRM_Parm *parm, bool enable=true);
203  { takeActivateParm(idx, false); }
204  void takeDeactivateParm(const char *name)
205  { takeActivateParm(name, false); }
207  { takeActivateParm(parm, false); }
208 
209  bool takeIsActiveParm(uint idx);
210  bool takeIsActiveParm(const char *name);
211  bool takeIsActiveParm(const PRM_Parm *parm);
212 
213  // Activates the parm for the take if it should be automatically
214  // activated based on its current state and the current take state.
215  void takeAutoActivateParm(PRM_Parm *) override;
216 
217  fpreal findKey(fpreal t, int direction) const;
218 
219  PRM_ChanState getChanState(fpreal t, bool scoped_only) const;
221  { return getChanState(t, false); }
222  void updatePending(fpreal t);
223  bool isPending( fpreal t );
224 
225  OP_Channels *getChannels() const { return myChannels; }
226 
227  // This gets the variable value AS as string. Not the string corresponding
228  // to the specified index! Note that you should call the base class if you
229  // don't handle the given index.
230  virtual bool evalVariableValue(UT_String &val, int index,
231  int thread);
232  // Note that you should call the base class if you don't handle the given
233  // index.
234  virtual bool evalVariableValue(fpreal &val, int index, int thread);
235 
236  /// @deprecated Please override evalVariableValue() above instead
237  SYS_DEPRECATED(10.0)
238  virtual void getVariableString(int index, UT_String &value,
239  int thread);
240  /// @deprecated Please override the evalVariableValue() above instead
241  SYS_DEPRECATED(10.0)
242  virtual float getVariableValue(int index, int thread);
243 
244  int getNumParms() const
245  { return myParmList->getEntries(); }
246  int getParmIndex(const UT_StringRef &name) const
247  { return myParmList->getParmIndex(name); }
249  {
250  PRM_Parm *p = myParmList->getParmPtr(i);
251  UT_ASSERT(p);
252  return *p;
253  }
254  const PRM_Parm &getParm(int i) const
255  {
256  const PRM_Parm *p = myParmList->getParmPtr(i);
257  UT_ASSERT(p);
258  return *p;
259  }
261  {
262  PRM_Parm *p = myParmList->getParmPtr(name);
263  UT_ASSERT(p);
264  return *p;
265  }
266  const PRM_Parm &getParm(const UT_StringRef &name) const
267  {
268  const PRM_Parm *p = myParmList->getParmPtr(name);
269  UT_ASSERT(p);
270  return *p;
271  }
272  bool hasParm(const UT_StringRef &name) const
273  { return myParmList->getParmPtr(name) != 0; }
275  { return myParmList->getParmPtr(name); }
276  const PRM_Parm *getParmPtr(const UT_StringRef &name) const
277  { return myParmList->getParmPtr(name); }
278  PRM_Parm *getParmPtrInst(const char *name, const int *inst,
279  int nestlevel = 1);
280  const PRM_Parm *getParmPtrInst(const char *name, const int *inst,
281  int nestlevel = 1) const;
282 
283  // This function is called when our spare parm definition is changing.
284  // Parses the supplied dialog script and uses it to update the spare
285  // parms for this node.
286  virtual bool changeSpareParms(UT_IStream &ds, UT_String &errors);
287 
288  // Returns true if we are in the middle of chaning our spare parm
289  // definition. Lets us avoid handling certain events (such as multiparm
290  // change handling in OPUI_Dialog).
292  { return myChangingSpareParms; }
293 
294  // Utility for deleting all spare parms
295  void deleteAllSpareParms();
296 
297  // This is a secondary parm list where all obsolete parameters are
298  // placed (if any)
301  PRM_ParmList *&obsolete_parms) override;
302 
303  // After any call which might have loaded something into the ObsoleteList,
304  // we should call this to resolve those parameters:
305  virtual void resolveObsoleteParms(PRM_ParmList * /*obsolete_parms*/)
306  { /*nothing at this level*/ }
307 
308  /// Sync the node assuming that it is currently at old_version to the
309  /// current_version.
310  virtual void syncNodeVersion(
311  const char *old_version,
312  const char *current_version,
313  bool *node_deleted)
314  { /*nothing at this level*/ }
315 
316  /// Track down the parameter associated with a given property
317  /// @{
318  virtual bool getParameterOrProperty(
319  const UT_StringRef &name,
320  fpreal now,
321  OP_Node *&op,
322  PRM_Parm *&parm,
323  bool create_missing_multiparms,
324  PRM_ParmList *obsolete=0);
325  virtual bool getParameterOrPropertyByChannel(
326  const UT_StringRef &chname,
327  fpreal now,
328  OP_Node *&op,
329  PRM_Parm *&parm,
330  int &vector_index,
331  PRM_ParmList *obsolete=0);
332  /// @}
333 
334  /// This just calls getParameterOrProperty() with
335  /// create_missing_multiparms=false and allows for const correctness.
337  const UT_StringRef &name,
338  fpreal now,
339  OP_Node *&op,
340  PRM_Parm *&parm,
341  PRM_ParmList *obsolete) const
342  {
343  return const_cast<OP_Parameters*>(this)->getParameterOrProperty(
344  name, now, op, parm, false, obsolete);
345  }
346 
347  /// Fill out the property lookup list with parameters.
348  /// Returns the total of found and resolved parameters in the list
349  /// (whether they were resolved by previous calls or this particular call,
350  /// ie, NOT the total of nodes found in this call)
351  virtual int findParametersOrProperties(fpreal now,
352  OP_PropertyLookupList &list);
353 
354  // Take a PRM_Parm pointer, and look at its value. If it is a simple
355  // channel reference, return the referenced node, parm, and vecidx.
357  OP_Node *&newop,
358  PRM_Parm *&newparm,
359  int &newvecidx)
360  {
361  return followChannelReferencesOneStepT(
362  opt, newop, newparm, newvecidx,
363  SYSgetSTID());
364  }
365  static bool followChannelReferencesOneStepT(const OP_FollowChanRefsOptions& opt,
366  OP_Node *&newop,
367  PRM_Parm *&newparm,
368  int &newvecidx,
369  int thread);
371  OP_Node *&newop,
372  PRM_Parm *&newparm,
373  int &newvecidx)
374  {
375  followChannelReferencesT(
376  opt, newop, newparm, newvecidx,
377  SYSgetSTID());
378  }
380  OP_Node *&newop,
381  PRM_Parm *&newparm,
382  int &newvecidx,
383  CH_Channel *chp
384  )
385  {
386  return followChannelReferencesWithDepsT(
387  opt, newop, newparm, newvecidx,
388  SYSgetSTID(), chp );
389  }
390  static void followChannelReferencesT(const OP_FollowChanRefsOptions& opt,
391  OP_Node *&newop,
392  PRM_Parm *&newparm,
393  int &newvecidx,
394  int thread);
395  static bool followChannelReferencesWithDepsT(const OP_FollowChanRefsOptions& opt,
396  OP_Node *&newop,
397  PRM_Parm *&newparm,
398  int &newvecidx,
399  int thread,
400  CH_Channel *chp
401  );
403  {
404  followChannelReferencesT(opt, ref, SYSgetSTID());
405  }
406  static void followChannelReferencesT(const OP_FollowChanRefsOptions& opt, CH_ChannelRef &ref,
407  int thread);
408 
409  static void getValueAsProcessedNodePaths(fpreal t,
410  UT_WorkBuffer &resultbuf,
411  const PRM_Parm *parm, int index,
412  const OP_Node *srcnode
413  );
414  static void getValueAsProcessedNodePaths(fpreal t,
415  UT_Array<UT_StringHolder> &resultarr,
416  const PRM_Parm *parm, int index,
417  const OP_Node *srcnode
418  );
419 
420  const OP_Stat &getStat() const { return myStats; }
421  OP_Stat &getStat() { return myStats; }
422 
423  // "vi" refers to the vector index. "pi" is the parameter index.
424  // "pn" refers to the parmeter name. "v" refers to the vector component.
425  // if v == -1, all components are affected.
426  bool enableParm(int pi, int state, int v = -1);
427  bool enableParm(const char *pn, int state, int v = -1);
428  bool enableParmInst(const char *name, const int *inst,
429  int state, int nestlevel = 1,
430  int v = -1);
431  unsigned getEnableState(int pi, int v = -1);
432  unsigned getEnableState(const char *pn, int v = -1);
433  unsigned getEnableStateInst(const char *name, const int *inst,
434  int nestlevel = 1, int v = -1);
435 
436  bool setVisibleState(int pi, bool state, int v = -1);
437  bool setVisibleState(const char *pn, bool state, int v = -1);
438  bool setVisibleStateInst(const char *name, const int *inst,
439  int state, int nestlevel = 1,
440  int v = -1);
441 
442  bool getVisibleState(int pi, int v = -1);
443  bool getVisibleState(const char *pn, int v = -1);
444 
445  /// @anchor OP_Node_EvalParameters
446 
447  /// @name Parameter evaluation
448  ///
449  /// - int pi @n Parameter index
450  /// - const char *pn @n Parameter name token
451  /// - int *pi @n Parameter index passed by reference, looked up
452  /// using 'pn'
453  /// - PRM_Parm *parm @n Parameter by reference
454  /// - int vi @n Component index of a parameter
455  /// - fpreal t @n Evaluation time
456  /// - int thread @n Thread id (ie. return value from SYSgetSTID())
457  // @{
458  exint evalInt(int pi, int vi, fpreal t) const
459  { return evalIntT(pi, vi, t, SYSgetSTID()); }
460  exint evalIntT(int pi, int vi, fpreal t, int thread) const;
461  exint evalInt(const UT_StringRef &pn, int vi, fpreal t) const
462  { return evalIntT(pn, vi, t, SYSgetSTID()); }
463  exint evalIntT(const UT_StringRef &pn, int vi, fpreal t,
464  int thread) const;
465  exint evalInt(const UT_StringRef &pn, int *pi, int vi,
466  fpreal t) const
467  { return evalIntT(pn, pi, vi, t, SYSgetSTID()); }
468  exint evalIntT(const UT_StringRef &pn, int *pi, int vi,
469  fpreal t, int thread) const;
470  exint evalInt(const PRM_Parm *parm, int vi, fpreal t) const
471  { return evalIntT(parm, vi, t, SYSgetSTID()); }
472  exint evalIntT(const PRM_Parm *parm, int vi, fpreal t,
473  int thread) const;
474 
475  fpreal evalFloat(int pi, int vi, fpreal t) const
476  { return evalFloatT(pi, vi, t, SYSgetSTID()); }
477  fpreal evalFloatT(int pi, int vi, fpreal t, int thread) const;
478  fpreal evalFloat(const UT_StringRef &pn, int vi,
479  fpreal t) const
480  { return evalFloatT(pn, vi, t, SYSgetSTID()); }
481  fpreal evalFloatT(const UT_StringRef &pn, int vi, fpreal t,
482  int thread) const;
483  fpreal evalFloat(const UT_StringRef &pn, int *pi, int vi,
484  fpreal t) const
485  { return evalFloatT(pn, pi, vi, t, SYSgetSTID()); }
486  fpreal evalFloatT(const UT_StringRef &pn, int *pi, int vi,
487  fpreal t, int thread) const;
488  fpreal evalFloat(const PRM_Parm *parm, int vi, fpreal t) const
489  { return evalFloatT(parm, vi, t, SYSgetSTID()); }
490  fpreal evalFloatT(const PRM_Parm *parm, int vi, fpreal t,
491  int thread) const;
492 
493  // Evaluate an array of floats
494  void evalFloats(int pi, fpreal64 *v, fpreal t) const
495  { return evalFloatsT(pi, v, t, SYSgetSTID()); }
496  void evalFloatsT(int pi, fpreal64 *v,
497  fpreal t, int thread) const;
498  void evalFloats(const UT_StringRef &pn, fpreal64 *v,
499  fpreal t) const
500  { return evalFloatsT(pn, v, t, SYSgetSTID()); }
501  void evalFloatsT(const UT_StringRef &pn, fpreal64 *v,
502  fpreal t, int thread) const;
503  void evalFloats(const UT_StringRef &pn, int *pi,
504  fpreal64 *v, fpreal t) const
505  { return evalFloatsT(pn, pi, v, t, SYSgetSTID()); }
506  void evalFloatsT(const UT_StringRef &pn, int *pi,
507  fpreal64 *v, fpreal t, int thread) const;
508  void evalFloats(const PRM_Parm *parm, fpreal64 *v, fpreal t) const
509  { return evalFloatsT(parm, v, t, SYSgetSTID()); }
510  void evalFloatsT(const PRM_Parm *parm, fpreal64 *v,
511  fpreal t, int thread) const;
512 
513  // @deprecated Please use the other evalFloats() versions
514  // @{
515  void evalFloatsT(int pi, fpreal32 *v,
516  fpreal t, int thread) const;
517  void evalFloats(int pi, fpreal32 *v, fpreal t) const
518  { return evalFloatsT(pi, v, t, SYSgetSTID()); }
519  void evalFloatsT(const UT_StringRef &pn, fpreal32 *v,
520  fpreal t, int thread) const;
521  void evalFloats(const UT_StringRef &pn, fpreal32 *v,
522  fpreal t) const
523  { return evalFloatsT(pn, v, t, SYSgetSTID()); }
524  void evalFloatsT(const UT_StringRef &pn, int *pi,
525  fpreal32 *v, fpreal t, int thread) const;
526  void evalFloats(const UT_StringRef &pn, int *pi,
527  fpreal32 *v, fpreal t) const
528  { return evalFloatsT(pn, pi, v, t, SYSgetSTID()); }
529  void evalFloatsT(const PRM_Parm *parm, fpreal32 *v,
530  fpreal t, int thread) const;
531  void evalFloats(const PRM_Parm *parm, fpreal32 *v,
532  fpreal t) const
533  { return evalFloatsT(parm, v, t, SYSgetSTID()); }
534  void evalFloatsInst(const UT_StringRef &name,
535  const int *inst,
536  fpreal32 *v, fpreal t,
537  int nestlevel = 1) const;
538  // @}
539 
540  // String evaluation, expanding any inline expressions (backticks) and
541  // variables
542  void evalString(UT_String &val, int pi, int vi,
543  fpreal t) const
544  { return evalStringT(val, pi, vi, t,SYSgetSTID()); }
545  void evalString(UT_StringHolder &val, int pi, int vi,
546  fpreal t) const
547  { return evalStringT(val, pi, vi, t,SYSgetSTID()); }
548  void evalStringT(UT_String &val, int pi, int vi, fpreal t,
549  int thread) const;
550  void evalStringT(UT_StringHolder &val, int pi, int vi,
551  fpreal t, int thread) const;
553  const UT_StringRef &pn, int vi,
554  fpreal t) const
555  { return evalStringT(val, pn, vi, t,SYSgetSTID()); }
557  const UT_StringRef &pn, int vi,
558  fpreal t) const
559  { return evalStringT(val, pn, vi, t,SYSgetSTID()); }
560  void evalStringT(UT_String &val,
561  const UT_StringRef &pn, int vi,
562  fpreal t, int thread) const;
563  void evalStringT(UT_StringHolder &val,
564  const UT_StringRef &pn, int vi,
565  fpreal t, int thread) const;
567  const UT_StringRef &pn, int *pi,
568  int vi, fpreal t) const
569  {
570  return evalStringT(val, pn, pi, vi, t,
571  SYSgetSTID());
572  }
574  const UT_StringRef &pn, int *pi,
575  int vi, fpreal t) const
576  {
577  return evalStringT(val, pn, pi, vi, t,
578  SYSgetSTID());
579  }
580  void evalStringT(UT_String &val,
581  const UT_StringRef &pn, int *pi,
582  int vi, fpreal t, int thread) const;
583  void evalStringT(UT_StringHolder &val,
584  const UT_StringRef &pn, int *pi,
585  int vi, fpreal t, int thread) const;
586  void evalString(UT_String &val, const PRM_Parm *parm,
587  int vi, fpreal t) const
588  {
589  return evalStringT(val, parm, vi, t,
590  SYSgetSTID());
591  }
593  int vi, fpreal t) const
594  {
595  return evalStringT(val, parm, vi, t,
596  SYSgetSTID());
597  }
598  void evalStringT(UT_String &val, const PRM_Parm *parm,
599  int vi, fpreal t, int thread) const;
600  void evalStringT(UT_StringHolder &val, const PRM_Parm *parm,
601  int vi, fpreal t, int thread) const;
602 
603  // String evaluation, with no expression or variable expansion
604  void evalStringRaw(UT_String &val, int pi, int vi,
605  fpreal t) const
606  {
607  return evalStringRawT(val, pi, vi, t,
608  SYSgetSTID());
609  }
610  void evalStringRawT(UT_String &val, int pi, int vi, fpreal t,
611  int thread) const;
613  const UT_StringRef &pn, int vi,
614  fpreal t) const
615  {
616  return evalStringRawT(val, pn, vi, t,
617  SYSgetSTID());
618  }
619  void evalStringRawT(UT_String &val,
620  const UT_StringRef &pn, int vi,
621  fpreal t, int thread) const;
623  int *pi, int vi, fpreal t) const
624  {
625  return evalStringRawT(val, pn, pi, vi, t,
626  SYSgetSTID());
627  }
628  void evalStringRawT(UT_String &val,
629  const UT_StringRef &pn, int *pi,
630  int vi, fpreal t, int thread) const;
631  void evalStringRaw(UT_String &val, const PRM_Parm *parm,
632  int vi, fpreal t) const
633  {
634  return evalStringRawT(val, parm, vi, t,
635  SYSgetSTID());
636  }
637  void evalStringRawT(UT_String &val, const PRM_Parm *parm,
638  int vi, fpreal t, int thread) const;
639 
640  PRM_DataItemHandle evalData(int pi, int vi, fpreal t) const
641  { return evalDataT(pi, vi, t, SYSgetSTID()); }
642  PRM_DataItemHandle evalDataT(int pi, int vi, fpreal t, int thread) const;
644  fpreal t) const
645  { return evalDataT(pn, vi, t, SYSgetSTID()); }
646  PRM_DataItemHandle evalDataT(const UT_StringRef &pn, int vi,
647  fpreal t, int thread) const;
648  PRM_DataItemHandle evalData(const UT_StringRef &pn, int *pi, int vi,
649  fpreal t) const
650  { return evalDataT(pn, pi, vi, t, SYSgetSTID()); }
651  PRM_DataItemHandle evalDataT(const UT_StringRef &pn, int *pi, int vi,
652  fpreal t, int thread) const;
653  PRM_DataItemHandle evalData(const PRM_Parm *parm, int vi, fpreal t) const
654  { return evalDataT(parm, vi, t, SYSgetSTID()); }
655  PRM_DataItemHandle evalDataT(const PRM_Parm *parm, int vi, fpreal t,
656  int thread) const;
657 
658  // JSON map evaluation, expanding any inline expressions (backticks) and
659  // variables
660  void evalJSONMap(UT_JSONValueMap &val, int pi, int vi,
661  fpreal t) const
662  { return evalJSONMapT(
663  val, pi, vi, t, SYSgetSTID()); }
664  void evalJSONMapT(UT_JSONValueMap &val, int pi, int vi,
665  fpreal t, int thread) const;
667  const UT_StringRef &pn,
668  int vi, fpreal t) const
669  { return evalJSONMapT(
670  val, pn, vi, t, SYSgetSTID()); }
671  void evalJSONMapT(UT_JSONValueMap &val,
672  const UT_StringRef &pn,
673  int vi, fpreal t, int thread) const;
675  const UT_StringRef &pn,
676  int *pi, int vi, fpreal t) const
677  {
678  return evalJSONMapT(
679  val, pn, pi, vi, t, SYSgetSTID());
680  }
681  void evalJSONMapT(UT_JSONValueMap &val,
682  const UT_StringRef &pn,
683  int *pi, int vi, fpreal t, int thread)
684  const;
686  const PRM_Parm *parm, int vi, fpreal t)
687  const
688  {
689  return evalJSONMapT(
690  val, parm, vi, t, SYSgetSTID());
691  }
692  void evalJSONMapT(UT_JSONValueMap &val,
693  const PRM_Parm *parm, int vi, fpreal t,
694  int thread) const;
695 
696  // JSON map evaluation, with no expression or variable expansion
697  void evalJSONMapRaw(UT_JSONValueMap &val, int pi, int vi,
698  fpreal t) const
699  {
700  return evalJSONMapRawT(
701  val, pi, vi, t, SYSgetSTID());
702  }
703  void evalJSONMapRawT(UT_JSONValueMap &val, int pi, int vi,
704  fpreal t, int thread) const;
706  const UT_StringRef &pn,
707  int vi, fpreal t) const
708  {
709  return evalJSONMapRawT(
710  val, pn, vi, t, SYSgetSTID());
711  }
712  void evalJSONMapRawT(UT_JSONValueMap &val,
713  const UT_StringRef &pn,
714  int vi, fpreal t, int thread) const;
716  const UT_StringRef &pn,
717  int *pi, int vi, fpreal t) const
718  {
719  return evalJSONMapRawT(
720  val, pn, pi, vi, t, SYSgetSTID());
721  }
722  void evalJSONMapRawT(UT_JSONValueMap &val,
723  const UT_StringRef &pn,
724  int *pi, int vi, fpreal t, int thread)
725  const;
727  const PRM_Parm *parm, int vi, fpreal t)
728  const
729  {
730  return evalJSONMapRawT(
731  val, parm, vi, t, SYSgetSTID());
732  }
733  void evalJSONMapRawT(UT_JSONValueMap &val,
734  const PRM_Parm *parm, int vi,
735  fpreal t, int thread) const;
736  // @}
737 
738  /// @name Multi-Parameter evaluation
739  ///
740  /// - name @n Parameter name token
741  /// - inst @n Array of instance indices to evaluate at
742  /// - vi @n Component index of a parameter
743  /// - t @n Evaluation time
744  /// - nestlevel @n Number of entries in 'inst'
745  /// - thread @n Thread id (ie. return value from SYSgetSTID())
746  // @{
748  const int *inst, int vi,
749  fpreal t, int nestlevel = 1) const
750  {
751  return evalIntInstT(name, inst, vi, t,
752  SYSgetSTID(), nestlevel);
753  }
754  exint evalIntInstT(const UT_StringRef &name,
755  const int *inst, int vi,
756  fpreal t, int thread,
757  int nestlevel = 1) const;
759  const int *inst, int vi,
760  fpreal t, int nestlevel = 1) const
761  {
762  return evalFloatInstT(name, inst, vi, t,
763  SYSgetSTID(), nestlevel);
764  }
765  fpreal evalFloatInstT(const UT_StringRef &name,
766  const int *inst, int vi,
767  fpreal t, int thread,
768  int nestlevel = 1) const;
770  const int *inst,
771  fpreal64 *v, fpreal t,
772  int nestlevel = 1) const
773  {
774  return evalFloatsInstT(name, inst, v, t,
775  SYSgetSTID(), nestlevel);
776  }
777  void evalFloatsInstT(const UT_StringRef &name,
778  const int *inst,
779  fpreal64 *v, fpreal t, int thread,
780  int nestlevel = 1) const;
782  const int *inst,
783  UT_String &val, int vi, fpreal t,
784  int nestlevel = 1) const
785  {
786  return evalStringInstT(name, inst, val, vi,
787  t, SYSgetSTID(), nestlevel);
788  }
790  const int *inst,
791  UT_StringHolder &val, int vi, fpreal t,
792  int nestlevel = 1) const
793  {
794  return evalStringInstT(name, inst, val, vi,
795  t, SYSgetSTID(), nestlevel);
796  }
797  void evalStringInstT(const UT_StringRef &name,
798  const int *inst,
799  UT_String &val, int vi, fpreal t,
800  int thread, int nestlevel = 1) const;
801  void evalStringInstT(const UT_StringRef &name,
802  const int *inst,
803  UT_StringHolder &val, int vi, fpreal t,
804  int thread, int nestlevel = 1) const;
806  const int *inst,
807  UT_String &val, int vi, fpreal t,
808  int nestlevel = 1) const
809  {
810  return evalStringInstRawT(name, inst, val, vi,
811  t, SYSgetSTID(), nestlevel);
812  }
813  void evalStringInstRawT(const UT_StringRef &name,
814  const int *inst,
815  UT_String &val, int vi, fpreal t,
816  int thread,
817  int nestlevel = 1) const;
819  const int *inst, int vi,
820  fpreal t, int nestlevel = 1) const
821  {
822  return evalDataInstT(name, inst, vi, t,
823  SYSgetSTID(), nestlevel);
824  }
825  PRM_DataItemHandle evalDataInstT(const UT_StringRef &name,
826  const int *inst, int vi,
827  fpreal t, int thread,
828  int nestlevel = 1) const;
829  // @}
830 
831  /// @name Property evaluation
832  ///
833  /// Properties will be evaluated if the parameter is not found.
834  ///
835  /// - parm_name @n Parameter name token
836  /// - vec_index @n Component index of a parameter
837  /// - now @n Evaluation time
838  /// - thread @n Thread id (ie. return value from SYSgetSTID())
839  /// - parmptr @n optional source parameter return value
840  // @{
841  bool evalParameterOrProperty(const UT_StringRef &parm_name,
842  int vec_index,
843  fpreal now,
844  int &value,
845  PRM_Parm **parmptr = NULL) const
846  {
847  return evalParameterOrPropertyT(parm_name,
848  vec_index, now, value, SYSgetSTID(),
849  parmptr);
850  }
851  bool evalParameterOrPropertyT(const UT_StringRef &parm_name,
852  int vec_index,
853  fpreal now,
854  int &value,
855  int thread,
856  PRM_Parm **parmptr=NULL) const;
857  bool evalParameterOrProperty(const UT_StringRef &parm_name,
858  int vec_index,
859  fpreal now,
860  fpreal &values,
861  PRM_Parm **parmptr=NULL) const
862  {
863  return evalParameterOrPropertyT(parm_name,
864  vec_index, now, values, SYSgetSTID(),
865  parmptr);
866  }
867  bool evalParameterOrPropertyT(const UT_StringRef &parm_name,
868  int vec_index,
869  fpreal now,
870  fpreal &values, int thread,
871  PRM_Parm **parmptr=NULL) const;
872  bool evalParameterOrProperty(const UT_StringRef &parm_name,
873  int vec_index,
874  fpreal now,
875  UT_String &value,
876  PRM_Parm **parmptr=NULL) const
877  {
878  return evalParameterOrPropertyT(parm_name,
879  vec_index, now, value, SYSgetSTID(),
880  parmptr);
881  }
882  bool evalParameterOrPropertyT(const UT_StringRef &parm_name,
883  int vec_index,
884  fpreal now,
885  UT_String &value,
886  int thread,
887  PRM_Parm **parmptr=NULL) const;
889  const UT_StringRef &parm_name,
890  int vec_index,
891  fpreal now,
892  UT_String &value,
893  PRM_Parm **parmptr=NULL) const
894  {
895  return evalParameterOrPropertyRawT(parm_name,
896  vec_index, now, value, SYSgetSTID(),
897  parmptr);
898  }
899  bool evalParameterOrPropertyRawT(
900  const UT_StringRef &parm_name,
901  int vec_index,
902  fpreal now,
903  UT_String &value,
904  int thread,
905  PRM_Parm **parmptr=NULL) const;
907  const UT_StringRef &parm_name,
908  int vec_index,
909  fpreal now,
910  UT_String &value,
911  PRM_Parm **parmptr=NULL) const
912  {
913  return evalParameterOrPropertyExprT(parm_name,
914  vec_index, now, value, SYSgetSTID(),
915  parmptr);
916  }
917  bool evalParameterOrPropertyExprT(
918  const UT_StringRef &parm_name,
919  int vec_index,
920  fpreal now,
921  UT_String &value,
922  int thread,
923  PRM_Parm **parmptr=NULL) const;
924 
925  bool evalVectorProperty(const UT_StringRef &parm_name,
926  fpreal now,
927  int *values,
928  int vec_size,
929  PRM_Parm **parmptr = NULL) const
930  {
931  return evalVectorPropertyT(parm_name,
932  now, values, vec_size, SYSgetSTID(),
933  parmptr);
934  }
935  bool evalVectorPropertyT(const UT_StringRef &parm_name,
936  fpreal now,
937  int *values,
938  int vec_size,
939  int thread,
940  PRM_Parm **parmptr = NULL) const;
941  bool evalVectorProperty(const UT_StringRef &parm_name,
942  fpreal now,
943  fpreal *values,
944  int vec_size,
945  PRM_Parm **parmptr = NULL) const
946  {
947  return evalVectorPropertyT(parm_name,
948  now, values, vec_size, SYSgetSTID(),
949  parmptr);
950  }
951  bool evalVectorPropertyT(const UT_StringRef &parm_name,
952  fpreal now,
953  fpreal *values,
954  int vec_size,
955  int thread,
956  PRM_Parm **parmptr = NULL) const;
957  // @}
958 
959  /// @anchor OP_Node_SetParameters
960 
961  /// @name Setting parameter values
962  ///
963  /// - parmi @n Parameter index
964  /// - parmname @n Parameter name string
965  /// - vectori @n Component index of a parameter
966  /// - t @n Evaluation time
967  /// - value @n Value to set
968  /// - h @n If true, it will set a keyframe if the parameter
969  /// has a channel. If false, then the value will
970  /// need to committed first.
971  // @{
972  void setInt(int parmi, int vectori, fpreal t, exint value);
973  void setInt(const char *parmname, int vectori, fpreal t, exint value);
974  void setInt(const char *parmname, int &parmi, int vectori, fpreal t,
975  exint value);
976  void setFloat(int parmi, int vectori, fpreal t,
977  fpreal value,
979  void setFloat(const char *parmname, int vectori, fpreal t,
980  fpreal value,
982  void setFloat(const char *parmname, int &parmi, int vectori,
983  fpreal t, fpreal value,
985  void setString(const UT_StringRef &val,
986  CH_StringMeaning meaning,
987  int parmi, int vectori,
988  fpreal t);
989  void setString(const UT_StringRef &val,
990  CH_StringMeaning meaning,
991  const char *parmname, int vectori, fpreal t);
992  void setString(const UT_StringRef &val,
993  CH_StringMeaning meaning,
994  const char *parmname,
995  int &parmi, int vectori, fpreal t);
996  void setData(int parmi, int vectori, fpreal t,
997  const PRM_DataItemHandle &val);
998  void setData(const char *parmname, int vectori, fpreal t,
999  const PRM_DataItemHandle &val);
1000  void setData(const char *parmname, int &parmi, int vectori, fpreal t,
1001  const PRM_DataItemHandle &val);
1002  // @}
1003 
1004  /// @name Setting parameter values, following channel references
1005  ///
1006  /// These functions will follow simple channel references first, and then
1007  /// set the value on the destination parameter.
1008  ///
1009  /// - pi @n Parameter index
1010  /// - pn @n Parameter name string
1011  /// - vi @n Component index of a parameter
1012  /// - t @n Time at which to set the value
1013  /// - val @n Value to set
1014  /// - add_key @n If PRM_AK_SET_KEY, it will set a keyframe if the
1015  /// parameter has a channel and the current value differs.
1016  /// If PRM_AK_FORCE_KEY, it will set a keyframe if the
1017  /// parameter has a channel regardless of the current value.
1018  /// If PRM_AK_MARK_PENDING, then the value will need to be
1019  /// committed first.
1020  /// - propagate @n If true, it notify observers
1021  /// - thread @n Thread id (ie. return value from SYSgetSTID())
1022  // @{
1023  void setChRefInt(int pi, int vi, fpreal t, exint val,
1025  bool propagate=true);
1026  void setChRefInt(const char *pn, int vi, fpreal t, exint val,
1028  bool propagate=true);
1029  void setChRefFloat(int pi, int vi, fpreal t, fpreal val,
1030  PRM_AddKeyType add_key=
1032  bool propagate=true);
1033  void setChRefFloat(const char *pn, int vi, fpreal t,
1034  fpreal val,
1035  PRM_AddKeyType add_key=
1037  bool propagate=true);
1038  void setChRefString(const UT_StringRef &val,
1039  CH_StringMeaning meaning,
1040  int pi, int vi,
1041  fpreal t,
1042  PRM_AddKeyType add_key=
1044  bool propagate=true);
1045  void setChRefString(int pi, int vi,
1046  fpreal t,
1047  const UT_StringRef &val,
1048  CH_StringMeaning meaning,
1049  PRM_AddKeyType add_key=
1051  bool propagate=true)
1052  {
1053  setChRefString(val, meaning, pi, vi, t,
1054  add_key, propagate);
1055  }
1056  void setChRefString(const UT_StringRef &val,
1057  CH_StringMeaning meaning,
1058  const char *pn,
1059  int vi, fpreal t,
1060  PRM_AddKeyType add_key=
1062  bool propagate=true);
1063  void setChRefString(const char *pn,
1064  int vi, fpreal t,
1065  const UT_StringRef &val,
1066  CH_StringMeaning meaning,
1067  PRM_AddKeyType add_key=
1069  bool propagate=true)
1070  {
1071  setChRefString(val, meaning, pn, vi, t,
1072  add_key, propagate);
1073  }
1074 
1075  void setChRefData(int pi, int vi, fpreal t, const PRM_DataItemHandle &val,
1076  PRM_AddKeyType add_key=
1078  bool propagate=true);
1079 
1080  void setChRefData(const char *pn, int vi, fpreal t,
1081  const PRM_DataItemHandle &val,
1082  PRM_AddKeyType add_key=
1084  bool propagate=true);
1085 
1086  // @}
1087 
1088  /// @name Setting property values
1089  ///
1090  /// The setParameterOrProperty methods will track down, not only channel
1091  /// references, but also property parameter references.
1092  /// The bool result indicates whether the parameter was actually set.
1093  /// Some possible causes of failure are:
1094  /// - Parameter or property not found
1095  /// - Permissions error
1096  /// - Locked parameter
1097  /// - Out of bounds vector index
1098  ///
1099  /// Parameters:
1100  /// - parm_name @n Parameter name string
1101  /// - vec_index @n Component index of a parameter
1102  /// - now @n Time at which to set the value
1103  /// - val @n Value to set
1104  /// - set_key @n If true, it will set a keyframe if the parameter
1105  /// has a channel. If false, then the value will
1106  /// need to committed first.
1107  /// - propagate @n If true, it notify observers
1108  // @{
1109  bool setParameterOrProperty(const char *parm_name,
1110  int vec_index,
1111  fpreal now,
1112  int32 value,
1113  bool set_key=false,
1114  bool propagate=true);
1115  bool setParameterOrProperty(const char *parm_name,
1116  int vec_index,
1117  fpreal now,
1118  int64 value,
1119  bool set_key=false,
1120  bool propagate=true);
1121  bool setParameterOrProperty(const char *parm_name,
1122  int vec_index,
1123  fpreal now,
1124  fpreal value,
1125  bool set_key=false,
1126  bool propagate=true);
1127  bool setParameterOrProperty(const char *parm_name,
1128  int vec_index,
1129  fpreal now,
1130  const char *value,
1131  CH_StringMeaning meaning,
1132  bool set_key=false,
1133  bool propagate=true);
1134  // @}
1135 
1136  /// @name Multi-Parameter evaluation
1137  ///
1138  /// - name @n Parameter name token
1139  /// - inst @n Array of instance indices to evaluate at
1140  /// - vectori @n Component index of a parameter
1141  /// - t @n Evaluation time
1142  /// - nestlevel @n Number of entries in 'inst'
1143  /// - value @n Value to set
1144  // @{
1145  void setIntInst(exint value, const char *parmname,
1146  const int *inst, int vectori, fpreal t,
1147  int nestlevel = 1);
1148  void setFloatInst(fpreal value, const char *parmname,
1149  const int *inst, int vectori, fpreal t,
1150  int nestlevel = 1);
1151  void setStringInst(const UT_StringRef &value,
1152  CH_StringMeaning meaning,
1153  const char *parmname,
1154  const int *inst, int vectori, fpreal t,
1155  int nestlevel = 1);
1156  void setDataInst(const PRM_DataItemHandle &value,
1157  const char *parmname, const int *inst,
1158  int vectori, fpreal t, int nestlevel = 1);
1159  // @}
1160 
1161  /// @name Setting parameter values silently
1162  ///
1163  /// These methods do not trigger additional events to notify observers
1164  ///
1165  /// - int pi @n Parameter index
1166  /// - const char *pn @n Parameter name string
1167  /// - int &pi @n Parameter index, returned from 'pn' lookup
1168  /// - int vi @n Component index of a parameter
1169  /// - fpreal t @n Time at which to set the value
1170  /// - value @n Value to set
1171  // @{
1172  void setSilentInt(int parmi, int vectori, fpreal t,
1173  exint value);
1174  void setSilentInt(const char *parmname, int vectori,
1175  fpreal t, exint value);
1176  void setSilentInt(const char *parmname, int &parmi,
1177  int vectori, fpreal t,exint value);
1178 
1179  void setSilentFloat(int parmi, int vectori, fpreal t,
1180  fpreal value,
1182  void setSilentFloat(const char *parmname, int vectori,
1183  fpreal t, fpreal value,
1185  void setSilentFloat(const char *parmname,
1186  int &parmi, int vectori,
1187  fpreal t, fpreal value,
1189 
1190  void setSilentString(const UT_StringRef &value,
1191  CH_StringMeaning meaning,
1192  int parmi, int vectori, fpreal t);
1193  void setSilentString(const UT_StringRef &value,
1194  CH_StringMeaning meaning,
1195  const char *parmname, int vectori, fpreal t);
1196  void setSilentString(const UT_StringRef &value,
1197  CH_StringMeaning meaning,
1198  const char *parmname,
1199  int &parmi, int vectori, fpreal t);
1200  void setSilentData(int parmi, int vectori, fpreal t,
1201  const PRM_DataItemHandle &value);
1202  void setSilentData(const char *parmname, int vectori,
1203  fpreal t, const PRM_DataItemHandle &value);
1204  void setSilentData(const char *parmname,
1205  int &parmi, int vectori, fpreal t,
1206  const PRM_DataItemHandle &value);
1207 
1208  void setSilentIntInst(exint value, const char *parmname,
1209  const int *inst, int vectori,
1210  fpreal t, int nestlevel = 1);
1211  void setSilentFloatInst(fpreal value, const char *parmname,
1212  const int *inst, int vectori,
1213  fpreal t, int nestlevel = 1);
1214  void setSilentStringInst(const UT_StringRef &value,
1215  CH_StringMeaning meaning,
1216  const char *parmname,
1217  const int *inst, int vectori,
1218  fpreal t, int nestlevel = 1);
1219  void setSilentDataInst(const PRM_DataItemHandle &value,
1220  const char *parmname, const int *inst,
1221  int vectori, fpreal t, int nestlevel = 1);
1222  // @}
1223 
1224  CH_StringMeaning getStringMeaning(int pi, int vi, fpreal t) const;
1225  CH_StringMeaning getStringMeaning(const char *pn, int vi,
1226  fpreal t) const;
1227  CH_StringMeaning getStringMeaningInst(const char *name, const int *inst,
1228  int vi, fpreal t, int nest_level = 1) const;
1229 
1230  // Batch setting of parameters. The value stored in the batch list will be
1231  // assigned to the operator/parameter which the parameter was last
1232  // evaluated from. This assumes that the parameter list has actually been
1233  // evaluated. Modifications will be done in block mode.
1234  static void setBatchParms(PRM_BatchList &list, fpreal now,
1235  bool set_key=false,
1236  bool create_channels=false);
1237  static bool canSetBatchParms(PRM_BatchList &list, fpreal now);
1238 
1239  // When a new expression is created it will use the node's expression
1240  // language.
1241  CH_ExprLanguage getExprLanguage() const override;
1242  void setExprLanguage(CH_ExprLanguage language);
1243 
1244  // multiparm manipulation
1245  void insertMultiParmItem(const char *pn, int i);
1246  void removeMultiParmItem(const char *pn, int i);
1247 
1248  /// updateMultiParmFromRamp() will follow simple channel references as
1249  /// necessary
1250  void updateMultiParmFromRamp(fpreal t, const UT_Ramp &ramp,
1251  PRM_Parm &m, bool add_wrap,
1253  void updateRampFromMultiParm(fpreal t, const PRM_Parm &m,
1254  UT_Ramp &ramp, bool *time_dep = NULL,
1255  DEP_MicroNode *depnode = NULL) const;
1256 
1257  // This method converts an obsolete animated parm to a string parm. It
1258  // will create the necessary backticks for expressions. It does not,
1259  // however, support keyframed channel data or multiple-segment channels,
1260  // in which case the evaluated value at the given time is returned.
1261  // It also does not support CHOP overrides.
1262  // When reset_obs is true, the obsolete parameter is reset to factory
1263  // defaults after the expression has been extracted.
1264  // Returns true if successful, and false otherwise. False is returned
1265  // if the obsolete is at the factory default.
1266  bool convertObsAnimatedToStringExpression(
1267  PRM_ParmList *obsolete_parms,
1268  const char *pn, int vi, fpreal t,
1269  UT_String &result, bool reset_obs);
1270 
1271  /// Expand expressions within string value.
1272  ///
1273  /// This method will expand backtick expressions and local/global
1274  /// variables by modifying the input string. Always use this method instead
1275  /// of calling CH_Manager::expandString() directly within node evaluation
1276  /// code paths in order to establish proper node dependencies.
1277  ///
1278  /// @param channel_name Channel name of the parameter from where val
1279  /// was obtained from. This is important for
1280  /// establishing data and time dependencies.
1281  ///
1282  bool expandString(UT_String &val, fpreal t, int thread,
1283  const char *channel_name = 0);
1284 
1285  virtual int findString(const char *str, bool fullword,
1286  bool usewildcards) const;
1287  virtual int changeString(const char *from, const char *to,
1288  bool fullword);
1289 
1290  // These methods check to see if the current value differs from
1291  // the cached ones. The time is the time to evaluate the parm at,
1292  // this does NOT support independent dirty flags for multiple times
1293  // (and likely you wouldn't want that anyways)
1294  // cacheParmValues ONLY saves those who had been tested for dirtiness
1295  //
1296  // NOTE: This is deprecated, please use the override the
1297  // OP_Node::parmListMicroNode() method to detect parm value changes.
1298  //
1299  // This legacy mechanism will cause your parameter to be evaluated
1300  // multiple times per cook.
1301  bool isParmDirty(int idx, fpreal t);
1302  bool isParmDirty(const char *n, fpreal t);
1303  bool isParmDirtyInst(const char *name, const int *inst,
1304  fpreal t, int nestlevel=1);
1305  void cacheParmValues(const OP_Context &context);
1306  void clearParmCache();
1307 
1308  /// Query if a parameter is time dependent, by parm index. If comp == -1,
1309  /// any vector component that is time dependent will return true for the
1310  /// parm.
1311  bool isParmTimeDependent(int idx, int comp = -1) const;
1312 
1313  /// Query if a parameter is time dependent, by parm name. If comp == -1,
1314  /// any vector component that is time dependent will return true for the
1315  /// parm.
1316  bool isParmTimeDependent(const char *name,
1317  int comp = -1) const;
1318 
1319  // error stuff
1320  int getErrorMessages(UT_String &messages,
1322  = UT_ERROR_NONE)
1323  {
1324  ensureErrorsAreUpdatedSubclass();
1325 
1326  OP_Lock::Scope lock(myErrorManagerLock);
1327  stealGlobalErrors();
1328  return myErrorManager.getErrorMessages(messages,
1329  severity);
1330  }
1331 
1332  virtual void getRawErrors(UT_Array<UT_Error> &errors, bool update);
1333 
1334  int findError(const char *type, int code) const
1335  {
1336  OP_Lock::Scope lock(myErrorManagerLock);
1337  return myErrorManager.findError(type, code);
1338  }
1339 
1340  int removeError(int idx)
1341  {
1342  OP_Lock::Scope lock(myErrorManagerLock);
1343  return myErrorManager.removeError(idx);
1344  }
1345 
1347  {
1348  OP_Lock::Scope lock(myErrorManagerLock);
1349  myErrorManager.pruneDuplicates();
1350  }
1351 
1352  void opMessage(int code, const char *m=0) const
1353  { UTaddMessage("OP",code,m);}
1354  void opWarning(int code, const char *m=0) const
1355  { UTaddWarning("OP",code,m);}
1356  void opError(int code, const char *m=0) const
1357  { UTaddError("OP", code, m);}
1358  void opFatal(int code, const char *m=0) const
1359  { UTaddFatal("OP", code, m);}
1360 
1361  void opLocalError(int code, const char *m=0)
1362  {
1363  OP_Lock::Scope lock(myErrorManagerLock);
1364  myErrorManager.addError("OP", code, m);
1365  }
1366  void opLocalWarning(int code, const char *m=0)
1367  {
1368  OP_Lock::Scope lock(myErrorManagerLock);
1369  myErrorManager.addWarning("OP",code,m);
1370  }
1372  {
1373  OP_Lock::Scope lock(myErrorManagerLock);
1374  myErrorManager.addDeadlockError();
1375  }
1376 
1377  /// appendError() adds a generic error *directly* to this node's error
1378  /// manager.
1379  void appendError(const char *type,
1380  int code, const char *m,
1381  UT_ErrorSeverity sev)
1382  {
1383  if (!UTgetErrorManager()->isDisabled())
1384  {
1385  OP_Lock::Scope lock(myErrorManagerLock);
1386  myErrorManager.addGeneric(type, code, m, sev);
1387  }
1388  }
1389 
1390  void clearErrors() // use error(OP_Context&) to avoid querying the current thread id
1391  {
1393  OP_Lock::Scope lock(myErrorManagerLock);
1394  myErrorManager.clearAndDestroyErrors();
1395  }
1396 
1397  void clearErrors(OP_Context &context)
1398  {
1399  UTgetErrorManager(context.getThread())->clearAndDestroyErrors();
1400  OP_Lock::Scope lock(myErrorManagerLock);
1401  myErrorManager.clearAndDestroyErrors();
1402  }
1403 
1404  virtual OP_ERROR getErrorSeverity();
1405 
1406  exint getErrorVersion();
1407 
1408  bool hasDeadlockError() const
1409  {
1410  // We intentionally do NOT lock in this case
1411  return myErrorManager.hasDeadlockError();
1412  }
1413 
1414  virtual OP_ERROR error(OP_Context &context)
1415  {
1416  ensureErrorsAreUpdatedSubclass();
1417 
1418  UT_ErrorManager &mgr = *UTgetErrorManager(context.getThread());
1419  if (mgr.getNumErrors() > 0)
1420  {
1421  stealGlobalErrors();
1422  }
1423  else
1424  {
1425  // Even if we have no errors, we still need to
1426  // update the severity because error logging
1427  // might be disabled.
1428  myErrorManager.updateSeverity(
1429  mgr.getSeverity());
1430  }
1431  return myErrorManager.getSeverity();
1432  }
1433  bool hasError(OP_Context& context)
1434  { return error(context) >= UT_ERROR_ABORT; }
1435  virtual OP_ERROR error() // use error(OP_Context&) to avoid querying the current thread id
1436  {
1437  ensureErrorsAreUpdatedSubclass();
1438 
1440  if (mgr.getNumErrors() > 0)
1441  {
1442  stealGlobalErrors();
1443  }
1444  else
1445  {
1446  // Even if we have no errors, we still need to
1447  // update the severity because error logging
1448  // might be disabled.
1449  myErrorManager.updateSeverity(
1450  mgr.getSeverity());
1451  }
1452  return myErrorManager.getSeverity();
1453  }
1454  bool hasError()
1455  { return error() >= UT_ERROR_ABORT; }
1456  void stealErrors(UT_ErrorManager &src,
1457  bool borrow_only = false);
1458  OP_ERROR getSaveError();
1459  bool isGettingSaveError() const
1460  { return myIsGettingSaveError; }
1461 
1462  // This method should only be called from OP_Channels.
1463  void addChannelError(const char *type, int code,
1464  const char *msg = 0);
1465 
1466  void chChanged(CH_Channel *ch, CH_CHANGE_TYPE reason);
1467 
1468  virtual void saveParmsForUndo(bool scopedOnly = false,
1469  CH_Collection *collection = NULL);
1470  void saveSingleParmForUndo(PRM_Parm *parm);
1471  void saveParmForUndo(PRM_Parm *);
1472  virtual void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime);
1473 
1474  // Clear any undo flags for the node in question
1475  virtual void clearUndoFlags();
1476  virtual void setAnyUndoFlag();
1477  int getAnyUndoPending() const { return myAnyUndoFlagSet; }
1478 
1479  int canAccess(unsigned mask) const;
1480  bool canAccess(unsigned mask, const PRM_Parm *parm) const;
1481  bool canAccessChannel(uint mask,
1482  const CH_Channel *chp) const;
1483  void updateUserMask();
1484 
1485  bool canModifyFromUI(const PRM_Parm *parm, int vi) const;
1486 
1487  // If an OP references external files, this method should be implemented to
1488  // reload new data which is out of date with the external file. If data
1489  // was re-loaded, then the method should return 1 (otherwise 0).
1490  virtual int reloadNewFiles(fpreal time_now);
1491 
1492  void triggerOPChanged(OP_EventType reason, int index);
1493 
1494  void parmChanged( int parm_index );
1495  void parmExprChanged(int parm_index);
1496 
1497  // This is called when our OP_Operator is deleted before we are.
1498  void operatorDeleted();
1499 
1500  // These functions deal with the opparm command.
1501  void saveParmCommand(std::ostream &os, int values = 0,
1502  int defaultstoo = 1,
1503  bool spareparms = true) const;
1504  int loadParmCommand(int argc, const char *const argv[],
1505  int docallbacks, void *data,
1506  fpreal now, bool followchrefs,
1507  CMD_Args *args);
1508  void commandParmCallback(void *data, fpreal now,
1509  int argc, char *argv[],
1510  CMD_Args *args);
1511  void saveMultiParmInstanceCommand(
1512  std::ostream &os,
1513  const char *opname,
1514  bool spareparms) const;
1515 
1516  // Run the callback function for a particular parm, and the callbacks
1517  // of any parms linked to this parm. This function is implemented in
1518  // OP_Node.
1519  virtual bool triggerParmCallback(PRM_Parm *parmptr, fpreal now,
1520  int value, void *data,
1521  const UT_Options *options = 0) = 0;
1522 
1523  int64 getMemoryUsage(bool inclusive) const override;
1524 
1525  void bumpTakeReference(int dir)
1526  { myTakeReferences += dir; }
1527  int getTakeReferences() const
1528  { return myTakeReferences; }
1529 
1530 
1531  /// This method will create channel groups and populate them with
1532  /// channels from this operator. The channel groups created will
1533  /// correspond to the folders in this operator's parameters.
1534  /// Unless only_channels is specified, all auto-scoped parms will get
1535  /// included.
1536  void createChannelGroupsFromFolders(CH_Group &parent_group,
1537  bool only_channels,
1538  bool leaf_channels_only = false,
1539  bool only_unlocked = true);
1540 
1541 
1542  /// Returns the scoped channel ref corresponding to a parameter.
1543  bool getAutoScopedChannel(PRM_Parm *parm, int vector_index,
1544  OP_GetAutoScopedOptions &opts, CH_ChannelRef &chref);
1545 
1546  /// Returns a list of the autoscopeable channels for this node.
1547  /// if follow_layer_overrides is true, the channel references are followed but only for animation layers.
1548  /// if include_animated is true, channels without the auto scope flag but with animation will also be returned.
1549  void getAutoScopedChannels(CH_ChannelRefList &chlist,
1550  bool follow_layer_overrides=true,
1551  bool include_animated=false,
1552  bool follow_channel_refs=true,
1553  bool include_autoscope=true
1554  );
1555 
1556  /// Returns a list of the autoscopeable channels for this node.
1557  /// The options are passed as a OP_GetAutoScopedOptions
1558  void getAutoScopedChannels(CH_ChannelRefList &chlist,
1559  OP_GetAutoScopedOptions &opts);
1560 
1561  // Returns command to chopscope CHOPed channels for this node.
1562  void getChopScopeChannels(UT_WorkBuffer &chopscope_cmd);
1563 
1564  // Returns true if the specified parameter is visible in the interface
1565  // templates. This accounts for visiblity of containing parm pages
1566  // as well as the parm itself.
1567  bool getParmIsVisible(const char *parmname);
1568 
1569  // Returns a pointer to the templates used in constructing dialogs for
1570  // this node.
1571  const PRM_Template *getInterfaceParmTemplates() const;
1572 
1573  const PRM_Template *getSpareParmTemplates() const;
1574  const PRM_ScriptImports *getSpareParmTemplateImports() const;
1575  const PRM_Template *getSpareParmLayoutTemplates() const;
1576  const PRM_ScriptImports *getSpareParmLayoutTemplateImports() const;
1577  int getSpareParmTemplatesId() const;
1578 
1579  /// The number of potential spare inputs created by spare
1580  /// parameters. These are spare_input0 and onwards. There may be holes.
1581  int numSpareInputs() const;
1582 
1583  // Get our multiparm instance info used by initMultiparmInstance.
1584  bool hasMultiparmInfo() const;
1585  OP_MultiparmInfo &getMultiparmInfo();
1586 
1587  // This function is caled when any multiparm has a new instance added.
1588  // It gives the parm owner a chance to initialize the multiparm values.
1589  void initMultiparmInstance(UT_ValArray<PRM_Parm *> &parms) override;
1590  // This function sends an opChanged notification of our multiparm change.
1591  void addOrRemoveMultiparmInstance() override;
1592 
1593  bool savePresetContents(std::ostream &os) override;
1594  bool loadPresetContents(const char *tok, UT_IStream &is) override;
1595 
1596  static void buildMParmInst(const PRM_Template *templates,
1597  UT_StringArray &mparm_inst,
1598  UT_IntArray &mparm_lvl,
1599  int level);
1600  static bool isMParmInstance(const char *chname,
1601  const UT_StringArray &mparm_inst,
1602  const UT_IntArray &mparm_lvl);
1603 
1604  // Retrieve Animation Layers from a Scoped Channel List
1605  static void getLayersFromScopedChannels(
1606  const CH_ChannelRefList &ori_refs,
1607  CH_ChannelRefList &layer_refs );
1608 
1609  // setChRef* methods with name resolution of the parameter index
1610  // @{
1611  void setChRefInt(const char *parmname, int &pi, int vi, fpreal t, exint val,
1613  bool propagate=true);
1614  void setChRefFloat(const char *parmname, int &pi, int vi, fpreal t, fpreal val,
1615  PRM_AddKeyType add_key=
1617  bool propagate=true);
1618  void setChRefString(const UT_StringRef &val,
1619  CH_StringMeaning meaning,
1620  const char *parmname, int &pi, int vi,
1621  fpreal t,
1622  PRM_AddKeyType add_key=
1624  bool propagate=true);
1625  void setChRefData(const char *parmname, int &pi, int vi, fpreal t, const PRM_DataItemHandle &val,
1627  bool propagate=true);
1628  // @}
1629 
1630  void createParmMicroNode(const UT_StringRef &pn, int *pi );
1631 
1632  /// @{ Returns the parameter that controls the activation
1633  /// state of the parameter by the given name.
1634  PRM_Parm * getParmActivationControl(
1635  const UT_StringRef &parm_name);
1636  static UT_StringHolder getParmActivationControlName(
1637  const UT_StringRef &parm_name);
1638  /// @}
1639 
1640 protected:
1641  void doGetFullPath(UT_WorkBuffer &str) const override;
1642 
1643  // Uses the specified conditional stored on the PRM_Template for the
1644  // specified parameter to check whether the specified parm should
1645  // be updated based on the conditional. Returns false if the parm state
1646  // doesn't change.
1647  bool updateParmDisableConditional(
1648  PRM_Parm &parm,
1649  bool force,
1650  const UT_StringArray *skip = 0);
1651 
1652  bool updateParmHideConditional(
1653  PRM_Parm &parm,
1654  const UT_StringArray *skip = 0);
1655 
1656  // Disable if inactive, and enable is active. Uses an activation toggle
1657  // parameter that corresponds to the given paramter to decide
1658  // whether the given paramter is enabled/disabled.
1659  // The correspondence is implicit by parameter naming conventions.
1660  // If disable is true and toggle is off, the given parameter will be
1661  // disabled; if disable is false and toggle is on, it will be enabled;
1662  // else the enable/disable state remains unchanged.
1663  bool updateParmDisableIfInactive(PRM_Parm &parm,
1664  bool disable = true);
1665 
1666  // Returns zero if no change was made. This function is overridden
1667  // by subclasses to disable parms specific to those nodes.
1668  // NOTE: Superseded by the updateParmsFlags() function.
1669  SYS_DEPRECATED(12.0)
1670  virtual unsigned disableParms();
1671 
1672  // This function is overridden by subclasses to update parm flags specific
1673  // to those nodes.
1674  // Returns false if no change was made.
1675  virtual bool updateParmsFlags() { return false; }
1676  virtual bool preUpdateParmsFlags() { return false; }
1677 
1678 
1679  void saveMultiParmForUndo(int index);
1680 
1681  void stealGlobalErrors();
1682  void stealErrors(OP_Parameters &src);
1683 
1684  // NOTE: Do not hold onto the ptr object longer than necessary!
1687  {
1689  myErrorManager, myErrorManagerLock);
1690  }
1691 
1692  virtual void permissionError(const char *chname = 0);
1693 
1694  // checkExpressionError() is split up into a checking part and an actual
1695  // error handling part, evaluationError() so that the checking part can
1696  // be inlined.
1698  const PRM_Parm *parm, int thread) const
1699  {
1700  int err = ev_GetErrNo(thread);
1701  if (err == EV_NOERROR)
1702  return false;
1703  evaluationError(parm, err, thread);
1704  return true;
1705  }
1706 
1707  void resetParmEventHandler();
1708 
1709  int *allocIndirect(int size=64);
1710 
1711  OP_Parameters(const char *name, OP_Operator *entry);
1712  OP_Parameters(const OP_Parameters &source, const char *name);
1713  ~OP_Parameters() override;
1714 
1715  //
1716  // The "initializeParms" method must be called to provide the channel
1717  // collection and build the parameter list.
1718  //
1719  void initializeParms(OP_Channels *channels);
1720 
1721  // op dependencies
1722  virtual void buildOpDependencies()
1723  { }
1724  virtual void checkChannelDependencies(CH_Channel * /*ch*/,
1725  CH_CHANGE_TYPE /*reason*/)
1726  { }
1727 
1728  static bool isReservedOpName(const char *name);
1729 
1730  virtual int rename(const char *newname);
1731  virtual bool createSpareParameterFromChannel(const char *chname);
1732  virtual bool createSpareParametersFromChannels(
1734  const CH_ChannelList &channels);
1735 
1736  CH_LocalVariable *getVariable(int i) const;
1737  CH_LocalVariable *getVariable(const char *name) const;
1738 
1739  //
1740  //
1741  OP_ERROR saveChannels(std::ostream &os, int binary,
1742  bool compiled, bool selected,
1743  bool pending_state);
1744  OP_ERROR saveParmChannels(int parm_index, std::ostream &os,
1745  int binary, bool compiled);
1746  OP_ERROR saveParameters(std::ostream &os, int binary,
1747  bool compiled);
1748  OP_ERROR saveChannelAliases(std::ostream &os, int binary);
1749 
1750  bool loadChannels(UT_IStream &is, const char *path,
1751  CH_Collection *obsolete_channels);
1752  bool loadParameters(UT_IStream &is, const char *path,
1753  PRM_ParmList *obsolete_parms);
1754  bool loadChannelAliases(UT_IStream &is, const char *path=0);
1755  bool loadOldSpareParms(UT_IStream &is);
1756 
1757  // Allow our sub-class to be notified when something gets changed
1758  // Since the parameter only holds the name & the parameters, there
1759  // are only two types of events generated here...
1760  virtual void opChanged(OP_EventType type, void *dataptr = 0) = 0;
1761 
1762  /// This is a helper method to the setChannelScope method. It traverses
1763  /// the node's parameters and sets the scope on them according to the
1764  /// given pattern.
1765  virtual void traverseScope(const char *pattern, OP_ScopeOp scope_op,
1766  const OP_ScopeOptions &scope_options);
1767 
1768  // A virtual method to get access to the associated node flag. This would
1769  // probably be unnecessary if myTakeReferences were used.
1770  virtual bool getHasTakeData() const { return false;}
1771 
1772  /// Ensure that the node errors are up-to-date.
1773  /// This method gives our subclass a chance to insert any errors on-demand.
1775 
1776  /// Ensure that the spare parameter templates are up-to-date.
1777  /// This method gives our subclass a chance to update the spare parameters
1778  /// on-the-fly before returning them.
1780 
1783 
1784 private:
1785 
1786  // When the spare parameter definitions for a node changes, this function
1787  // is called to update the parameters to be in line with the new set of
1788  // templates. The old templates must still exist at this point.
1789  virtual void updateSpareParmTemplates(
1790  PRM_Template *newtemplates,
1791  bool leavedefaultsunchanged) = 0;
1792 
1793  template<class T>
1794  void traverseScopeT(const char *pattern, OP_ScopeOp scope_op,
1795  const OP_ScopeOptions &scope_options);
1796 
1797  // evaluationError() generates the appropriate call to opError() and then
1798  // clears the expression error state.
1799  void evaluationError(const PRM_Parm *parm, int err,
1800  int thread) const;
1801 
1802  // these methods are the actual instantiation of the set... and
1803  // setSilent... methods.
1804  void setFullInt(int parmi, int vectori, fpreal t,
1805  exint value, bool p);
1806  void setFullInt(const char *parmname, int vectori, fpreal t,
1807  exint value, bool p);
1808  void setFullInt(const char *parmname, int &parmi,
1809  int vectori, fpreal t, exint value, bool p);
1810 
1811 
1812  void setFullFloat(int pi, int vi, fpreal t, fpreal val,
1813  PRM_AddKeyType add_key, bool propagate);
1814  void setFullFloat(const char *pn, int vi, fpreal t,
1815  fpreal val, PRM_AddKeyType add_key,
1816  bool propagate);
1817  void setFullFloat(const char *pn, int &pi, int vi,
1818  fpreal t, fpreal val,
1819  PRM_AddKeyType add_key, bool propagate);
1820 
1821  void setFullString(const UT_StringRef &val,
1822  CH_StringMeaning meaning, int pi, int vi,
1823  fpreal t, bool ppropagate);
1824  void setFullString(const UT_StringRef &val,
1825  CH_StringMeaning meaning,
1826  const char *pn,
1827  int vi, fpreal t, bool propagate);
1828  void setFullString(const UT_StringRef &val,
1829  CH_StringMeaning meaning,
1830  const char *pn,
1831  int &pi, int vi, fpreal t,
1832  bool propagate);
1833 
1834  void setFullData(int pi, int vi, fpreal t,
1835  const PRM_DataItemHandle &val, bool p);
1836  void setFullData(const char *pn, int vi, fpreal t,
1837  const PRM_DataItemHandle &val, bool p);
1838  void setFullData(const char *pn, int &pi, int vi, fpreal t,
1839  const PRM_DataItemHandle &val, bool p);
1840 
1841  void setFullIntInst(exint value, const char *parmname,
1842  const int *inst, int vectori, fpreal t,
1843  int nestlevel, bool propagate);
1844  void setFullFloatInst(fpreal val, const char *name,
1845  const int *inst, int vi, fpreal t,
1846  int nestlevel, bool propagate);
1847  void setFullStringInst(const UT_StringRef &val,
1848  CH_StringMeaning meaning,
1849  const char *name,
1850  const int *inst, int vi, fpreal t,
1851  int nestlevel, bool propagate);
1852  void setFullDataInst(const PRM_DataItemHandle &val,
1853  const char *name, const int *inst,
1854  int vi, fpreal t, int nestlevel,
1855  bool propagate);
1856 
1857  // Set values given a parameter pointer (rather than a lookup index).
1858  // These all take add_key and propagate parameters.
1859  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1860  exint value, PRM_AddKeyType add_key,
1861  bool propgate);
1862  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1863  fpreal val, PRM_AddKeyType add_key,
1864  bool propgate);
1865  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1866  const char *value,
1867  CH_StringMeaning meaning,
1868  PRM_AddKeyType add_key, bool propgate);
1869  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1870  const PRM_DataItemHandle &val,
1871  PRM_AddKeyType add_key, bool propgate);
1872 
1873  bool determineParmVisibility(const char *parmname,
1874  const PRM_Template *prm,
1875  bool &visible);
1876 
1877  // Event handler
1878  static void changeEvent(void *, CH_CHANGE_TYPE, int);
1879 
1880  static void addLayerFromScopedChannels(
1881  const UT_StringRef &path,
1882  CH_ChannelRefList &chanrefs,
1883  UT_StringSet &scoped_layers);
1884 
1885  mutable OP_Lock myErrorManagerLock;
1886  UT_ErrorManager myErrorManager;
1887 
1888  UT_String myName;
1889  OP_Operator *myTableEntry;
1890  uint myTakeReferences;
1891 
1892  unsigned myUndoAllParmSavedFlag:1,
1893  myUndoScopedSavedFlag:1,
1894  myAnyUndoFlagSet:1,
1895  myIsGettingSaveError:1;
1896 
1897  OP_ParmCache *myParmCache;
1898 
1899  OP_SpareParms *mySpareParms;
1900  bool myChangingSpareParms;
1901 
1902  OP_MultiparmInfo *myMultiparmInfo;
1903 
1904  friend class OP_TakeParm;
1905  friend class OP_UndoParm;
1906  friend class OP_UndoSpareParm;
1907 };
1908 
1909 // helper functions
1910 
1911 OP_API PRM_Parm *OPgetParameterFromChannel( CH_Channel *chp, int *vecidx );
1915 
1916 #endif
OP_API void OPtakeAutoActivateChannel(CH_Channel *chp)
OP_ScopeType myScopeType
SYS_FORCE_INLINE OP_Operator * getOperator() const
PRM_Parm & getParm(const UT_StringRef &name)
UT_ErrorSeverity getSeverity()
void evalFloats(const UT_StringRef &pn, int *pi, fpreal64 *v, fpreal t) const
GT_API const UT_StringHolder selection
PRM_AddKeyType
Definition: PRM_Parm.h:58
#define EV_NOERROR
Definition: EX_Error.h:18
void evalJSONMapRaw(UT_JSONValueMap &val, int pi, int vi, fpreal t) const
OP_ScopeOptions(bool allow_nonchannels, bool exclude_animated, bool exclude_constant, bool include_only_nonint_keys, bool scoped_related_layers, OP_ScopeType scope_type)
Definition: OP_Parameters.h:90
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
int int32
Definition: SYS_Types.h:39
void takeDeactivateParm(PRM_Parm *parm)
bool evalParameterOrPropertyRaw(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=NULL) const
#define SYS_DEPRECATED(__V__)
virtual OP_ERROR error()
virtual int64 getMemoryUsage(bool inclusive) const
virtual void checkChannelDependencies(CH_Channel *, CH_CHANGE_TYPE)
void evalString(UT_StringHolder &val, const UT_StringRef &pn, int *pi, int vi, fpreal t) const
bool evalVectorProperty(const UT_StringRef &parm_name, fpreal now, fpreal *values, int vec_size, PRM_Parm **parmptr=NULL) const
fpreal evalFloat(const UT_StringRef &pn, int *pi, int vi, fpreal t) const
CH_ExprLanguage
void opWarning(int code, const char *m=0) const
void skip(T &in, int n)
Definition: ImfXdr.h:711
CH_StringMeaning
const GLdouble * v
Definition: glcorearb.h:837
void evalFloats(int pi, fpreal32 *v, fpreal t) const
OP_GetAutoScopedOptions(fpreal t, bool follow_layer_overrides, bool include_animated, bool follow_channel_refs, bool include_autoscope)
int getAnyUndoPending() const
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
OP_Channels * getChannels() const
UT_API UT_ErrorSeverity UTaddFatal(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
void evalJSONMap(UT_JSONValueMap &val, const PRM_Parm *parm, int vi, fpreal t) const
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
PRM_DataItemHandle evalData(const UT_StringRef &pn, int vi, fpreal t) const
void evalStringInst(const UT_StringRef &name, const int *inst, UT_StringHolder &val, int vi, fpreal t, int nestlevel=1) const
void evalString(UT_String &val, const UT_StringRef &pn, int *pi, int vi, fpreal t) const
int64 exint
Definition: SYS_Types.h:125
bool evalVectorProperty(const UT_StringRef &parm_name, fpreal now, int *values, int vec_size, PRM_Parm **parmptr=NULL) const
virtual bool preUpdateParmsFlags()
GLint level
Definition: glcorearb.h:108
fpreal evalFloat(int pi, int vi, fpreal t) const
void evalFloatsInst(const UT_StringRef &name, const int *inst, fpreal64 *v, fpreal t, int nestlevel=1) const
virtual bool getHasTakeData() const
UT_ErrorSeverity
Definition: UT_Error.h:25
SYS_FORCE_INLINE bool checkExpressionError(const PRM_Parm *parm, int thread) const
UT_API UT_ErrorManager * UTgetErrorManager()
void evalJSONMap(UT_JSONValueMap &val, const UT_StringRef &pn, int *pi, int vi, fpreal t) const
void evalJSONMapRaw(UT_JSONValueMap &val, const PRM_Parm *parm, int vi, fpreal t) const
DEP_MicroNodeList * myFollowedParmMicroNodes
**But if you need a result
Definition: thread.h:613
void opLocalDeadlockError()
int getParmIndex(const UT_StringRef &name) const
void appendError(const char *type, int code, const char *m, UT_ErrorSeverity sev)
exint evalInt(const UT_StringRef &pn, int vi, fpreal t) const
void evalJSONMapRaw(UT_JSONValueMap &val, const UT_StringRef &pn, int *pi, int vi, fpreal t) const
UT_API UT_ErrorSeverity UTaddMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
float fpreal32
Definition: SYS_Types.h:200
bool isGettingSaveError() const
void takeDeactivateParm(const char *name)
void clearErrors(OP_Context &context)
UT_Set< OP_Node * > myUpdated
void bumpTakeReference(int dir)
virtual void takeAutoActivateParm(PRM_Parm *)=0
void clearDuplicateErrors()
virtual OP_ERROR error(OP_Context &context)
fpreal evalFloat(const UT_StringRef &pn, int vi, fpreal t) const
exint evalInt(const PRM_Parm *parm, int vi, fpreal t) const
< returns > If no error
Definition: snippets.dox:2
double fpreal64
Definition: SYS_Types.h:201
PRM_DataItemHandle evalData(const PRM_Parm *parm, int vi, fpreal t) const
PRM_Parm & getParm(int i)
virtual bool savePresetContents(std::ostream &os)=0
OP_FollowChanRefsOptions myOpt2
GLdouble n
Definition: glcorearb.h:2008
OP_FollowChanRefsOptions myOpt
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=NULL) const
fpreal evalFloat(const PRM_Parm *parm, int vi, fpreal t) const
void opLocalError(int code, const char *m=0)
const PRM_Parm & getParm(const UT_StringRef &name) const
void evalJSONMapRaw(UT_JSONValueMap &val, const UT_StringRef &pn, int vi, fpreal t) const
CH_CHANGE_TYPE
void evalString(UT_String &val, const PRM_Parm *parm, int vi, fpreal t) const
static bool followChannelReferencesWithDeps(const OP_FollowChanRefsOptions &opt, OP_Node *&newop, PRM_Parm *&newparm, int &newvecidx, CH_Channel *chp)
GLint ref
Definition: glcorearb.h:124
void evalString(UT_String &val, const UT_StringRef &pn, int vi, fpreal t) const
PRM_Parm * getParmPtr(const UT_StringRef &name)
void evalString(UT_String &val, int pi, int vi, fpreal t) const
void evalFloats(int pi, fpreal64 *v, fpreal t) const
PRM_ChanState
Definition: PRM_ChanState.h:14
const PRM_Parm & getParm(int i) const
PRM_DataItemHandle evalDataInst(const UT_StringRef &name, const int *inst, int vi, fpreal t, int nestlevel=1) const
bool myScopedRelatedLayers
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void evalJSONMap(UT_JSONValueMap &val, int pi, int vi, fpreal t) const
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
void setChRefString(int pi, int vi, fpreal t, const UT_StringRef &val, CH_StringMeaning meaning, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING, bool propagate=true)
GLint GLuint mask
Definition: glcorearb.h:124
void evalString(UT_StringHolder &val, int pi, int vi, fpreal t) const
long long int64
Definition: SYS_Types.h:116
virtual void resolveAndDeleteObsoleteParmList(PRM_ParmList *&obsolete_parms)=0
bool hasDeadlockError() const
OP_Channels * myChannels
fpreal evalFloatInst(const UT_StringRef &name, const int *inst, int vi, fpreal t, int nestlevel=1) const
GLenum GLenum severity
Definition: glcorearb.h:2539
virtual CH_ExprLanguage getExprLanguage() const =0
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual void buildOpDependencies()
GLushort pattern
Definition: glad.h:2583
bool myIncludeOnlyNonIntKeys
bool getIsChangingSpareParms() const
PRM_DataItemHandle evalData(int pi, int vi, fpreal t) const
void evalFloats(const PRM_Parm *parm, fpreal32 *v, fpreal t) const
virtual void addOrRemoveMultiparmInstance()=0
int removeError(int idx)
void evalStringRaw(UT_String &val, int pi, int vi, fpreal t) const
int findError(const char *type, int code) const
OP_FollowChanRefsOptions(fpreal t)
PRM_ChanState isAtKey(fpreal t) const
void evalStringInstRaw(const UT_StringRef &name, const int *inst, UT_String &val, int vi, fpreal t, int nestlevel=1) const
GLdouble t
Definition: glad.h:2397
virtual void ensureErrorsAreUpdatedSubclass()
static void followChannelReferences(const OP_FollowChanRefsOptions &opt, OP_Node *&newop, PRM_Parm *&newparm, int &newvecidx)
virtual void ensureSpareParmsAreUpdatedSubclass()
void evalStringRaw(UT_String &val, const PRM_Parm *parm, int vi, fpreal t) const
exint evalInt(const UT_StringRef &pn, int *pi, int vi, fpreal t) const
void clearAndDestroyErrors()
GLsizeiptr size
Definition: glcorearb.h:664
**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
A map of string to various well defined value types.
Definition: UT_Options.h:84
void evalStringInst(const UT_StringRef &name, const int *inst, UT_String &val, int vi, fpreal t, int nestlevel=1) const
void opLocalWarning(int code, const char *m=0)
SYS_API int SYSgetSTID()
void evalString(UT_StringHolder &val, const UT_StringRef &pn, int vi, fpreal t) const
SIM_API const UT_StringHolder force
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
virtual void resolveObsoleteParms(PRM_ParmList *)
fpreal64 fpreal
Definition: SYS_Types.h:277
bool getParameterOrPropertyConst(const UT_StringRef &name, fpreal now, OP_Node *&op, PRM_Parm *&parm, PRM_ParmList *obsolete) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:88
void evalJSONMap(UT_JSONValueMap &val, const UT_StringRef &pn, int vi, fpreal t) const
#define OP_API
Definition: OP_API.h:10
GLuint index
Definition: glcorearb.h:786
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, int &value, PRM_Parm **parmptr=NULL) const
OP_API void OPsaveChannelForUndo(CH_Channel *chp)
OP_API PRM_Parm * OPgetParameterFromChannel(CH_Channel *chp, int *vecidx)
void evalStringRaw(UT_String &val, const UT_StringRef &pn, int *pi, int vi, fpreal t) const
void evalFloats(const PRM_Parm *parm, fpreal64 *v, fpreal t) const
UT_API UT_ErrorSeverity UTaddWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
virtual bool loadPresetContents(const char *token, UT_IStream &is)=0
GLuint GLfloat * val
Definition: glcorearb.h:1608
virtual void initMultiparmInstance(UT_ValArray< PRM_Parm * > &p)=0
bool evalParameterOrPropertyExpr(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=NULL) const
void opMessage(int code, const char *m=0) const
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
SYS_FORCE_INLINE const UT_String & getName() const
const OP_Stat & getStat() const
static bool followChannelReferencesOneStep(const OP_FollowChanRefsOptions &opt, OP_Node *&newop, PRM_Parm *&newparm, int &newvecidx)
PRM_DataItemHandle evalData(const UT_StringRef &pn, int *pi, int vi, fpreal t) const
**If you just want to fire and args
Definition: thread.h:609
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: Math.h:119
void takeDeactivateParm(uint idx)
int getErrorMessages(UT_String &messages, UT_ErrorSeverity severity=UT_ERROR_NONE)
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
exint evalInt(int pi, int vi, fpreal t) const
OP_API void OPsaveChannelsForUndo(const CH_ChannelList &channels)
exint evalIntInst(const UT_StringRef &name, const int *inst, int vi, fpreal t, int nestlevel=1) const
virtual void syncNodeVersion(const char *old_version, const char *current_version, bool *node_deleted)
virtual void doGetFullPath(UT_WorkBuffer &buf) const =0
Compute the full path of the node.
void opError(int code, const char *m=0) const
void evalFloats(const UT_StringRef &pn, fpreal64 *v, fpreal t) const
const PRM_Parm * getParmPtr(const UT_StringRef &name) const
OP_ScopeOp
Definition: OP_Parameters.h:58
int getThread() const
Definition: OP_Context.h:83
void evalFloats(const UT_StringRef &pn, fpreal32 *v, fpreal t) const
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, fpreal &values, PRM_Parm **parmptr=NULL) const
type
Definition: core.h:1059
bool hasError(OP_Context &context)
unsigned int uint
Definition: SYS_Types.h:45
void evalString(UT_StringHolder &val, const PRM_Parm *parm, int vi, fpreal t) const
UT_LockedRawPtr< UT_ErrorManager, OP_Lock > getLockedErrorManager()
int getNumErrors() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
int getTakeReferences() const
static void followChannelReferences(const OP_FollowChanRefsOptions &opt, CH_ChannelRef &ref)
bool hasParm(const UT_StringRef &name) const
Definition: format.h:895
Definition: OP_PostIt.h:42
void evalStringRaw(UT_String &val, const UT_StringRef &pn, int vi, fpreal t) const
UT_API UT_ErrorSeverity UTaddError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
void opFatal(int code, const char *m=0) const
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
void setChRefString(const char *pn, int vi, fpreal t, const UT_StringRef &val, CH_StringMeaning meaning, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING, bool propagate=true)
virtual PRM_ParmList * createObsoleteParmList()=0
OP_ScopeType
Definition: OP_Parameters.h:65
void evalFloats(const UT_StringRef &pn, int *pi, fpreal32 *v, fpreal t) const
GLenum src
Definition: glcorearb.h:1793
OP_Stat & getStat()