HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PRM_Parm.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: PRM_Parm.h (Parameter Library)
7  *
8  * COMMENTS:
9  * PRM_Parm is the class which contains all the information
10  * about a parameter. A parameter is any value or set of
11  * values that are used in the Houdini world. It may contain
12  * expressions, channels, or simple values.
13  *
14  * It is divided into two part, the parameter's type
15  * definition, stored in the PRM_Template, and the
16  * parameter's actual data, stored in the PRM_Instance.
17  * Each PRM_Parm contains all the information it needs to
18  * perform its functions independently of other objects.
19  */
20 
21 #ifndef __PRM_Parm__
22 #define __PRM_Parm__
23 
24 #include "PRM_API.h"
25 #include "PRM_ChanState.h"
26 #include "PRM_Default.h"
27 #include "PRM_KeySetType.h"
28 #include "PRM_ParmOwner.h"
29 #include "PRM_Template.h"
30 #include "PRM_Type.h"
31 
32 #include <CH/CH_Types.h>
33 #include <DEP/DEP_MicroNode.h>
34 
35 #include <UT/UT_IntArray.h>
36 #include <UT/UT_SharedPtr.h>
37 #include <UT/UT_SmallObject.h>
38 #include <UT/UT_StringHolder.h>
39 #include <SYS/SYS_Types.h>
40 
41 #include <iosfwd>
42 
43 class PRM_Instance;
44 class PRM_Multi;
45 class PRM_ParmList;
46 class PRM_RefId;
47 class PRM_Value;
48 class CH_Channel;
49 class CH_Collection;
50 class CH_FullKey;
51 class UT_JSONValueMap;
52 class UT_String;
53 class UT_TokenString;
54 
55 
56 /// An enumeration specifying how, if wanted, keys are set when values are
57 /// set.
59 {
60  PRM_AK_MARK_PENDING, ///< Keys are not immediately added for the value
61  /// being but marked as pending.
62  PRM_AK_SET_KEY, ///< Keys are added if the current value differs
63  /// from the value being set.
64  PRM_AK_FORCE_KEY ///< Keys are added even if the current value
65  /// matches the value being set.
66 };
67 
68 
70 {
73 };
74 
76 {
77 public:
78  virtual ~PRM_DataItem() {}
79 
80  virtual PRM_Type::PRM_DataType getDataType() const = 0;
81  virtual const char *getDataTypeToken() const = 0;
82  virtual bool saveAscii(std::ostream &os) const = 0;
83  virtual bool saveBinary(std::ostream &os) const = 0;
84  virtual int64 getMemoryUsage() const = 0;
85 
86  // Data accessors.
87  virtual UT_JSONValueMap *getKeyValueDict() const { return nullptr; }
88 };
90 
92 {
93 public:
94  virtual ~PRM_DataFactory() {}
95 
96  virtual const char *getDataTypeToken() const = 0;
97  virtual PRM_DataItemHandle loadBinary(UT_IStream &is) const = 0;
98  virtual PRM_DataItemHandle loadAscii(UT_IStream &is) const = 0;
99 
100  static void install(const char *type, PRM_DataFactory *factory);
101  static PRM_DataItemHandle parseAscii(const char *type, UT_IStream &is);
102  static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is);
103 };
104 
106 {
107 public:
108  virtual ~PRM_UndoData() {}
109 
110  virtual const char *getDataType() const = 0;
111  virtual int64 getMemoryUsage() const = 0;
112 };
113 
116 
117 class PRM_API PRM_Parm : public UT_SmallObject<PRM_Parm,
118  UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
119  UT_SMALLOBJECT_PAGESIZE_DEFAULT,
120  UT_SMALLOBJECT_THREADSAFE_OFF>
121 {
122 public:
123  // for these constructors, a nil CH_Collection is invalid
124  // only PRM_ParmList handles a nil correctly
125  PRM_Parm(PRM_Template *thetemplate,
126  PRM_ParmList *owner);
127  PRM_Parm(PRM_Parm *theprm,
128  PRM_ParmList *owner);
129  ~PRM_Parm();
130 
131  void adopt(PRM_Parm &thesrcparm);
132  void adoptOverrides(PRM_Parm &srcparm);
133 
134  void revertToDefaults(fpreal time);
135  void revertToDefault(fpreal time, int index, bool propagate=true);
136  void restoreFactoryDefaults();
137  void restoreFactoryDefault(int index);
138 
140  { return myDestructiveRevertToDefaultFlag; }
142  { myDestructiveRevertToDefaultFlag = v; }
143 
145  { return myRevertInvisibleToDefaultsFlag; }
147  { myRevertInvisibleToDefaultsFlag = v; }
148 
150  { return myMakeSpareParmsForUnknownChannelsFlag; }
152  { myMakeSpareParmsForUnknownChannelsFlag = v; }
153 
154  // Static functions to access PRM_Instance subclass static functions.
155  static bool isStringThatCanExpand(const char *str);
156  static bool isOrdinalExpression(const char *str,
157  const PRM_Template *tplate = nullptr);
158  static bool isOrdinalExpression(const PRM_Default &dflt,
159  const PRM_Template *tplate = nullptr);
160 
161  // Static functions to convert string parm values to and from
162  // expressions.
163  static void convertStringToExprLanguage(const char *str,
164  UT_String &expr,
165  PRM_Template *tplate = nullptr);
166  static void convertStringFromExprLanguage(const char *str,
167  UT_String &expr);
168 
169  // Static functions to access PRM_Multi static functions.
170  static bool getIsAddingOrRemovingMultiParms();
171  // Replace a number in the source string and return the result in the
172  // destination (work buffer)
173  static bool replaceMultiNumber(UT_String &str, const char *replace);
174  // If there are any numeric placeholders left in the specified string,
175  // this function replaces them with underscores.
176  static bool replaceRemainingMultiNumbers(UT_String &str);
177  // Instance a string, replacing all '#' marks with integers from the
178  // index list.
179  static void instanceMultiString(UT_String &token,
180  const UT_IntArray &indexlist,
181  bool fill_remaining=true);
182  static void instanceMultiString(UT_String &token,
183  const int *indexlist, int num,
184  bool fill_remaining=true);
185 
186  static bool getAlwaysHardenFlag() { return myAlwaysHardenFlag; }
187  static void setAlwaysHardenFlag(bool o) { myAlwaysHardenFlag = o; }
188 
189  int isDefault() const;
190  int isDefault(int index) const;
191  int isFactoryDefault() const;
192  int isFactoryDefault(int index) const;
193 
194  // isTrueFactoryDefault differs from isFactoryDefault in that it
195  // will do a string compare on the expression if there is one, thus
196  // an expression that evaluates to the default value will still not be a
197  // "true" factory default.
198  int isTrueFactoryDefault(int index) const;
199  int isTrueFactoryDefault() const;
200 
201  // These are exactly like isTrueFactoryDefault() except that it excludes
202  // the checking of the lock flag. This is because we don't want locked
203  // parms to show up bolded in the parameters pane.
204  int isFactoryDefaultUI(int index) const;
205  int isFactoryDefaultUI() const;
206 
207  void overwriteDefaults(fpreal time);
208  void overwriteDefault(fpreal time, int index);
209 
210  void buildOpDependencies(const PRM_RefId &ref_id, int thread);
211  void changeOpRef(const char *new_fullpath, const char *old_fullpath,
212  const char *old_cwd, const char *chan_name,
213  const char *old_chan_name,
214  void (*undo_callback)(void *), void *undo_data,
215  int thread);
216 
217  void getValue(fpreal time, int32 &value, int index,
218  int thread) const;
219  void getValue(fpreal time, int64 &value, int index,
220  int thread) const;
221  void getValue(fpreal time, fpreal &value, int index,
222  int thread) const;
223  void getValue(fpreal time, UT_String &value, int index,
224  bool expand, int thread) const;
225  void getValue(fpreal time, UT_StringHolder &value, int index,
226  bool expand, int thread) const;
227  void getValue(fpreal time, PRM_DataItemHandle &value, int index,
228  int thread) const;
229 
230  // Specialized variant for Key-Value Dictionary data parameters.
231  // Return either an expanded or unexpanded JSON map.
232  void getValue(fpreal time, UT_JSONValueMap &value, int index,
233  bool expand, int thread) const;
234 
235  void getValues(fpreal time, fpreal32 *value, int thread) const;
236  void getValues(fpreal time, fpreal64 *value, int thread) const;
237  void getValues(fpreal time, int32 *value, int thread) const;
238  void getValues(fpreal time, int64 *value, int thread) const;
239  void getDefaultValue(fpreal &value, int index) const;
240  void getDefaultValue(UT_String &value, int index) const;
241 
242  // The following method is very similar to getExpressionOrValue() except
243  // that it returns a custom string when the parameter is overridden by a
244  // CHOP.
245  void getExpressionStringForUI(fpreal time, UT_String &value,
246  int index, int thread) const;
247 
248  // The following method, unlike getExpressionOnly(), will convert the
249  // value to a string and return that if there is no channel.
250  void getExpressionOrValue(fpreal time, UT_String &value,
251  int index, int thread) const;
252  void getExpressionOrValue(fpreal time, UT_StringHolder &value,
253  int index, int thread) const;
254 
255  // The following method returns the expression string, returning an empty
256  // string in the case of a parameter with no channel/expression.
257  void getExpressionOnly(fpreal time, UT_String &value,
258  int index, int thread) const;
259 
260  bool setExpression(fpreal time, const char *value,
261  CH_ExprLanguage language,
262  int index, bool evaluate = true,
263  bool rmchannel = false, bool propagate = true);
264 
265  // returns true if the value was set, of false otherwise (eg, parm locked)
266  bool setValue(fpreal time, const char *value,
267  CH_StringMeaning meaning,
268  bool kill_expr = false, int index = 0,
270  bool propagate = true);
271 
272  bool setValue(fpreal time, fpreal value,
273  bool kill_expr = false, int index = 0,
275  bool propagate = true);
276 
277  bool setValue(fpreal time, int32 value,
278  bool kill_expr = false, int index = 0,
280  bool propagate = true);
281 
282  bool setValue(fpreal time, int64 value,
283  bool kill_expr = false, int index = 0,
285  bool propagate = true);
286 
287  bool setValue(fpreal time, const PRM_DataItemHandle &value,
288  bool kill_expr = false, int index = 0,
290  bool propagate = true);
291 
292  //
293  // The setValues methods set all entries in the vector at once...
294  // returns true if the values were set, of false otherwise (eg, parm locked)
295  //
296  bool setValues(fpreal time, const fpreal *values,
297  bool kill_expr = false,
299  bool propagate = true);
300 
301  bool setValues(fpreal time, const int32 *values,
302  bool kill_expr = false,
304  bool propagate = true);
305 
306  bool setValues(fpreal time, const int64 *values,
307  bool kill_expr = false,
309  bool propagate = true);
310 
311  //
312  // Multi Parms methods.
313  //
314 
315  // Returns true if the parm is a multi parm
316  bool isMultiParm() const;
317 
318  // Insert a new Multi Parm Instance before index.
319  // If index equals zero, the parm instance can be added at the start of the
320  // list.
321  // If index equals MultiParmNumItems(), the parm instance is added at the
322  // end of the list.
323  void insertMultiParmItem(int index, bool propagate = 1);
324 
325  // Remove Multi Parm Instance at index.
326  void removeMultiParmItem(int index, bool propagate = 1);
327 
328  // Revert Multi Parm Instance at index.
329  void revertMultiParmItem(int index);
330 
331  // Revert all the multi parm instances. This is has different behaviour for
332  // ramps in that it will revert to the initialized state.
333  void revertAllMultiParmItems();
334 
335  // Copy all the Parm Values under the Multi Parm Instance from index 'from'
336  // to index 'to'.
337  void assignMultiParmItem(int from, int to);
338 
339  // Swap 2 Multi Param instances.
340  // This can be used to move up and down param instances in the list.
341  void swapMultiParmItem(int from, int to);
342 
343  // Returns the number of instance parameters.
344  int getMultiParmNumItems() const;
345 
346  // Returns the number of parameters within an instance parameter.
347  // It returns 1 for array of simple types ( int, float, string ).
348  // It returns the number of parameters within the struct for array of
349  // structs.
350  int getMultiParmInstancesPerItem() const;
351 
352  // Returns the param token for an instance parm at 'index' and child parm
353  // at 'p'.
354  const char* getMultiParmToken(int p, int index) const;
355 
356  // Returns the number of UI Parms Entries.
357  // A float3 or color4 will account for a single parameter.
358  // An int, string or float will account for one parm as well.
359  int getMultiParmUIEntries() const;
360 
361  // Returns the PRM_Template at index 'idx'
362  const PRM_Template *getMultiParmTemplate(int idx) const;
363  PRM_Template *getMultiParmTemplate(int idx);
364 
365  // These functions allow a linear traversal of all multiparm instance
366  // parameters.
367  PRM_Parm *getMultiParm(int idx) const;
368  int getMultiParmCount() const;
369 
370  // The only difference between the next two functions is that the
371  // second sends the change notification without question. The first
372  // calls the second, but only if the parm isn't a PRM_CALLBACK. In
373  // those cases we usually don't want to actually send out change
374  // notifications. The notable exception is the opparm -c command.
375  void valueChanged(int vec_idx, bool propagate)
376  { privateValueChanged(vec_idx, propagate,
377  /*update_multi*/true); }
378  void sendValueChanged(int vec_idx, bool propagate);
379  void indirectChange(int vec_idx, bool expr_changed,
380  bool update_multi = true);
381 
382  PRM_Callback getCallback() { return getTemplatePtr()->getCallback(); }
383  int setOverride(int index, int data_idx, const char *source,
385  const char *getOverride(int index) const;
386  int getOverrideDataIndex(int index) const;
387  bool getOverrideNodePath(int index, UT_String &path) const;
388  bool getOverrideTrackName(int index, UT_String &trackname) const;
389  bool getOverrideType(int index, PRM_OverrideType &type) const;
390  int setOverrideDisable(int index, int onoff);
391  int getIsOverrideActive(int index) const;
392 
393  /// copyParm() copies the value of an entire parm, including channels. If
394  /// it is a multi-parm, then all instance parameters will be also be
395  /// copied. If the they are a mismatch of vector sizes, the smaller of the
396  /// two sizes will be used.
397  void copyParm(const PRM_Parm &src);
398 
399  /// copyValue copies the value for a particular parm component. If
400  /// current_value_only is true, then only the value evaluated at time t
401  /// will be copied. Otherwise, any channels in the src_parm will be copied
402  /// wholesale.
403  void copyValue(fpreal t, int dest_vi,
404  const PRM_Parm &src_parm, int src_vi,
405  bool set_name_alias,
406  bool current_value_only,
407  bool set_value_to_default = false,
409  PRM_KeySetType key_set_type = PRM_USE_PREFERENCES);
410 
411  void addChannels();
412  void addChannel(int index, bool propagate = true);
413  void addChannel(int index, const char *theexpr,
414  CH_ExprLanguage language, bool propagate = true);
415  int addChannel(const char *name);
416  int addChannel(const char *name, const char *expr,
417  CH_ExprLanguage language);
418 
419  void clearAndDestroyChannels(bool force = false);
420  void removeChannel(int index, bool propagage = true);
421 
422  // Destroy and clear references to those channels not referenced by the
423  // supplied replacement parameter.
424  void clearAndDestroyUnrefChannels(const PRM_Parm &repl_parm);
425 
426  CH_Channel *getChannel(int subindex) const;
427  int getChannelCount() const;
428 
429  void reloadChannelPtrs();
430  int channelPtrModified(const char *name);
431 
432  int isTimeDependent() const;
433  bool isTimeDependent(int subindex) const;
434  int isDataDependent(fpreal gtime) const;
435  bool isDataDependent(fpreal gtime, int subindex) const;
436  void forceTimeDependent(int subindex);
437 
438  bool hasContextOptionDeps(int subindex) const;
439  const DEP_ContextOptionDeps &getContextOptionDeps(int subindex) const;
440  void forceContextOptionDep(int subindex,
441  const UT_StringHolder &opt);
442 
443  const PRM_Type &getType() const;
444  PRM_TypeExtended getTypeExtended() const;
445  PRM_MultiType getMultiType() const;
446  fpreal getMultiSize() const;
447  int getMultiStartOffset() const;
448 
449  bool isRampType() const;
450  bool isRampTypeColor() const;
451 
452  int getVectorSize() const
453  { return getTemplatePtr()->getVectorSize(); }
454  void getChannelToken(UT_String &thestrref, int index = 0) const;
455  void getChannelLabel(UT_String &thestrref, int index = 0) const;
456  void getToken(UT_String &thestrref) const;
457  void getLabel(UT_String &thestrref) const;
458  void getHelpText(UT_String &helptext) const;
459  void getHelpUrl(UT_String &helptext) const;
460  void getHelpTitle(UT_String &helptext) const;
461 
462  const char *getToken() const;
463  const char *getLabel() const;
464 
465  const UT_StringRef &
466  getTokenRef() const
467  { return getTemplatePtr()->getTokenRef(); }
468 
469  const UT_StringHolder &
470  getChannelToken(int vi = 0) const
471  { return getTemplatePtr()->getChannelToken(vi); }
472 
473  const UT_StringHolder &
474  getDecodedChannelToken(int vi = 0) const
475  { return getTemplatePtr()->getDecodedChannelToken(vi); }
476 
477  void getChannelLabelForUI(UT_String &thestrref, int vec_idx) const;
478 
479  const PRM_SpareData *getSparePtr() const;
480 
481  unsigned getTokenHash() const;
482 
483  bool hasChannelAlias(int subindex) const ;
484  void getChannelAlias(UT_String &stringref, int subindex) const;
485  const UT_StringHolder &
486  getChannelAlias(int subindex) const;
487 
488  // This performs all the checks to verify that a parameter can be accessed
489  bool canAccess(uint mask) const;
490 
491  // Sets a channel alias.
492  // Do not use this call -- use the OP_Node version to ensure that all
493  // dependencies and symbol tables are updated correctly.
494  bool setChannelAlias(const char *token_alias, int subindex);
495 
496  PRM_ChoiceList *getChoiceListPtr();
497  const PRM_ChoiceList *getChoiceListPtr() const;
498 
499  // Return the group input notify value. It is nil by default, but
500  // can be created by calling createInputNotifyValue.
501  PRM_Value *inputNotifyValue();
502  void createInputNotifyValue();
503 
504  DEP_MicroNode & microNode(int vi);
505  bool hasMicroNodes() const;
506 
507  // A parameter becomes dirty whenever its value is set.
508  int isDirty(int vector_idx=0) const;
509  int areAllFlagsClean() const;
510  void clearAllDirtyFlags();
511 
512  // mySendExtraFlags is a per-component bitfield that has its bit set
513  // if it needs to be dirty propagated.
514  bool isSendExtra(int vi) const;
515  bool hasAnySendExtraFlags() const;
516 
517  int findSubIndex(const char *thechannelname, bool allow_alias) const;
518 
519  const PRM_Template *getTemplatePtr() const;
520  PRM_Template *getTemplatePtr();
521 
522  const PRM_Instance *getInstancePtr() const;
523  PRM_Instance *getInstancePtr();
524 
525  CH_Collection *getChannelGroupPtr() const;
526 
527  unsigned getEnableState(int comp = -1) const;
528  unsigned getInstanceEnableState(int comp = -1) const;
529  int setEnableState(int thestate, int comp = -1);
530 
531  bool getActiveTakeFlag() const;
532  bool getAlwaysTakeFlag() const;
533  void setActiveTakeFlag(int onoff);
534  bool getBypassFlag() const;
535  void setBypassFlag(bool v);
536 
537  bool getVisibleState(int comp = -1) const;
538  bool setVisibleState(bool f, int comp = -1);
539 
540  int getExpressionState();
541  void setExpressionState(int state);
542  int getValueState();
543  void setValueState(int state);
544 
545  // Query whether a parameter dialog should call setValue() to record any
546  // changes made by the user. Note that this does not control whether or
547  // not the field should be disabled.
548  bool isValueEditableByUI(fpreal time, int index) const;
549 
550  // Query whether a parameter dialog should call setExpression() to record
551  // any changes made by the user. Note that this does not control whether
552  // or not the field should be disabled.
553  bool isExpressionEditableByUI(fpreal time, int index) const;
554 
555  // hardenChanges() will create keys if the parm already has channels
556  void hardenChanges(fpreal time, bool forceflag = 0,
557  const char *patt = 0,
558  CH_ChannelRefList *list = 0);
559  void hardenChanges(fpreal time, int index, bool forceflag = 0,
560  const char *patt = 0,
561  CH_ChannelRefList *list = 0);
562  // setKey() will create keys even if the parm has no channels
563  void setKey(fpreal time, int index);
564  void setKey(fpreal time, int index, const char *exp,
565  CH_ExprLanguage language,
566  const char *patt = 0, CH_ChannelRefList *list = 0);
567 
568  void setFullKey(fpreal gtime, int index, CH_FullKey const& key,
569  bool accel_ratios = true);
570 
571  CH_StringMeaning getStringMeaning(fpreal time, int index) const;
572 
573  // If this parm contains an expression this function returns that
574  // expression's language. Otherwise, it returns the language that it
575  // would be if it was turned into an expression.
576  CH_ExprLanguage getExprLanguageIfMadeAnExpression(fpreal time, int index) const;
577 
578  // If there is an expression, this function returns whether the
579  // expression's language for the segment at the given time is the same as
580  // the node's langauge. If there is no expression, this function returns
581  // true.
582  bool languageIsNodesLanguage(fpreal time, int index);
583 
584  int changePending(int index);
585  PRM_ChanState getChanState(fpreal time) const;
586  PRM_ChanState getChanState(fpreal time, int index) const;
587 
588  void save(std::ostream &os, int binary, bool compiled) const;
589  bool load(UT_IStream &is);
590 
591  void saveUndoData(PRM_UndoDataHandle &data) const;
592  bool loadUndoData(const PRM_UndoDataHandle &data);
593 
594  void saveCommand(std::ostream &os, int values=0, int index=-1) const;
595  int loadCommand(int argc, const char *const argv[], int index,
596  bool values_only, PRM_KeySetType set_type);
597 
598  fpreal findNextKey(fpreal theoldtime, int index = -1);
599  fpreal findPrevKey(fpreal theoldtime, int index = -1);
600 
601  int findString(const char *str, bool fullword,
602  bool usewildcards) const;
603  int changeString(const char *from, const char *to, bool fullword);
604 
605  bool notifyVarChange(const char *varname);
606 
607  bool getUndoSavedFlag();
608 
609  // WARNING: the setUndoSavedFlag method should only be called from
610  // OP_Parameters. Calling it from anywhere else can cause undo errors.
611  void setUndoSavedFlag(bool f);
612 
613  bool getAutoTakeUndoSavedFlag();
614 
615  // WARNING: the setAutoTakeUndoSavedFlag method should only be called from
616  // OP_Parameters. Calling it from anywhere else can cause undo errors.
617  void setAutoTakeUndoSavedFlag(bool f);
618 
619  bool getLockedFlag(int vec_idx) const;
620  bool areAllComponentsLocked() const;
621  void setLockedFlag(int vec_idx, bool f);
622  unsigned int getLockedField() const;
623  bool getAutoScopedFlag(int vec_idx) const;
624  void setAutoScopedFlag(int vec_idx, bool f);
625  unsigned int getAutoScopedField() const;
626 
627 
628  bool getMagicString(UT_TokenString &string, fpreal t,
629  int parm_group_mask /*=1*/,
630  bool add_if_default /*= true*/,
631  bool ignore_group /*= false*/,
632  int thread);
633 
634  void destroyChildParms();
635 
637  { return myOwner; }
638 
639  PRM_ParmOwner *getParmOwner() const;
640 
641  // Returns true if this parm is compatible with other_parm. Being
642  // compatible means that the two parms have the same token string,
643  // the same size and are of the same type.
644  bool isCompatible(const PRM_Parm &other_parm) const;
645 
646  // Returns true if the parm is of the basic type check_type, as defined
647  // in PRM_Type.h as basic types.
648  bool isOfBasicType(PRM_Type check_type) const;
649 
650  // Returns true if this parm and other_parm are of the same basic type,
651  // and have equal values (including evaluated expressions), and false
652  // otherwise.
653  bool isParmValueEqual(PRM_Parm &other_parm, int vec_index,
654  fpreal time, int thread) const;
655  bool isParmValueEqual(int vec_index, PRM_Parm &other_parm,
656  int other_index, fpreal time,
657  int thread) const;
658 
659  // Returns true if the channame is the token (or alias) of the channel at
660  // vec_index, and returns false otherwise.
661  // The length of channame can be given in channamelen to spped up rejections
662  // if the caller caches the string length.
663  bool hasChannelName(const UT_StringRef &channame,
664  int vec_index) const;
665 
666  // Returns the aliases of all the channels in this parm in one string
667  // separated by the character sep.
668  void getAllChannelAliases(UT_String &aliasstring,
669  char sep ='/') const;
670 
671  // Methods for accessing and setting the active handle binding flag
672  bool isActive(const int index) const;
673  void setActive(const int index, const bool active);
674 
675  int64 getMemoryUsage(bool inclusive) const;
676 
677  bool isSpareParm() const;
678  void setSpareParm(bool sp) const;
679 
680  const PRM_Instance *getMultiParmOwner() const;
681  void setMultiParmOwner(const PRM_Multi *multiparmowner);
682 
683  /// Returns the multi-parm template for this child parm. Returns nullptr
684  /// if this parm is not part of a multi-parm
685  const PRM_Template *findMultiParmTemplate() const;
686 
687  /// Return the list of instance indicies for this parameter.
688  /// If this parameter is part of a multi-parameter, then its index in the
689  /// multi-parm array will be inserted into the indices array. If the
690  /// multi-parm is nested in other multi-parms, then the indices array will
691  /// have multiple entries (with the outer multi-parm listed first, and the
692  /// inner-most multi-parm last in the array).
693  /// \param indices The list of index instances.
694  /// \param instance_index Each multi-parm can have multiple parameters in
695  /// each instance. If instance_index is true, the instance number will be
696  /// returned. Otherwise the raw offset into the multi-parm will be
697  /// extracted.
698  int getMultiInstanceIndex(UT_IntArray &indices,
699  bool instance_index=true) const;
700 
701  void rebuildParmDependency();
702 
703  bool isRotationParm() const;
704 
705  // For explanations of path vs ch_name, see comment for
706  // constructChannelReference
707  void setChannelReference(fpreal time,
708  int index,
709  const char *path,
710  const char *ch_name=nullptr,
711  bool evaluate=true,
712  bool rmchannel=false);
713 
714  // Construct the string representing reference to the channel given by
715  // path/name from this parameter.
716  // If name == nullptr, path is assumed to be (node path + channel name)
717  // If name not nullptr, path is assumed to be a path without channel name,
718  // name is assumed to be channel name without the path.
719  void constructChannelReference(UT_String &reference,
720  CH_ExprLanguage language,
721  const char *path,
722  const char *ch_name=nullptr);
723 
724  static bool isChanRefString(const char *str, bool is_expr,
725  UT_String *chref = 0);
726 
727  bool getHaveCompiledExpressions() const;
728 
729 
730  // Set a flag to have the label persisted with the parm.
731  // This is used to set a label on multi params
732  void setSaveLabelFlag(bool f);
733 
734  // Custom Channel Color that persists when set.
735  bool hasChannelCustomColor(int index) const;
736  const UT_Color &getChannelCustomColor(int index) const;
737  void setChannelCustomColor(int index, const UT_Color &c);
738  void resetChannelCustomColor(int index);
739 
740  bool getAutoSelectFlag(int vec_idx) const;
741  void setAutoSelectFlag(int vec_idx, bool f);
742  unsigned int getAutoSelectField() const;
743 
744  void setTimeDependentMicroNode(int subindex, bool timedep) const;
745 private:
746  void privateValueChanged(
747  int vec_idx,
748  bool propagate,
749  bool update_multi);
750 
751  static PRM_AddKeyType getAddKeyValue(PRM_AddKeyType add_key);
752 
753 private:
754  PRM_Instance *myInstancePtr;
755  PRM_ParmList *myOwner;
756 
757  static bool myAlwaysHardenFlag;
758  static bool myDestructiveRevertToDefaultFlag;
759  static bool myRevertInvisibleToDefaultsFlag;
760  static bool myMakeSpareParmsForUnknownChannelsFlag;
761 
762  friend class PRM_ParmList;
763 };
764 
765 // UTformat support.
766 PRM_API size_t format(char *buffer, size_t buffer_size, const PRM_Parm &v);
767 
768 #endif
PRM_OverrideType
Definition: PRM_Parm.h:69
PRM_AddKeyType
Definition: PRM_Parm.h:58
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
int int32
Definition: SYS_Types.h:39
const UT_StringRef & getTokenRef() const
Definition: PRM_Parm.h:466
static bool getDestructiveRevertToDefaultFlag()
Definition: PRM_Parm.h:139
CH_ExprLanguage
CH_StringMeaning
GT_API const UT_StringHolder time
static bool getMakeSpareParmsForUnknownChannelsFlag()
Definition: PRM_Parm.h:149
PRM_API size_t format(char *buffer, size_t buffer_size, const PRM_Parm &v)
UT_SharedPtr< PRM_UndoData > PRM_UndoDataHandle
Definition: PRM_Parm.h:114
int getVectorSize() const
Definition: PRM_Parm.h:452
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
UT_Array< std::pair< UT_StringHolder, PRM_UndoDataHandle > > PRM_UndoDataList
Definition: PRM_Parm.h:115
const GLfloat * c
Definition: glew.h:16631
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
GLenum const void GLuint GLint reference
Definition: glew.h:13927
PRM_KeySetType
static void setMakeSpareParmsForUnknownChannelsFlag(bool v)
Definition: PRM_Parm.h:151
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum src
Definition: glcorearb.h:1792
float fpreal32
Definition: SYS_Types.h:200
GLdouble GLdouble t
Definition: glew.h:1403
virtual UT_JSONValueMap * getKeyValueDict() const
Definition: PRM_Parm.h:87
GLuint buffer
Definition: glcorearb.h:659
static bool getRevertInvisibleToDefaultsFlag()
Definition: PRM_Parm.h:144
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
double fpreal64
Definition: SYS_Types.h:201
const UT_StringHolder & getDecodedChannelToken(int vi=0) const
Definition: PRM_Parm.h:474
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:30
std::string OIIO_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
GLint GLuint mask
Definition: glcorearb.h:123
static void setAlwaysHardenFlag(bool o)
Definition: PRM_Parm.h:187
PRM_ChanState
Definition: PRM_ChanState.h:14
const GLdouble * v
Definition: glcorearb.h:836
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
GLsizei GLenum const void * indices
Definition: glcorearb.h:405
GLuint num
Definition: glew.h:2695
void valueChanged(int vec_idx, bool propagate)
Definition: PRM_Parm.h:375
long long int64
Definition: SYS_Types.h:116
GLfloat GLfloat p
Definition: glew.h:16656
PRM_Callback getCallback()
Definition: PRM_Parm.h:382
T exp(const T &v)
Definition: simd.h:7610
const UT_StringHolder & getChannelToken(int vi=0) const
Definition: PRM_Parm.h:470
static void setRevertInvisibleToDefaultsFlag(bool v)
Definition: PRM_Parm.h:146
static bool getAlwaysHardenFlag()
Definition: PRM_Parm.h:186
GLboolean * data
Definition: glcorearb.h:130
**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_TypeExtended
Definition: PRM_Type.h:508
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:785
virtual ~PRM_DataItem()
Definition: PRM_Parm.h:78
PRM_DataType
Definition: PRM_Type.h:112
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GLfloat f
Definition: glcorearb.h:1925
PRM_ParmList * getOwner() const
Definition: PRM_Parm.h:636
virtual ~PRM_UndoData()
Definition: PRM_Parm.h:108
#define PRM_API
Definition: PRM_API.h:10
unsigned int uint
Definition: SYS_Types.h:45
virtual ~PRM_DataFactory()
Definition: PRM_Parm.h:94
static void setDestructiveRevertToDefaultFlag(bool v)
Definition: PRM_Parm.h:141
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
PRM_MultiType
This type enum defines the different types of multi (dynamic) parameters.
Definition: PRM_Type.h:417