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