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_StringHolder &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 = nullptr);
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) != nullptr; }
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=nullptr);
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=nullptr);
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 evalStringRaw(UT_StringHolder &val, int pi, int vi,
611  fpreal t) const
612  {
613  return evalStringRawT(val, pi, vi, t,
614  SYSgetSTID());
615  }
616  void evalStringRawT(UT_String &val, int pi, int vi, fpreal t,
617  int thread) const;
618  void evalStringRawT(UT_StringHolder &val, int pi, int vi, fpreal t,
619  int thread) const;
621  const UT_StringRef &pn, int vi,
622  fpreal t) const
623  {
624  return evalStringRawT(val, pn, vi, t,
625  SYSgetSTID());
626  }
628  const UT_StringRef &pn, int vi,
629  fpreal t) const
630  {
631  return evalStringRawT(val, pn, vi, t,
632  SYSgetSTID());
633  }
634  void evalStringRawT(UT_String &val,
635  const UT_StringRef &pn, int vi,
636  fpreal t, int thread) const;
637  void evalStringRawT(UT_StringHolder &val,
638  const UT_StringRef &pn, int vi,
639  fpreal t, int thread) const;
641  int *pi, int vi, fpreal t) const
642  {
643  return evalStringRawT(val, pn, pi, vi, t,
644  SYSgetSTID());
645  }
647  int *pi, int vi, fpreal t) const
648  {
649  return evalStringRawT(val, pn, pi, vi, t,
650  SYSgetSTID());
651  }
652  void evalStringRawT(UT_String &val,
653  const UT_StringRef &pn, int *pi,
654  int vi, fpreal t, int thread) const;
655  void evalStringRawT(UT_StringHolder &val,
656  const UT_StringRef &pn, int *pi,
657  int vi, fpreal t, int thread) const;
658  void evalStringRaw(UT_String &val, const PRM_Parm *parm,
659  int vi, fpreal t) const
660  {
661  return evalStringRawT(val, parm, vi, t,
662  SYSgetSTID());
663  }
665  int vi, fpreal t) const
666  {
667  return evalStringRawT(val, parm, vi, t,
668  SYSgetSTID());
669  }
670  void evalStringRawT(UT_String &val, const PRM_Parm *parm,
671  int vi, fpreal t, int thread) const;
672  void evalStringRawT(UT_StringHolder &val, const PRM_Parm *parm,
673  int vi, fpreal t, int thread) const;
674 
675  PRM_DataItemHandle evalData(int pi, int vi, fpreal t) const
676  { return evalDataT(pi, vi, t, SYSgetSTID()); }
677  PRM_DataItemHandle evalDataT(int pi, int vi, fpreal t, int thread) const;
679  fpreal t) const
680  { return evalDataT(pn, vi, t, SYSgetSTID()); }
681  PRM_DataItemHandle evalDataT(const UT_StringRef &pn, int vi,
682  fpreal t, int thread) const;
683  PRM_DataItemHandle evalData(const UT_StringRef &pn, int *pi, int vi,
684  fpreal t) const
685  { return evalDataT(pn, pi, vi, t, SYSgetSTID()); }
686  PRM_DataItemHandle evalDataT(const UT_StringRef &pn, int *pi, int vi,
687  fpreal t, int thread) const;
688  PRM_DataItemHandle evalData(const PRM_Parm *parm, int vi, fpreal t) const
689  { return evalDataT(parm, vi, t, SYSgetSTID()); }
690  PRM_DataItemHandle evalDataT(const PRM_Parm *parm, int vi, fpreal t,
691  int thread) const;
692 
693  // JSON map evaluation, expanding any inline expressions (backticks) and
694  // variables
695  void evalJSONMap(UT_JSONValueMap &val, int pi, int vi,
696  fpreal t) const
697  { return evalJSONMapT(
698  val, pi, vi, t, SYSgetSTID()); }
699  void evalJSONMapT(UT_JSONValueMap &val, int pi, int vi,
700  fpreal t, int thread) const;
702  const UT_StringRef &pn,
703  int vi, fpreal t) const
704  { return evalJSONMapT(
705  val, pn, vi, t, SYSgetSTID()); }
706  void evalJSONMapT(UT_JSONValueMap &val,
707  const UT_StringRef &pn,
708  int vi, fpreal t, int thread) const;
710  const UT_StringRef &pn,
711  int *pi, int vi, fpreal t) const
712  {
713  return evalJSONMapT(
714  val, pn, pi, vi, t, SYSgetSTID());
715  }
716  void evalJSONMapT(UT_JSONValueMap &val,
717  const UT_StringRef &pn,
718  int *pi, int vi, fpreal t, int thread)
719  const;
721  const PRM_Parm *parm, int vi, fpreal t)
722  const
723  {
724  return evalJSONMapT(
725  val, parm, vi, t, SYSgetSTID());
726  }
727  void evalJSONMapT(UT_JSONValueMap &val,
728  const PRM_Parm *parm, int vi, fpreal t,
729  int thread) const;
730 
731  // JSON map evaluation, with no expression or variable expansion
732  void evalJSONMapRaw(UT_JSONValueMap &val, int pi, int vi,
733  fpreal t) const
734  {
735  return evalJSONMapRawT(
736  val, pi, vi, t, SYSgetSTID());
737  }
738  void evalJSONMapRawT(UT_JSONValueMap &val, int pi, int vi,
739  fpreal t, int thread) const;
741  const UT_StringRef &pn,
742  int vi, fpreal t) const
743  {
744  return evalJSONMapRawT(
745  val, pn, vi, t, SYSgetSTID());
746  }
747  void evalJSONMapRawT(UT_JSONValueMap &val,
748  const UT_StringRef &pn,
749  int vi, fpreal t, int thread) const;
751  const UT_StringRef &pn,
752  int *pi, int vi, fpreal t) const
753  {
754  return evalJSONMapRawT(
755  val, pn, pi, vi, t, SYSgetSTID());
756  }
757  void evalJSONMapRawT(UT_JSONValueMap &val,
758  const UT_StringRef &pn,
759  int *pi, int vi, fpreal t, int thread)
760  const;
762  const PRM_Parm *parm, int vi, fpreal t)
763  const
764  {
765  return evalJSONMapRawT(
766  val, parm, vi, t, SYSgetSTID());
767  }
768  void evalJSONMapRawT(UT_JSONValueMap &val,
769  const PRM_Parm *parm, int vi,
770  fpreal t, int thread) const;
771  // @}
772 
773  /// @name Multi-Parameter evaluation
774  ///
775  /// - name @n Parameter name token
776  /// - inst @n Array of instance indices to evaluate at
777  /// - vi @n Component index of a parameter
778  /// - t @n Evaluation time
779  /// - nestlevel @n Number of entries in 'inst'
780  /// - thread @n Thread id (ie. return value from SYSgetSTID())
781  // @{
783  const int *inst, int vi,
784  fpreal t, int nestlevel = 1) const
785  {
786  return evalIntInstT(name, inst, vi, t,
787  SYSgetSTID(), nestlevel);
788  }
789  exint evalIntInstT(const UT_StringRef &name,
790  const int *inst, int vi,
791  fpreal t, int thread,
792  int nestlevel = 1) const;
794  const int *inst, int vi,
795  fpreal t, int nestlevel = 1) const
796  {
797  return evalFloatInstT(name, inst, vi, t,
798  SYSgetSTID(), nestlevel);
799  }
800  fpreal evalFloatInstT(const UT_StringRef &name,
801  const int *inst, int vi,
802  fpreal t, int thread,
803  int nestlevel = 1) const;
805  const int *inst,
806  fpreal64 *v, fpreal t,
807  int nestlevel = 1) const
808  {
809  return evalFloatsInstT(name, inst, v, t,
810  SYSgetSTID(), nestlevel);
811  }
812  void evalFloatsInstT(const UT_StringRef &name,
813  const int *inst,
814  fpreal64 *v, fpreal t, int thread,
815  int nestlevel = 1) const;
817  const int *inst,
818  UT_String &val, int vi, fpreal t,
819  int nestlevel = 1) const
820  {
821  return evalStringInstT(name, inst, val, vi,
822  t, SYSgetSTID(), nestlevel);
823  }
825  const int *inst,
826  UT_StringHolder &val, int vi, fpreal t,
827  int nestlevel = 1) const
828  {
829  return evalStringInstT(name, inst, val, vi,
830  t, SYSgetSTID(), nestlevel);
831  }
832  void evalStringInstT(const UT_StringRef &name,
833  const int *inst,
834  UT_String &val, int vi, fpreal t,
835  int thread, int nestlevel = 1) const;
836  void evalStringInstT(const UT_StringRef &name,
837  const int *inst,
838  UT_StringHolder &val, int vi, fpreal t,
839  int thread, int nestlevel = 1) const;
841  const int *inst,
842  UT_String &val, int vi, fpreal t,
843  int nestlevel = 1) const
844  {
845  return evalStringInstRawT(name, inst, val, vi,
846  t, SYSgetSTID(), nestlevel);
847  }
849  const int *inst,
850  UT_StringHolder &val, int vi, fpreal t,
851  int nestlevel = 1) const
852  {
853  return evalStringInstRawT(name, inst, val, vi,
854  t, SYSgetSTID(), nestlevel);
855  }
856  void evalStringInstRawT(const UT_StringRef &name,
857  const int *inst,
858  UT_String &val, int vi, fpreal t,
859  int thread,
860  int nestlevel = 1) const;
861  void evalStringInstRawT(const UT_StringRef &name,
862  const int *inst,
863  UT_StringHolder &val, int vi, fpreal t,
864  int thread,
865  int nestlevel = 1) const;
867  const int *inst, int vi,
868  fpreal t, int nestlevel = 1) const
869  {
870  return evalDataInstT(name, inst, vi, t,
871  SYSgetSTID(), nestlevel);
872  }
873  PRM_DataItemHandle evalDataInstT(const UT_StringRef &name,
874  const int *inst, int vi,
875  fpreal t, int thread,
876  int nestlevel = 1) const;
877  // @}
878 
879  /// @name Property evaluation
880  ///
881  /// Properties will be evaluated if the parameter is not found.
882  ///
883  /// - parm_name @n Parameter name token
884  /// - vec_index @n Component index of a parameter
885  /// - now @n Evaluation time
886  /// - thread @n Thread id (ie. return value from SYSgetSTID())
887  /// - parmptr @n optional source parameter return value
888  // @{
890  const UT_StringRef &parm_name,
891  int vec_index,
892  fpreal now,
893  int &value,
894  PRM_Parm **parmptr = nullptr) const
895  {
896  return evalParameterOrPropertyT(parm_name,
897  vec_index, now, value, SYSgetSTID(),
898  parmptr);
899  }
900  bool evalParameterOrPropertyT(
901  const UT_StringRef &parm_name,
902  int vec_index,
903  fpreal now,
904  int &value,
905  int thread,
906  PRM_Parm **parmptr = nullptr) const;
908  const UT_StringRef &parm_name,
909  int vec_index,
910  fpreal now,
911  fpreal &values,
912  PRM_Parm **parmptr = nullptr) const
913  {
914  return evalParameterOrPropertyT(parm_name,
915  vec_index, now, values, SYSgetSTID(),
916  parmptr);
917  }
918  bool evalParameterOrPropertyT(
919  const UT_StringRef &parm_name,
920  int vec_index,
921  fpreal now,
922  fpreal &values, int thread,
923  PRM_Parm **parmptr = nullptr) const;
925  const UT_StringRef &parm_name,
926  int vec_index,
927  fpreal now,
928  UT_String &value,
929  PRM_Parm **parmptr = nullptr) const
930  {
931  return evalParameterOrPropertyT(parm_name,
932  vec_index, now, value, SYSgetSTID(),
933  parmptr);
934  }
935  bool evalParameterOrPropertyT(
936  const UT_StringRef &parm_name,
937  int vec_index,
938  fpreal now,
939  UT_String &value,
940  int thread,
941  PRM_Parm **parmptr = nullptr) const;
943  const UT_StringRef &parm_name,
944  int vec_index,
945  fpreal now,
946  UT_String &value,
947  PRM_Parm **parmptr = nullptr) const
948  {
949  return evalParameterOrPropertyRawT(parm_name,
950  vec_index, now, value, SYSgetSTID(),
951  parmptr);
952  }
953  bool evalParameterOrPropertyRawT(
954  const UT_StringRef &parm_name,
955  int vec_index,
956  fpreal now,
957  UT_String &value,
958  int thread,
959  PRM_Parm **parmptr = nullptr) const;
961  const UT_StringRef &parm_name,
962  int vec_index,
963  fpreal now,
964  UT_String &value,
965  PRM_Parm **parmptr = nullptr) const
966  {
967  return evalParameterOrPropertyExprT(parm_name,
968  vec_index, now, value, SYSgetSTID(),
969  parmptr);
970  }
971  bool evalParameterOrPropertyExprT(
972  const UT_StringRef &parm_name,
973  int vec_index,
974  fpreal now,
975  UT_String &value,
976  int thread,
977  PRM_Parm **parmptr = nullptr) const;
978 
980  const UT_StringRef &parm_name,
981  fpreal now,
982  int *values,
983  int vec_size,
984  PRM_Parm **parmptr = nullptr) const
985  {
986  return evalVectorPropertyT(parm_name,
987  now, values, vec_size, SYSgetSTID(),
988  parmptr);
989  }
990  bool evalVectorPropertyT(
991  const UT_StringRef &parm_name,
992  fpreal now,
993  int *values,
994  int vec_size,
995  int thread,
996  PRM_Parm **parmptr = nullptr) const;
998  const UT_StringRef &parm_name,
999  fpreal now,
1000  fpreal *values,
1001  int vec_size,
1002  PRM_Parm **parmptr = nullptr) const
1003  {
1004  return evalVectorPropertyT(parm_name,
1005  now, values, vec_size, SYSgetSTID(),
1006  parmptr);
1007  }
1008  bool evalVectorPropertyT(
1009  const UT_StringRef &parm_name,
1010  fpreal now,
1011  fpreal *values,
1012  int vec_size,
1013  int thread,
1014  PRM_Parm **parmptr = nullptr) const;
1015  // @}
1016 
1017  /// @anchor OP_Node_SetParameters
1018 
1019  /// @name Setting parameter values
1020  ///
1021  /// - parmi @n Parameter index
1022  /// - parmname @n Parameter name string
1023  /// - vectori @n Component index of a parameter
1024  /// - t @n Evaluation time
1025  /// - value @n Value to set
1026  /// - h @n If true, it will set a keyframe if the parameter
1027  /// has a channel. If false, then the value will
1028  /// need to committed first.
1029  // @{
1030  void setInt(int parmi, int vectori, fpreal t, exint value);
1031  void setInt(const char *parmname, int vectori, fpreal t, exint value);
1032  void setInt(const char *parmname, int &parmi, int vectori, fpreal t,
1033  exint value);
1034  void setFloat(int parmi, int vectori, fpreal t,
1035  fpreal value,
1037  void setFloat(const char *parmname, int vectori, fpreal t,
1038  fpreal value,
1040  void setFloat(const char *parmname, int &parmi, int vectori,
1041  fpreal t, fpreal value,
1043  void setString(const UT_StringRef &val,
1044  CH_StringMeaning meaning,
1045  int parmi, int vectori,
1046  fpreal t);
1047  void setString(const UT_StringRef &val,
1048  CH_StringMeaning meaning,
1049  const char *parmname, int vectori, fpreal t);
1050  void setString(const UT_StringRef &val,
1051  CH_StringMeaning meaning,
1052  const char *parmname,
1053  int &parmi, int vectori, fpreal t);
1054  void setData(int parmi, int vectori, fpreal t,
1055  const PRM_DataItemHandle &val);
1056  void setData(const char *parmname, int vectori, fpreal t,
1057  const PRM_DataItemHandle &val);
1058  void setData(const char *parmname, int &parmi, int vectori, fpreal t,
1059  const PRM_DataItemHandle &val);
1060  // @}
1061 
1062  /// @name Setting parameter values, following channel references
1063  ///
1064  /// These functions will follow simple channel references first, and then
1065  /// set the value on the destination parameter.
1066  ///
1067  /// - pi @n Parameter index
1068  /// - pn @n Parameter name string
1069  /// - vi @n Component index of a parameter
1070  /// - t @n Time at which to set the value
1071  /// - val @n Value to set
1072  /// - add_key @n If PRM_AK_SET_KEY, it will set a keyframe if the
1073  /// parameter has a channel and the current value differs.
1074  /// If PRM_AK_FORCE_KEY, it will set a keyframe if the
1075  /// parameter has a channel regardless of the current value.
1076  /// If PRM_AK_MARK_PENDING, then the value will need to be
1077  /// committed first.
1078  /// - propagate @n If true, it notify observers
1079  /// - thread @n Thread id (ie. return value from SYSgetSTID())
1080  // @{
1081  void setChRefInt(int pi, int vi, fpreal t, exint val,
1083  bool propagate=true);
1084  void setChRefInt(const char *pn, int vi, fpreal t, exint val,
1086  bool propagate=true);
1087  void setChRefFloat(int pi, int vi, fpreal t, fpreal val,
1088  PRM_AddKeyType add_key=
1090  bool propagate=true);
1091  void setChRefFloat(const char *pn, int vi, fpreal t,
1092  fpreal val,
1093  PRM_AddKeyType add_key=
1095  bool propagate=true);
1096  void setChRefString(const UT_StringRef &val,
1097  CH_StringMeaning meaning,
1098  int pi, int vi,
1099  fpreal t,
1100  PRM_AddKeyType add_key=
1102  bool propagate=true);
1103  void setChRefString(int pi, int vi,
1104  fpreal t,
1105  const UT_StringRef &val,
1106  CH_StringMeaning meaning,
1107  PRM_AddKeyType add_key=
1109  bool propagate=true)
1110  {
1111  setChRefString(val, meaning, pi, vi, t,
1112  add_key, propagate);
1113  }
1114  void setChRefString(const UT_StringRef &val,
1115  CH_StringMeaning meaning,
1116  const char *pn,
1117  int vi, fpreal t,
1118  PRM_AddKeyType add_key=
1120  bool propagate=true);
1121  void setChRefString(const char *pn,
1122  int vi, fpreal t,
1123  const UT_StringRef &val,
1124  CH_StringMeaning meaning,
1125  PRM_AddKeyType add_key=
1127  bool propagate=true)
1128  {
1129  setChRefString(val, meaning, pn, vi, t,
1130  add_key, propagate);
1131  }
1132 
1133  void setChRefData(int pi, int vi, fpreal t, const PRM_DataItemHandle &val,
1134  PRM_AddKeyType add_key=
1136  bool propagate=true);
1137 
1138  void setChRefData(const char *pn, int vi, fpreal t,
1139  const PRM_DataItemHandle &val,
1140  PRM_AddKeyType add_key=
1142  bool propagate=true);
1143 
1144  // @}
1145 
1146  /// @name Setting property values
1147  ///
1148  /// The setParameterOrProperty methods will track down, not only channel
1149  /// references, but also property parameter references.
1150  /// The bool result indicates whether the parameter was actually set.
1151  /// Some possible causes of failure are:
1152  /// - Parameter or property not found
1153  /// - Permissions error
1154  /// - Locked parameter
1155  /// - Out of bounds vector index
1156  ///
1157  /// Parameters:
1158  /// - parm_name @n Parameter name string
1159  /// - vec_index @n Component index of a parameter
1160  /// - now @n Time at which to set the value
1161  /// - val @n Value to set
1162  /// - set_key @n If true, it will set a keyframe if the parameter
1163  /// has a channel. If false, then the value will
1164  /// need to committed first.
1165  /// - propagate @n If true, it notify observers
1166  // @{
1167  bool setParameterOrProperty(const char *parm_name,
1168  int vec_index,
1169  fpreal now,
1170  int32 value,
1171  bool set_key=false,
1172  bool propagate=true);
1173  bool setParameterOrProperty(const char *parm_name,
1174  int vec_index,
1175  fpreal now,
1176  int64 value,
1177  bool set_key=false,
1178  bool propagate=true);
1179  bool setParameterOrProperty(const char *parm_name,
1180  int vec_index,
1181  fpreal now,
1182  fpreal value,
1183  bool set_key=false,
1184  bool propagate=true);
1185  bool setParameterOrProperty(const char *parm_name,
1186  int vec_index,
1187  fpreal now,
1188  const char *value,
1189  CH_StringMeaning meaning,
1190  bool set_key=false,
1191  bool propagate=true);
1192  // @}
1193 
1194  /// @name Multi-Parameter evaluation
1195  ///
1196  /// - name @n Parameter name token
1197  /// - inst @n Array of instance indices to evaluate at
1198  /// - vectori @n Component index of a parameter
1199  /// - t @n Evaluation time
1200  /// - nestlevel @n Number of entries in 'inst'
1201  /// - value @n Value to set
1202  // @{
1203  void setIntInst(exint value, const char *parmname,
1204  const int *inst, int vectori, fpreal t,
1205  int nestlevel = 1);
1206  void setFloatInst(fpreal value, const char *parmname,
1207  const int *inst, int vectori, fpreal t,
1208  int nestlevel = 1);
1209  void setStringInst(const UT_StringRef &value,
1210  CH_StringMeaning meaning,
1211  const char *parmname,
1212  const int *inst, int vectori, fpreal t,
1213  int nestlevel = 1);
1214  void setDataInst(const PRM_DataItemHandle &value,
1215  const char *parmname, const int *inst,
1216  int vectori, fpreal t, int nestlevel = 1);
1217  // @}
1218 
1219  /// @name Setting parameter values silently
1220  ///
1221  /// These methods do not trigger additional events to notify observers
1222  ///
1223  /// - int pi @n Parameter index
1224  /// - const char *pn @n Parameter name string
1225  /// - int &pi @n Parameter index, returned from 'pn' lookup
1226  /// - int vi @n Component index of a parameter
1227  /// - fpreal t @n Time at which to set the value
1228  /// - value @n Value to set
1229  // @{
1230  void setSilentInt(int parmi, int vectori, fpreal t,
1231  exint value);
1232  void setSilentInt(const char *parmname, int vectori,
1233  fpreal t, exint value);
1234  void setSilentInt(const char *parmname, int &parmi,
1235  int vectori, fpreal t,exint value);
1236 
1237  void setSilentFloat(int parmi, int vectori, fpreal t,
1238  fpreal value,
1240  void setSilentFloat(const char *parmname, int vectori,
1241  fpreal t, fpreal value,
1243  void setSilentFloat(const char *parmname,
1244  int &parmi, int vectori,
1245  fpreal t, fpreal value,
1247 
1248  void setSilentString(const UT_StringRef &value,
1249  CH_StringMeaning meaning,
1250  int parmi, int vectori, fpreal t);
1251  void setSilentString(const UT_StringRef &value,
1252  CH_StringMeaning meaning,
1253  const char *parmname, int vectori, fpreal t);
1254  void setSilentString(const UT_StringRef &value,
1255  CH_StringMeaning meaning,
1256  const char *parmname,
1257  int &parmi, int vectori, fpreal t);
1258  void setSilentData(int parmi, int vectori, fpreal t,
1259  const PRM_DataItemHandle &value);
1260  void setSilentData(const char *parmname, int vectori,
1261  fpreal t, const PRM_DataItemHandle &value);
1262  void setSilentData(const char *parmname,
1263  int &parmi, int vectori, fpreal t,
1264  const PRM_DataItemHandle &value);
1265 
1266  void setSilentIntInst(exint value, const char *parmname,
1267  const int *inst, int vectori,
1268  fpreal t, int nestlevel = 1);
1269  void setSilentFloatInst(fpreal value, const char *parmname,
1270  const int *inst, int vectori,
1271  fpreal t, int nestlevel = 1);
1272  void setSilentStringInst(const UT_StringRef &value,
1273  CH_StringMeaning meaning,
1274  const char *parmname,
1275  const int *inst, int vectori,
1276  fpreal t, int nestlevel = 1);
1277  void setSilentDataInst(const PRM_DataItemHandle &value,
1278  const char *parmname, const int *inst,
1279  int vectori, fpreal t, int nestlevel = 1);
1280  // @}
1281 
1282  CH_StringMeaning getStringMeaning(int pi, int vi, fpreal t) const;
1283  CH_StringMeaning getStringMeaning(const char *pn, int vi,
1284  fpreal t) const;
1285  CH_StringMeaning getStringMeaningInst(const char *name, const int *inst,
1286  int vi, fpreal t, int nest_level = 1) const;
1287 
1288  // Batch setting of parameters. The value stored in the batch list will be
1289  // assigned to the operator/parameter which the parameter was last
1290  // evaluated from. This assumes that the parameter list has actually been
1291  // evaluated. Modifications will be done in block mode.
1292  static void setBatchParms(PRM_BatchList &list, fpreal now,
1293  bool set_key=false,
1294  bool create_channels=false);
1295  static bool canSetBatchParms(PRM_BatchList &list, fpreal now);
1296 
1297  // When a new expression is created it will use the node's expression
1298  // language.
1299  CH_ExprLanguage getExprLanguage() const override;
1300  void setExprLanguage(CH_ExprLanguage language);
1301 
1302  // multiparm manipulation
1303  void insertMultiParmItem(const char *pn, int i);
1304  void removeMultiParmItem(const char *pn, int i);
1305 
1306  /// updateMultiParmFromRamp() will follow simple channel references as
1307  /// necessary
1308  void updateMultiParmFromRamp(fpreal t, const UT_Ramp &ramp,
1309  PRM_Parm &m, bool add_wrap,
1311  void updateRampFromMultiParm(fpreal t, const PRM_Parm &m,
1312  UT_Ramp &ramp, bool *time_dep = nullptr,
1313  DEP_MicroNode *depnode = nullptr) const;
1314 
1315  // This method converts an obsolete animated parm to a string parm. It
1316  // will create the necessary backticks for expressions. It does not,
1317  // however, support keyframed channel data or multiple-segment channels,
1318  // in which case the evaluated value at the given time is returned.
1319  // It also does not support CHOP overrides.
1320  // When reset_obs is true, the obsolete parameter is reset to factory
1321  // defaults after the expression has been extracted.
1322  // Returns true if successful, and false otherwise. False is returned
1323  // if the obsolete is at the factory default.
1324  bool convertObsAnimatedToStringExpression(
1325  PRM_ParmList *obsolete_parms,
1326  const char *pn, int vi, fpreal t,
1327  UT_String &result, bool reset_obs);
1328 
1329  /// Expand expressions within string value.
1330  ///
1331  /// This method will expand backtick expressions and local/global
1332  /// variables by modifying the input string. Always use this method instead
1333  /// of calling CH_Manager::expandString() directly within node evaluation
1334  /// code paths in order to establish proper node dependencies.
1335  ///
1336  /// @param channel_name Channel name of the parameter from where val
1337  /// was obtained from. This is important for
1338  /// establishing data and time dependencies.
1339  ///
1340  bool expandString(UT_String &val, fpreal t, int thread,
1341  const char *channel_name = nullptr);
1342 
1343  virtual int findString(const char *str, bool fullword,
1344  bool usewildcards) const;
1345  virtual int changeString(const char *from, const char *to,
1346  bool fullword);
1347 
1348  // These methods check to see if the current value differs from
1349  // the cached ones. The time is the time to evaluate the parm at,
1350  // this does NOT support independent dirty flags for multiple times
1351  // (and likely you wouldn't want that anyways)
1352  // cacheParmValues ONLY saves those who had been tested for dirtiness
1353  //
1354  // NOTE: This is deprecated, please use the override the
1355  // OP_Node::parmListMicroNode() method to detect parm value changes.
1356  //
1357  // This legacy mechanism will cause your parameter to be evaluated
1358  // multiple times per cook.
1359  bool isParmDirty(int idx, fpreal t);
1360  bool isParmDirty(const char *n, fpreal t);
1361  bool isParmDirtyInst(const char *name, const int *inst,
1362  fpreal t, int nestlevel=1);
1363  void cacheParmValues(const OP_Context &context);
1364  void clearParmCache();
1365 
1366  /// Query if a parameter is time dependent, by parm index. If comp == -1,
1367  /// any vector component that is time dependent will return true for the
1368  /// parm.
1369  bool isParmTimeDependent(int idx, int comp = -1) const;
1370 
1371  /// Query if a parameter is time dependent, by parm name. If comp == -1,
1372  /// any vector component that is time dependent will return true for the
1373  /// parm.
1374  bool isParmTimeDependent(const char *name,
1375  int comp = -1) const;
1376 
1377  // error stuff
1378  int getErrorMessages(UT_String &messages,
1380  = UT_ERROR_NONE)
1381  {
1382  ensureErrorsAreUpdatedSubclass();
1383 
1384  OP_Lock::Scope lock(myErrorManagerLock);
1385  stealGlobalErrors();
1386  return myErrorManager.getErrorMessages(messages,
1387  severity);
1388  }
1389 
1390  virtual void getRawErrors(UT_Array<UT_Error> &errors, bool update);
1391 
1392  int findError(const char *type, int code) const
1393  {
1394  OP_Lock::Scope lock(myErrorManagerLock);
1395  return myErrorManager.findError(type, code);
1396  }
1397 
1398  int removeError(int idx)
1399  {
1400  OP_Lock::Scope lock(myErrorManagerLock);
1401  return myErrorManager.removeError(idx);
1402  }
1403 
1405  {
1406  OP_Lock::Scope lock(myErrorManagerLock);
1407  myErrorManager.pruneDuplicates();
1408  }
1409 
1410  void opMessage(int code, const char *m=nullptr) const
1411  { UTaddMessage("OP",code,m);}
1412  void opWarning(int code, const char *m=nullptr) const
1413  { UTaddWarning("OP",code,m);}
1414  void opError(int code, const char *m=nullptr) const
1415  { UTaddError("OP", code, m);}
1416  void opFatal(int code, const char *m=nullptr) const
1417  { UTaddFatal("OP", code, m);}
1418 
1419  void opLocalError(int code, const char *m=nullptr)
1420  {
1421  OP_Lock::Scope lock(myErrorManagerLock);
1422  myErrorManager.addError("OP", code, m);
1423  }
1424  void opLocalWarning(int code, const char *m=nullptr)
1425  {
1426  OP_Lock::Scope lock(myErrorManagerLock);
1427  myErrorManager.addWarning("OP",code,m);
1428  }
1430  {
1431  OP_Lock::Scope lock(myErrorManagerLock);
1432  myErrorManager.addDeadlockError();
1433  }
1434 
1435  /// appendError() adds a generic error *directly* to this node's error
1436  /// manager.
1437  void appendError(const char *type,
1438  int code, const char *m,
1439  UT_ErrorSeverity sev)
1440  {
1441  if (!UTgetErrorManager()->isDisabled())
1442  {
1443  OP_Lock::Scope lock(myErrorManagerLock);
1444  myErrorManager.addGeneric(type, code, m, sev);
1445  }
1446  }
1447 
1448  void clearErrors() // use error(OP_Context&) to avoid querying the current thread id
1449  {
1451  OP_Lock::Scope lock(myErrorManagerLock);
1452  myErrorManager.clearAndDestroyErrors();
1453  }
1454 
1455  void clearErrors(OP_Context &context)
1456  {
1457  UTgetErrorManager(context.getThread())->clearAndDestroyErrors();
1458  OP_Lock::Scope lock(myErrorManagerLock);
1459  myErrorManager.clearAndDestroyErrors();
1460  }
1461 
1462  virtual OP_ERROR getErrorSeverity();
1463 
1464  exint getErrorVersion();
1465 
1466  bool hasDeadlockError() const
1467  {
1468  // We intentionally do NOT lock in this case
1469  return myErrorManager.hasDeadlockError();
1470  }
1471 
1472  virtual OP_ERROR error(OP_Context &context)
1473  {
1474  ensureErrorsAreUpdatedSubclass();
1475 
1476  UT_ErrorManager &mgr = *UTgetErrorManager(context.getThread());
1477  if (mgr.getNumErrors() > 0)
1478  {
1479  stealGlobalErrors();
1480  }
1481  else
1482  {
1483  // Even if we have no errors, we still need to
1484  // update the severity because error logging
1485  // might be disabled.
1486  myErrorManager.updateSeverity(
1487  mgr.getSeverity());
1488  }
1489  return myErrorManager.getSeverity();
1490  }
1491  bool hasError(OP_Context& context)
1492  { return error(context) >= UT_ERROR_ABORT; }
1493  virtual OP_ERROR error() // use error(OP_Context&) to avoid querying the current thread id
1494  {
1495  ensureErrorsAreUpdatedSubclass();
1496 
1498  if (mgr.getNumErrors() > 0)
1499  {
1500  stealGlobalErrors();
1501  }
1502  else
1503  {
1504  // Even if we have no errors, we still need to
1505  // update the severity because error logging
1506  // might be disabled.
1507  myErrorManager.updateSeverity(
1508  mgr.getSeverity());
1509  }
1510  return myErrorManager.getSeverity();
1511  }
1512  bool hasError()
1513  { return error() >= UT_ERROR_ABORT; }
1514  void stealErrors(UT_ErrorManager &src,
1515  bool borrow_only = false);
1516  OP_ERROR getSaveError();
1517  bool isGettingSaveError() const
1518  { return myIsGettingSaveError; }
1519 
1520  // This method should only be called from OP_Channels.
1521  void addChannelError(const char *type, int code,
1522  const char *msg = nullptr);
1523 
1524  void chChanged(CH_Channel *ch, CH_CHANGE_TYPE reason);
1525 
1526  virtual void saveParmsForUndo(bool scoped_only = false,
1527  CH_Collection *collection = nullptr);
1528  void saveSingleParmForUndo(PRM_Parm *parm);
1529  void saveParmForUndo(PRM_Parm *);
1530  virtual void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime);
1531 
1532  // Clear any undo flags for the node in question
1533  virtual void clearUndoFlags();
1534  virtual void setAnyUndoFlag();
1535  int getAnyUndoPending() const { return myAnyUndoFlagSet; }
1536 
1537  int canAccess(unsigned mask) const;
1538  bool canAccess(unsigned mask, const PRM_Parm *parm) const;
1539  bool canAccessChannel(uint mask,
1540  const CH_Channel *chp) const;
1541  void updateUserMask();
1542 
1543  bool canModifyFromUI(const PRM_Parm *parm, int vi) const;
1544 
1545  // If an OP references external files, this method should be implemented to
1546  // reload new data which is out of date with the external file. If data
1547  // was re-loaded, then the method should return 1 (otherwise 0).
1548  virtual int reloadNewFiles(fpreal time_now);
1549 
1550  void triggerOPChanged(OP_EventType reason, exint index);
1551 
1552  void parmChanged( int parm_index );
1553  void parmExprChanged(int parm_index);
1554 
1555  // This is called when our OP_Operator is deleted before we are.
1556  void operatorDeleted();
1557 
1558  // These functions deal with the opparm command.
1559  void saveParmCommand(std::ostream &os, int values = 0,
1560  int defaultstoo = 1,
1561  bool spareparms = true) const;
1562  int loadParmCommand(int argc, const char *const argv[],
1563  int docallbacks, void *data,
1564  fpreal now, bool followchrefs,
1565  CMD_Args *args);
1566  void commandParmCallback(void *data, fpreal now,
1567  int argc, char *argv[],
1568  CMD_Args *args);
1569  void saveMultiParmInstanceCommand(
1570  std::ostream &os,
1571  const char *opname,
1572  bool spareparms) const;
1573 
1574  // Run the callback function for a particular parm, and the callbacks
1575  // of any parms linked to this parm. This function is implemented in
1576  // OP_Node.
1577  virtual bool triggerParmCallback(
1578  PRM_Parm *parmptr,
1579  fpreal now,
1580  int value,
1581  void *data,
1582  const UT_Options *options = nullptr) = 0;
1583 
1584  int64 getMemoryUsage(bool inclusive) const override;
1585 
1586  void bumpTakeReference(int dir)
1587  { myTakeReferences += dir; }
1588  int getTakeReferences() const
1589  { return myTakeReferences; }
1590 
1591 
1592  /// This method will create channel groups and populate them with
1593  /// channels from this operator. The channel groups created will
1594  /// correspond to the folders in this operator's parameters.
1595  /// Unless only_channels is specified, all auto-scoped parms will get
1596  /// included.
1597  void createChannelGroupsFromFolders(CH_Group &parent_group,
1598  bool only_channels,
1599  bool leaf_channels_only = false,
1600  bool only_unlocked = true);
1601 
1602 
1603  /// Returns the scoped channel ref corresponding to a parameter.
1604  bool getAutoScopedChannel(PRM_Parm *parm, int vector_index,
1605  OP_GetAutoScopedOptions &opts, CH_ChannelRef &chref);
1606 
1607  /// Returns a list of the autoscopeable channels for this node.
1608  /// if follow_layer_overrides is true, the channel references are followed but only for animation layers.
1609  /// if include_animated is true, channels without the auto scope flag but with animation will also be returned.
1610  void getAutoScopedChannels(CH_ChannelRefList &chlist,
1611  bool follow_layer_overrides=true,
1612  bool include_animated=false,
1613  bool follow_channel_refs=true,
1614  bool include_autoscope=true
1615  );
1616 
1617  /// Returns a list of the autoscopeable channels for this node.
1618  /// The options are passed as a OP_GetAutoScopedOptions
1619  void getAutoScopedChannels(CH_ChannelRefList &chlist,
1620  OP_GetAutoScopedOptions &opts);
1621 
1622  // Returns command to chopscope CHOPed channels for this node.
1623  void getChopScopeChannels(UT_WorkBuffer &chopscope_cmd);
1624 
1625  // Returns true if the specified parameter is visible in the interface
1626  // templates. This accounts for visiblity of containing parm pages
1627  // as well as the parm itself.
1628  bool getParmIsVisible(const char *parmname);
1629 
1630  // Returns a pointer to the templates used in constructing dialogs for
1631  // this node.
1632  const PRM_Template *getInterfaceParmTemplates() const;
1633 
1634  const PRM_Template *getSpareParmTemplates() const;
1635  const PRM_ScriptImports *getSpareParmTemplateImports() const;
1636  const PRM_Template *getSpareParmLayoutTemplates() const;
1637  const PRM_ScriptImports *getSpareParmLayoutTemplateImports() const;
1638  int getSpareParmTemplatesId() const;
1639 
1640  /// The number of potential spare inputs created by spare
1641  /// parameters. These are spare_input0 and onwards. There may be holes.
1642  int numSpareInputs() const;
1643 
1644  // Get our multiparm instance info used by initMultiparmInstance.
1645  bool hasMultiparmInfo() const;
1646  OP_MultiparmInfo &getMultiparmInfo();
1647 
1648  // This function is caled when any multiparm has a new instance added.
1649  // It gives the parm owner a chance to initialize the multiparm values.
1651  // This function sends an opChanged notification of our multiparm change.
1652  void addOrRemoveMultiparmInstance() override;
1653 
1654  bool savePresetContents(std::ostream &os) override;
1655  bool loadPresetContents(const char *tok, UT_IStream &is) override;
1656 
1657  static void buildMParmInst(const PRM_Template *templates,
1658  UT_StringArray &mparm_inst,
1659  UT_IntArray &mparm_lvl,
1660  int level);
1661  static bool isMParmInstance(const char *chname,
1662  const UT_StringArray &mparm_inst,
1663  const UT_IntArray &mparm_lvl);
1664 
1665  // Retrieve Animation Layers from a Scoped Channel List
1666  static void getLayersFromScopedChannels(
1667  const CH_ChannelRefList &ori_refs,
1668  CH_ChannelRefList &layer_refs );
1669 
1670  // setChRef* methods with name resolution of the parameter index
1671  // @{
1672  void setChRefInt(const char *parmname, int &pi, int vi, fpreal t, exint val,
1674  bool propagate=true);
1675  void setChRefFloat(const char *parmname, int &pi, int vi, fpreal t, fpreal val,
1676  PRM_AddKeyType add_key=
1678  bool propagate=true);
1679  void setChRefString(const UT_StringRef &val,
1680  CH_StringMeaning meaning,
1681  const char *parmname, int &pi, int vi,
1682  fpreal t,
1683  PRM_AddKeyType add_key=
1685  bool propagate=true);
1686  void setChRefData(const char *parmname, int &pi, int vi, fpreal t, const PRM_DataItemHandle &val,
1688  bool propagate=true);
1689  // @}
1690 
1691  void createParmMicroNode(const UT_StringRef &pn, int *pi );
1692 
1693  /// @{ Returns the parameter that controls the activation
1694  /// state of the parameter by the given name.
1695  PRM_Parm * getParmActivationControl(
1696  const UT_StringRef &parm_name);
1697  static UT_StringHolder getParmActivationControlName(
1698  const UT_StringRef &parm_name);
1699  /// @}
1700 
1701 protected:
1702  void doGetFullPath(UT_WorkBuffer &str) const override;
1703 
1704  // Uses the specified conditional stored on the PRM_Template for the
1705  // specified parameter to check whether the specified parm should
1706  // be updated based on the conditional. Returns false if the parm state
1707  // doesn't change.
1708  bool updateParmDisableConditional(
1709  PRM_Parm &parm,
1710  bool force,
1711  const UT_StringArray *skip = nullptr);
1712 
1713  bool updateParmHideConditional(
1714  PRM_Parm &parm,
1715  const UT_StringArray *skip = nullptr);
1716 
1717  // Disable if inactive, and enable is active. Uses an activation toggle
1718  // parameter that corresponds to the given paramter to decide
1719  // whether the given paramter is enabled/disabled.
1720  // The correspondence is implicit by parameter naming conventions.
1721  // If disable is true and toggle is off, the given parameter will be
1722  // disabled; if disable is false and toggle is on, it will be enabled;
1723  // else the enable/disable state remains unchanged.
1724  bool updateParmDisableIfInactive(PRM_Parm &parm,
1725  bool disable = true);
1726 
1727  // Returns zero if no change was made. This function is overridden
1728  // by subclasses to disable parms specific to those nodes.
1729  // NOTE: Superseded by the updateParmsFlags() function.
1730  SYS_DEPRECATED(12.0)
1731  virtual unsigned disableParms();
1732 
1733  // This function is overridden by subclasses to update parm flags specific
1734  // to those nodes.
1735  // Returns false if no change was made.
1736  virtual bool updateParmsFlags() { return false; }
1737  virtual bool preUpdateParmsFlags() { return false; }
1738 
1739 
1740  void saveMultiParmForUndo(int index);
1741 
1742  void stealGlobalErrors();
1743  void stealErrors(OP_Parameters &src);
1744 
1745  // NOTE: Do not hold onto the ptr object longer than necessary!
1748  {
1750  myErrorManager, myErrorManagerLock);
1751  }
1752 
1753  virtual void permissionError(const char *chname = nullptr);
1754 
1755  // checkExpressionError() is split up into a checking part and an actual
1756  // error handling part, evaluationError() so that the checking part can
1757  // be inlined.
1759  const PRM_Parm *parm, int thread) const
1760  {
1761  int err = ev_GetErrNo(thread);
1762  if (err == EV_NOERROR)
1763  return false;
1764  evaluationError(parm, err, thread);
1765  return true;
1766  }
1767 
1768  void resetParmEventHandler();
1769 
1770  int *allocIndirect(int size=64);
1771 
1772  OP_Parameters(const char *name, OP_Operator *entry);
1773  OP_Parameters(const OP_Parameters &source, const char *name);
1774  ~OP_Parameters() override;
1775 
1776  //
1777  // The "initializeParms" method must be called to provide the channel
1778  // collection and build the parameter list.
1779  //
1780  void initializeParms(OP_Channels *channels);
1781 
1782  // op dependencies
1783  virtual void buildOpDependencies()
1784  { }
1785  virtual void checkChannelDependencies(CH_Channel * /*ch*/,
1786  CH_CHANGE_TYPE /*reason*/)
1787  { }
1788 
1789  static bool isReservedOpName(const char *name);
1790 
1791  virtual int rename(const char *newname);
1792  virtual bool createSpareParameterFromChannel(const char *chname);
1793  virtual bool createSpareParametersFromChannels(
1795  const CH_ChannelList &channels);
1796 
1797  CH_LocalVariable *getVariable(int i) const;
1798  CH_LocalVariable *getVariable(const char *name) const;
1799 
1800  //
1801  //
1802  OP_ERROR saveChannels(std::ostream &os, int binary,
1803  bool compiled, bool selected,
1804  bool pending_state);
1805  OP_ERROR saveParmChannels(int parm_index, std::ostream &os,
1806  int binary, bool compiled);
1807  OP_ERROR saveParameters(std::ostream &os, int binary,
1808  bool compiled);
1809  OP_ERROR saveChannelAliases(std::ostream &os, int binary);
1810 
1811  bool loadChannels(UT_IStream &is, const char *path,
1812  CH_Collection *obsolete_channels);
1813  bool loadParameters(UT_IStream &is, const char *path,
1814  PRM_ParmList *obsolete_parms);
1815  bool loadChannelAliases(UT_IStream &is,
1816  const char *path = nullptr);
1817  bool loadOldSpareParms(UT_IStream &is);
1818 
1819  // Allow our sub-class to be notified when something gets changed
1820  // Since the parameter only holds the name & the parameters, there
1821  // are only two types of events generated here...
1822  virtual void opChanged(OP_EventType type,
1823  void *dataptr = nullptr) = 0;
1824 
1825  /// This is a helper method to the setChannelScope method. It traverses
1826  /// the node's parameters and sets the scope on them according to the
1827  /// given pattern.
1828  virtual void traverseScope(const char *pattern, OP_ScopeOp scope_op,
1829  const OP_ScopeOptions &scope_options);
1830 
1831  // A virtual method to get access to the associated node flag. This would
1832  // probably be unnecessary if myTakeReferences were used.
1833  virtual bool getHasTakeData() const { return false;}
1834 
1835  /// Ensure that the node errors are up-to-date.
1836  /// This method gives our subclass a chance to insert any errors on-demand.
1838 
1839  /// Ensure that the spare parameter templates are up-to-date.
1840  /// This method gives our subclass a chance to update the spare parameters
1841  /// on-the-fly before returning them.
1843 
1846 
1847 private:
1848 
1849  // When the spare parameter definitions for a node changes, this function
1850  // is called to update the parameters to be in line with the new set of
1851  // templates. The old templates must still exist at this point.
1852  virtual void updateSpareParmTemplates(
1853  PRM_Template *newtemplates,
1854  bool leavedefaultsunchanged) = 0;
1855 
1856  template<class T>
1857  void traverseScopeT(const char *pattern, OP_ScopeOp scope_op,
1858  const OP_ScopeOptions &scope_options);
1859 
1860  // evaluationError() generates the appropriate call to opError() and then
1861  // clears the expression error state.
1862  void evaluationError(const PRM_Parm *parm, int err,
1863  int thread) const;
1864 
1865  // these methods are the actual instantiation of the set... and
1866  // setSilent... methods.
1867  void setFullInt(int parmi, int vectori, fpreal t,
1868  exint value, bool p);
1869  void setFullInt(const char *parmname, int vectori, fpreal t,
1870  exint value, bool p);
1871  void setFullInt(const char *parmname, int &parmi,
1872  int vectori, fpreal t, exint value, bool p);
1873 
1874 
1875  void setFullFloat(int pi, int vi, fpreal t, fpreal val,
1876  PRM_AddKeyType add_key, bool propagate);
1877  void setFullFloat(const char *pn, int vi, fpreal t,
1878  fpreal val, PRM_AddKeyType add_key,
1879  bool propagate);
1880  void setFullFloat(const char *pn, int &pi, int vi,
1881  fpreal t, fpreal val,
1882  PRM_AddKeyType add_key, bool propagate);
1883 
1884  void setFullString(const UT_StringRef &val,
1885  CH_StringMeaning meaning, int pi, int vi,
1886  fpreal t, bool ppropagate);
1887  void setFullString(const UT_StringRef &val,
1888  CH_StringMeaning meaning,
1889  const char *pn,
1890  int vi, fpreal t, bool propagate);
1891  void setFullString(const UT_StringRef &val,
1892  CH_StringMeaning meaning,
1893  const char *pn,
1894  int &pi, int vi, fpreal t,
1895  bool propagate);
1896 
1897  void setFullData(int pi, int vi, fpreal t,
1898  const PRM_DataItemHandle &val, bool p);
1899  void setFullData(const char *pn, int vi, fpreal t,
1900  const PRM_DataItemHandle &val, bool p);
1901  void setFullData(const char *pn, int &pi, int vi, fpreal t,
1902  const PRM_DataItemHandle &val, bool p);
1903 
1904  void setFullIntInst(exint value, const char *parmname,
1905  const int *inst, int vectori, fpreal t,
1906  int nestlevel, bool propagate);
1907  void setFullFloatInst(fpreal val, const char *name,
1908  const int *inst, int vi, fpreal t,
1909  int nestlevel, bool propagate);
1910  void setFullStringInst(const UT_StringRef &val,
1911  CH_StringMeaning meaning,
1912  const char *name,
1913  const int *inst, int vi, fpreal t,
1914  int nestlevel, bool propagate);
1915  void setFullDataInst(const PRM_DataItemHandle &val,
1916  const char *name, const int *inst,
1917  int vi, fpreal t, int nestlevel,
1918  bool propagate);
1919 
1920  // Set values given a parameter pointer (rather than a lookup index).
1921  // These all take add_key and propagate parameters.
1922  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1923  exint value, PRM_AddKeyType add_key,
1924  bool propgate);
1925  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1926  fpreal val, PRM_AddKeyType add_key,
1927  bool propgate);
1928  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1929  const char *value,
1930  CH_StringMeaning meaning,
1931  PRM_AddKeyType add_key, bool propgate);
1932  bool setFull(PRM_Parm &parm, int vectori, fpreal now,
1933  const PRM_DataItemHandle &val,
1934  PRM_AddKeyType add_key, bool propgate);
1935 
1936  bool determineParmVisibility(const char *parmname,
1937  const PRM_Template *prm,
1938  bool &visible);
1939 
1940  // Event handler
1941  static void changeEvent(void *, CH_CHANGE_TYPE, int);
1942 
1943  static void addLayerFromScopedChannels(
1944  const UT_StringRef &path,
1945  CH_ChannelRefList &chanrefs,
1946  UT_StringSet &scoped_layers);
1947 
1948  mutable OP_Lock myErrorManagerLock;
1949  UT_ErrorManager myErrorManager;
1950 
1951  UT_StringHolder myName;
1952  OP_Operator *myTableEntry;
1953  uint myTakeReferences;
1954 
1955  unsigned myUndoAllParmSavedFlag:1,
1956  myUndoScopedSavedFlag:1,
1957  myAnyUndoFlagSet:1,
1958  myIsGettingSaveError:1;
1959 
1960  OP_ParmCache *myParmCache;
1961 
1962  OP_SpareParms *mySpareParms;
1963  bool myChangingSpareParms;
1964 
1965  OP_MultiparmInfo *myMultiparmInfo;
1966 
1967  friend class OP_TakeParm;
1968  friend class OP_UndoMultiParm;
1969  friend class OP_UndoParm;
1970  friend class OP_UndoSpareParm;
1971 };
1972 
1973 // helper functions
1974 
1975 OP_API PRM_Parm *OPgetParameterFromChannel( CH_Channel *chp, int *vecidx );
1979 
1980 #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:59
#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)
#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
fpreal evalFloat(const UT_StringRef &pn, int *pi, int vi, fpreal t) const
CH_ExprLanguage
void skip(T &in, int n)
Definition: ImfXdr.h:613
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)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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
virtual bool preUpdateParmsFlags()
GLint level
Definition: glcorearb.h:108
fpreal evalFloat(int pi, int vi, fpreal t) const
void opLocalWarning(int code, const char *m=nullptr)
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
void opWarning(int code, const char *m=nullptr) const
DEP_MicroNodeList * myFollowedParmMicroNodes
**But if you need a result
Definition: thread.h:622
void opLocalDeadlockError()
int getParmIndex(const UT_StringRef &name) const
void appendError(const char *type, int code, const char *m, UT_ErrorSeverity sev)
void opError(int code, const char *m=nullptr) const
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
bool evalVectorProperty(const UT_StringRef &parm_name, fpreal now, int *values, int vec_size, PRM_Parm **parmptr=nullptr) const
void evalStringRaw(UT_StringHolder &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
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=nullptr) const
< returns > If no error
Definition: snippets.dox:2
double fpreal64
Definition: SYS_Types.h:201
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
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
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
void evalStringRaw(UT_StringHolder &val, const UT_StringRef &pn, int vi, fpreal t) const
fpreal evalFloat(const PRM_Parm *parm, int vi, fpreal t) const
void evalStringInstRaw(const UT_StringRef &name, const int *inst, UT_StringHolder &val, int vi, fpreal t, int nestlevel=1) const
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)
SYS_FORCE_INLINE const UT_StringHolder & getName() const
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
void opFatal(int code, const char *m=nullptr) const
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)
bool evalParameterOrPropertyExpr(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=nullptr) const
virtual void ensureSpareParmsAreUpdatedSubclass()
bool evalVectorProperty(const UT_StringRef &parm_name, fpreal now, fpreal *values, int vec_size, PRM_Parm **parmptr=nullptr) const
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
GA_API const UT_StringHolder parms
void evalStringInst(const UT_StringRef &name, const int *inst, UT_String &val, int vi, fpreal t, int nestlevel=1) const
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)
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Definition: NanoVDB.h:976
bool evalParameterOrPropertyRaw(const UT_StringRef &parm_name, int vec_index, fpreal now, UT_String &value, PRM_Parm **parmptr=nullptr) const
virtual void resolveObsoleteParms(PRM_ParmList *)
fpreal64 fpreal
Definition: SYS_Types.h:278
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:96
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
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
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
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
void evalStringRaw(UT_StringHolder &val, const PRM_Parm *parm, int vi, fpreal t) const
**If you just want to fire and args
Definition: thread.h:618
void takeDeactivateParm(uint idx)
int getErrorMessages(UT_String &messages, UT_ErrorSeverity severity=UT_ERROR_NONE)
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, int &value, PRM_Parm **parmptr=nullptr) const
void opMessage(int code, const char *m=nullptr) const
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
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 evalFloats(const UT_StringRef &pn, fpreal64 *v, fpreal t) const
void opLocalError(int code, const char *m=nullptr)
const PRM_Parm * getParmPtr(const UT_StringRef &name) const
bool evalParameterOrProperty(const UT_StringRef &parm_name, int vec_index, fpreal now, fpreal &values, PRM_Parm **parmptr=nullptr) const
OP_ScopeOp
Definition: OP_Parameters.h:58
int getThread() const
Definition: OP_Context.h:84
void evalFloats(const UT_StringRef &pn, fpreal32 *v, fpreal t) const
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
state
Definition: core.h:2289
UT_LockedRawPtr< UT_ErrorManager, OP_Lock > getLockedErrorManager()
int getNumErrors() const
void evalStringRaw(UT_StringHolder &val, int pi, int vi, fpreal t) const
int getTakeReferences() const
static void followChannelReferences(const OP_FollowChanRefsOptions &opt, CH_ChannelRef &ref)
bool hasParm(const UT_StringRef &name) const
Definition: format.h:1821
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)
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()