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