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  PRM_Instance *getInstancePtr();
523 
524  CH_Collection *getChannelGroupPtr() const;
525 
526  unsigned getEnableState(int comp = -1) const;
527  unsigned getInstanceEnableState(int comp = -1) const;
528  int setEnableState(int thestate, int comp = -1);
529 
530  bool getActiveTakeFlag() const;
531  bool getAlwaysTakeFlag() const;
532  void setActiveTakeFlag(int onoff);
533  bool getBypassFlag() const;
534  void setBypassFlag(bool v);
535 
536  bool getVisibleState(int comp = -1) const;
537  bool setVisibleState(bool f, int comp = -1);
538 
539  int getExpressionState();
540  void setExpressionState(int state);
541  int getValueState();
542  void setValueState(int state);
543 
544  // Query whether a parameter dialog should call setValue() to record any
545  // changes made by the user. Note that this does not control whether or
546  // not the field should be disabled.
547  bool isValueEditableByUI(fpreal time, int index) const;
548 
549  // Query whether a parameter dialog should call setExpression() to record
550  // any changes made by the user. Note that this does not control whether
551  // or not the field should be disabled.
552  bool isExpressionEditableByUI(fpreal time, int index) const;
553 
554  // hardenChanges() will create keys if the parm already has channels
555  void hardenChanges(fpreal time, bool forceflag = 0,
556  const char *patt = 0,
557  CH_ChannelRefList *list = 0);
558  void hardenChanges(fpreal time, int index, bool forceflag = 0,
559  const char *patt = 0,
560  CH_ChannelRefList *list = 0);
561  // setKey() will create keys even if the parm has no channels
562  void setKey(fpreal time, int index);
563  void setKey(fpreal time, int index, const char *exp,
564  CH_ExprLanguage language,
565  const char *patt = 0, CH_ChannelRefList *list = 0);
566 
567  void setFullKey(fpreal gtime, int index, CH_FullKey const& key,
568  bool accel_ratios = true);
569 
570  CH_StringMeaning getStringMeaning(fpreal time, int index) const;
571 
572  // If this parm contains an expression this function returns that
573  // expression's language. Otherwise, it returns the language that it
574  // would be if it was turned into an expression.
575  CH_ExprLanguage getExprLanguageIfMadeAnExpression(fpreal time, int index) const;
576 
577  // If there is an expression, this function returns whether the
578  // expression's language for the segment at the given time is the same as
579  // the node's langauge. If there is no expression, this function returns
580  // true.
581  bool languageIsNodesLanguage(fpreal time, int index);
582 
583  int changePending(int index);
584  PRM_ChanState getChanState(fpreal time) const;
585  PRM_ChanState getChanState(fpreal time, int index) const;
586 
587  void save(std::ostream &os, int binary, bool compiled) const;
588  bool load(UT_IStream &is);
589 
590  void saveUndoData(PRM_UndoDataHandle &data) const;
591  bool loadUndoData(const PRM_UndoDataHandle &data);
592 
593  void saveCommand(std::ostream &os, int values=0, int index=-1) const;
594  int loadCommand(int argc, const char *const argv[], int index,
595  bool values_only, PRM_KeySetType set_type);
596 
597  fpreal findNextKey(fpreal theoldtime, int index = -1);
598  fpreal findPrevKey(fpreal theoldtime, int index = -1);
599 
600  int findString(const char *str, bool fullword,
601  bool usewildcards) const;
602  int changeString(const char *from, const char *to, bool fullword);
603 
604  bool notifyVarChange(const char *varname);
605 
606  bool getUndoSavedFlag();
607 
608  // WARNING: the setUndoSavedFlag method should only be called from
609  // OP_Parameters. Calling it from anywhere else can cause undo errors.
610  void setUndoSavedFlag(bool f);
611 
612  bool getAutoTakeUndoSavedFlag();
613 
614  // WARNING: the setAutoTakeUndoSavedFlag method should only be called from
615  // OP_Parameters. Calling it from anywhere else can cause undo errors.
616  void setAutoTakeUndoSavedFlag(bool f);
617 
618  bool getLockedFlag(int vec_idx) const;
619  bool areAllComponentsLocked() const;
620  void setLockedFlag(int vec_idx, bool f);
621  unsigned int getLockedField() const;
622  bool getAutoScopedFlag(int vec_idx) const;
623  void setAutoScopedFlag(int vec_idx, bool f);
624  unsigned int getAutoScopedField() const;
625 
626 
627  bool getMagicString(UT_TokenString &string, fpreal t,
628  int parm_group_mask /*=1*/,
629  bool add_if_default /*= true*/,
630  bool ignore_group /*= false*/,
631  int thread);
632 
633  void destroyChildParms();
634 
636  { return myOwner; }
637 
638  PRM_ParmOwner *getParmOwner() const;
639 
640  // Returns true if this parm is compatible with other_parm. Being
641  // compatible means that the two parms have the same token string,
642  // the same size and are of the same type.
643  bool isCompatible(const PRM_Parm &other_parm) const;
644 
645  // Returns true if the parm is of the basic type check_type, as defined
646  // in PRM_Type.h as basic types.
647  bool isOfBasicType(PRM_Type check_type) const;
648 
649  // Returns true if this parm and other_parm are of the same basic type,
650  // and have equal values (including evaluated expressions), and false
651  // otherwise.
652  bool isParmValueEqual(PRM_Parm &other_parm, int vec_index,
653  fpreal time, int thread) const;
654  bool isParmValueEqual(int vec_index, PRM_Parm &other_parm,
655  int other_index, fpreal time,
656  int thread) const;
657 
658  // Returns true if the channame is the token (or alias) of the channel at
659  // vec_index, and returns false otherwise.
660  // The length of channame can be given in channamelen to spped up rejections
661  // if the caller caches the string length.
662  bool hasChannelName(const UT_StringRef &channame,
663  int vec_index) const;
664 
665  // Returns the aliases of all the channels in this parm in one string
666  // separated by the character sep.
667  void getAllChannelAliases(UT_String &aliasstring,
668  char sep ='/') const;
669 
670  // Methods for accessing and setting the active handle binding flag
671  bool isActive(const int index) const;
672  void setActive(const int index, const bool active);
673 
674  int64 getMemoryUsage(bool inclusive) const;
675 
676  bool isSpareParm() const;
677  void setSpareParm(bool sp) const;
678 
679  const PRM_Instance *getMultiParmOwner() const;
680  void setMultiParmOwner(const PRM_Multi *multiparmowner);
681 
682  /// Returns the multi-parm template for this child parm. Returns nullptr
683  /// if this parm is not part of a multi-parm
684  const PRM_Template *findMultiParmTemplate() const;
685 
686  /// Return the list of instance indicies for this parameter.
687  /// If this parameter is part of a multi-parameter, then its index in the
688  /// multi-parm array will be inserted into the indices array. If the
689  /// multi-parm is nested in other multi-parms, then the indices array will
690  /// have multiple entries (with the outer multi-parm listed first, and the
691  /// inner-most multi-parm last in the array).
692  /// \param indices The list of index instances.
693  /// \param instance_index Each multi-parm can have multiple parameters in
694  /// each instance. If instance_index is true, the instance number will be
695  /// returned. Otherwise the raw offset into the multi-parm will be
696  /// extracted.
697  int getMultiInstanceIndex(UT_IntArray &indices,
698  bool instance_index=true) const;
699 
700  void rebuildParmDependency();
701 
702  bool isRotationParm() const;
703 
704  // For explanations of path vs ch_name, see comment for
705  // constructChannelReference
706  void setChannelReference(fpreal time,
707  int index,
708  const char *path,
709  const char *ch_name=nullptr,
710  bool evaluate=true,
711  bool rmchannel=false);
712 
713  // Construct the string representing reference to the channel given by
714  // path/name from this parameter.
715  // If name == nullptr, path is assumed to be (node path + channel name)
716  // If name not nullptr, path is assumed to be a path without channel name,
717  // name is assumed to be channel name without the path.
718  void constructChannelReference(UT_String &reference,
719  CH_ExprLanguage language,
720  const char *path,
721  const char *ch_name=nullptr);
722 
723  static bool isChanRefString(const char *str, bool is_expr,
724  UT_String *chref = 0);
725 
726  bool getHaveCompiledExpressions() const;
727 
728 
729  // Set a flag to have the label persisted with the parm.
730  // This is used to set a label on multi params
731  void setSaveLabelFlag(bool f);
732 
733  // Custom Channel Color that persists when set.
734  bool hasChannelCustomColor(int index) const;
735  const UT_Color &getChannelCustomColor(int index) const;
736  void setChannelCustomColor(int index, const UT_Color &c);
737  void resetChannelCustomColor(int index);
738 
739  bool getAutoSelectFlag(int vec_idx) const;
740  void setAutoSelectFlag(int vec_idx, bool f);
741  unsigned int getAutoSelectField() const;
742 
743  void setTimeDependentMicroNode(int subindex, bool timedep) const;
744 private:
745  void privateValueChanged(
746  int vec_idx,
747  bool propagate,
748  bool update_multi);
749 
750  static PRM_AddKeyType getAddKeyValue(PRM_AddKeyType add_key);
751 
752 private:
753  PRM_Instance *myInstancePtr;
754  PRM_ParmList *myOwner;
755 
756  static bool myAlwaysHardenFlag;
757  static bool myDestructiveRevertToDefaultFlag;
758  static bool myRevertInvisibleToDefaultsFlag;
759  static bool myMakeSpareParmsForUnknownChannelsFlag;
760 
761  friend class PRM_ParmList;
762 };
763 
764 // UTformat support.
765 PRM_API size_t format(char *buffer, size_t buffer_size, const PRM_Parm &v);
766 
767 #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.
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
GLuint const GLchar * name
Definition: glew.h:1814
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
GLuint index
Definition: glew.h:1814
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
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
UT_Array< std::pair< UT_StringHolder, PRM_UndoDataHandle > > PRM_UndoDataList
Definition: PRM_Parm.h:115
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:151
const GLdouble * v
Definition: glew.h:1391
GLenum GLint GLuint mask
Definition: glew.h:1845
float fpreal32
Definition: SYS_Types.h:200
virtual UT_JSONValueMap * getKeyValueDict() const
Definition: PRM_Parm.h:87
static bool getRevertInvisibleToDefaultsFlag()
Definition: PRM_Parm.h:144
double fpreal64
Definition: SYS_Types.h:201
const UT_StringHolder & getDecodedChannelToken(int vi=0) const
Definition: PRM_Parm.h:474
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)
GLuint buffer
Definition: glew.h:1680
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:187
PRM_ChanState
Definition: PRM_ChanState.h:14
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:375
long long int64
Definition: SYS_Types.h:116
PRM_Callback getCallback()
Definition: PRM_Parm.h:382
*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
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
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
GLsizei const GLchar *const * path
Definition: glew.h:6461
GLfloat GLfloat p
Definition: glew.h:16321
PRM_TypeExtended
Definition: PRM_Type.h:506
GLuint num
Definition: glew.h:2690
fpreal64 fpreal
Definition: SYS_Types.h:277
virtual ~PRM_DataItem()
Definition: PRM_Parm.h:78
PRM_DataType
Definition: PRM_Type.h:112
PRM_ParmList * getOwner() const
Definition: PRM_Parm.h:635
GLenum const void GLuint GLint reference
Definition: glew.h:13644
virtual ~PRM_UndoData()
Definition: PRM_Parm.h:108
#define PRM_API
Definition: PRM_API.h:10
GLsizei const GLfloat * value
Definition: glew.h:1849
unsigned int uint
Definition: SYS_Types.h:45
virtual ~PRM_DataFactory()
Definition: PRM_Parm.h:94
GLdouble GLdouble t
Definition: glew.h:1398
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