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