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