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 list.
319  // If index equals MultiParmNumItems(), the parm instance is added at the end of the list.
320  void insertMultiParmItem(int index, bool propagate = 1);
321 
322  // Remove Multi Parm Instance at index.
323  void removeMultiParmItem(int index, bool propagate = 1);
324 
325  // Revert Multi Parm Instance at index.
326  void revertMultiParmItem(int index);
327 
328  // Revert all the multi parm instances. This is has different behaviour for
329  // ramps in that it will revert to the initialized state.
330  void revertAllMultiParmItems();
331 
332  // Copy all the Parm Values under the Multi Parm Instance from index 'from' to index 'to'
333  void assignMultiParmItem(int from, int to);
334 
335  // Swap 2 Multi Param instances.
336  // This can be used to move up and down param instances in the list.
337  void swapMultiParmItem(int from, int to);
338 
339  // Returns the number of instance parameters.
340  int getMultiParmNumItems() const;
341 
342  // Returns the number of parameters within an instance parameter.
343  // It returns 1 for array of simple types ( int, float, string ).
344  // It returns the number of parameters within the struct for arrray of structs.
345  int getMultiParmInstancesPerItem() const;
346 
347  // Returns the param token for an instance parm at 'index' and child parm at 'p'
348  const char* getMultiParmToken(int p, int index) const;
349 
350  // Returns the number of UI Parms Entries.
351  // A float3 or color4 will account for a single parameter.
352  // An int, string or float will account for one parm as well.
353  int getMultiParmUIEntries() const;
354 
355  // Returns the PRM_Template ar index 'idx'
356  const PRM_Template *getMultiParmTemplate(int idx) const;
357  PRM_Template *getMultiParmTemplate(int idx);
358 
359  // These functions allow a linear traversal of all multiparm instances
360  // parameters.
361  PRM_Parm *getMultiParm(int idx) const;
362  int getMultiParmCount() const;
363 
364  // The only difference between the next two functions is that the
365  // second send the change notification without question. The first
366  // calls the second, but only if the parm isn't a PRM_CALLBACK. In
367  // those cases we usually don't want to actually send out change
368  // notifications. The notable exception is the opparm -c command.
369  void valueChanged(int vec_idx, bool propagate)
370  { privateValueChanged(vec_idx, propagate,
371  /*update_multi*/true); }
372  void sendValueChanged(int vec_idx, bool propagate);
373  void indirectChange(int vec_idx, bool expr_changed,
374  bool update_multi = true);
375 
376  PRM_Callback getCallback() { return getTemplatePtr()->getCallback(); }
377  int setOverride(int index, int data_idx, const char *source, PRM_OverrideType type);
378  const char *getOverride(int index) const;
379  int getOverrideDataIndex(int index) const;
380  bool getOverrideNodePath(int index, UT_String &path) const;
381  bool getOverrideTrackName(int index, UT_String &trackname) const;
382  bool getOverrideType(int index, PRM_OverrideType &type) const;
383  int setOverrideDisable(int index, int onoff);
384  int getIsOverrideActive(int index) const;
385 
386  /// copyParm() copies the value of an entire parm, including channels. If
387  /// it is a multi-parm, then all instance parameters will be also be
388  /// copied. If the they are a mismatch of vector sizes, the smaller of the
389  /// two sizes will be used.
390  void copyParm(const PRM_Parm &src);
391 
392  /// copyValue copies the value for a particular parm component. If
393  /// current_value_only is true, then only the value evaluated at time t
394  /// will be copied. Otherwise, any channels in the src_parm will be copied
395  /// wholesale.
396  void copyValue(fpreal t, int dest_vi,
397  const PRM_Parm &src_parm, int src_vi,
398  bool set_name_alias,
399  bool current_value_only,
400  bool set_value_to_default = false,
402  PRM_KeySetType key_set_type = PRM_USE_PREFERENCES);
403 
404  void addChannels();
405  void addChannel(int index, bool propagate = true);
406  void addChannel(int index, const char *theexpr,
407  CH_ExprLanguage language, bool propagate = true);
408  int addChannel(const char *name);
409  int addChannel(const char *name, const char *expr,
410  CH_ExprLanguage language);
411 
412  void clearAndDestroyChannels(bool force = false);
413  void removeChannel(int index, bool propagage = true);
414 
415  // Destroy and clear references to those channels not referenced by the
416  // supplied replacement parameter.
417  void clearAndDestroyUnrefChannels(const PRM_Parm &repl_parm);
418 
419  CH_Channel *getChannel(int subindex) const;
420  int getChannelCount() const;
421 
422  void reloadChannelPtrs();
423  int channelPtrModified(const char *name);
424 
425  int isTimeDependent() const;
426  bool isTimeDependent(int subindex) const;
427  int isDataDependent(fpreal gtime) const;
428  bool isDataDependent(fpreal gtime, int subindex) const;
429  void forceTimeDependent(int subindex);
430 
431  bool hasContextOptionDeps(int subindex) const;
432  const DEP_ContextOptionDeps &getContextOptionDeps(int subindex) const;
433  void forceContextOptionDep(int subindex,
434  const UT_StringHolder &opt);
435 
436  const PRM_Type &getType() const;
437  PRM_TypeExtended getTypeExtended() const;
438  PRM_MultiType getMultiType() const;
439  fpreal getMultiSize() const;
440  int getMultiStartOffset() const;
441 
442  bool isRampType() const;
443  bool isRampTypeColor() const;
444 
445  int getVectorSize() const
446  { return getTemplatePtr()->getVectorSize(); }
447  void getChannelToken(UT_String &thestrref, int index = 0) const;
448  void getChannelLabel(UT_String &thestrref, int index = 0) const;
449  void getToken(UT_String &thestrref) const;
450  void getLabel(UT_String &thestrref) const;
451  void getHelpText(UT_String &helptext) const;
452  void getHelpUrl(UT_String &helptext) const;
453  void getHelpTitle(UT_String &helptext) const;
454 
455  const char *getToken() const;
456  const char *getLabel() const;
457 
458  const UT_StringRef &
459  getTokenRef() const
460  { return getTemplatePtr()->getTokenRef(); }
461 
462  const UT_StringHolder &
463  getChannelToken(int vi = 0) const
464  { return getTemplatePtr()->getChannelToken(vi); }
465 
466  void getChannelLabelForUI(UT_String &thestrref, int vec_idx) const;
467 
468  const PRM_SpareData *getSparePtr() const;
469 
470  unsigned getTokenHash() const;
471 
472  bool hasChannelAlias(int subindex) const ;
473  void getChannelAlias(UT_String &stringref, int subindex) const;
474  const UT_StringHolder &
475  getChannelAlias(int subindex) const;
476 
477  // This performs all the checks to verify that a parameter can be accessed
478  bool canAccess(uint mask) const;
479 
480  // Sets a channel alias.
481  // Do not use this call -- use the OP_Node version to ensure that all
482  // dependencies and symbol tables are updated correctly.
483  bool setChannelAlias(const char *token_alias, int subindex);
484 
485  PRM_ChoiceList *getChoiceListPtr();
486  const PRM_ChoiceList *getChoiceListPtr() const;
487 
488  // Return the group input notify value. It is nil by default, but
489  // can be created by calling createInputNotifyValue.
490  PRM_Value *inputNotifyValue();
491  void createInputNotifyValue();
492 
493  DEP_MicroNode & microNode(int vi);
494  bool hasMicroNodes() const;
495 
496  // A parameter becomes dirty whenever its value is set.
497  int isDirty(int vector_idx=0) const;
498  int areAllFlagsClean() const;
499  void clearAllDirtyFlags();
500 
501  // mySendExtraFlags is a per-component bitfield that has its bit set
502  // if it needs to be dirty propagated.
503  bool isSendExtra(int vi) const;
504  bool hasAnySendExtraFlags() const;
505 
506  int findSubIndex(const char *thechannelname, bool allow_alias) const;
507 
508  const PRM_Template *getTemplatePtr() const;
509  PRM_Template *getTemplatePtr();
510 
511  PRM_Instance *getInstancePtr();
512 
513  CH_Collection *getChannelGroupPtr() const;
514 
515  unsigned getEnableState(int comp = -1) const;
516  unsigned getInstanceEnableState(int comp = -1) const;
517  int setEnableState(int thestate, int comp = -1);
518 
519  bool getActiveTakeFlag() const;
520  bool getAlwaysTakeFlag() const;
521  void setActiveTakeFlag(int onoff);
522  bool getBypassFlag() const;
523  void setBypassFlag(bool v);
524 
525  bool getVisibleState(int comp = -1) const;
526  bool setVisibleState(bool f, int comp = -1);
527 
528  int getExpressionState();
529  void setExpressionState(int state);
530  int getValueState();
531  void setValueState(int state);
532 
533  // Query whether a parameter dialog should call setValue() to record any
534  // changes made by the user. Note that this does not control whether or
535  // not the field should be disabled.
536  bool isValueEditableByUI(fpreal time, int index) const;
537 
538  // Query whether a parameter dialog should call setExpression() to record
539  // any changes made by the user. Note that this does not control whether
540  // or not the field should be disabled.
541  bool isExpressionEditableByUI(fpreal time, int index) const;
542 
543  // hardenChanges() will create keys if the parm already has channels
544  void hardenChanges(fpreal time, bool forceflag = 0,
545  const char *patt = 0,
546  CH_ChannelRefList *list = 0);
547  void hardenChanges(fpreal time, int index, bool forceflag = 0,
548  const char *patt = 0,
549  CH_ChannelRefList *list = 0);
550  // setKey() will create keys even if the parm has no channels
551  void setKey(fpreal time, int index);
552  void setKey(fpreal time, int index, const char *exp,
553  CH_ExprLanguage language,
554  const char *patt = 0, CH_ChannelRefList *list = 0);
555 
556  void setFullKey(fpreal gtime, int index, CH_FullKey const& key,
557  bool accel_ratios = true);
558 
559  CH_StringMeaning getStringMeaning(fpreal time, int index) const;
560 
561  // If this parm contains an expression this function returns that
562  // expression's language. Otherwise, it returns the language that it
563  // would be if it was turned into an expression.
564  CH_ExprLanguage getExprLanguageIfMadeAnExpression(fpreal time, int index) const;
565 
566  // If there is an expression, this function returns whether the
567  // expression's language for the segment at the given time is the same as
568  // the node's langauge. If there is no expression, this function returns
569  // true.
570  bool languageIsNodesLanguage(fpreal time, int index);
571 
572  int changePending(int index);
573  PRM_ChanState getChanState(fpreal time) const;
574  PRM_ChanState getChanState(fpreal time, int index) const;
575 
576  void save(std::ostream &os, int binary, bool compiled) const;
577  bool load(UT_IStream &is);
578 
579  void saveUndoData(PRM_UndoDataHandle &data) const;
580  bool loadUndoData(const PRM_UndoDataHandle &data);
581 
582  void saveCommand(std::ostream &os, int values=0, int index=-1) const;
583  int loadCommand(int argc, const char *const argv[], int index,
584  bool values_only, PRM_KeySetType set_type);
585 
586  fpreal findNextKey(fpreal theoldtime, int index = -1);
587  fpreal findPrevKey(fpreal theoldtime, int index = -1);
588 
589  int findString(const char *str, bool fullword,
590  bool usewildcards) const;
591  int changeString(const char *from, const char *to, bool fullword);
592 
593  bool notifyVarChange(const char *varname);
594 
595  bool getUndoSavedFlag();
596 
597  // WARNING: the setUndoSavedFlag method should only be called from
598  // OP_Parameters. Calling it from anywhere else can cause undo errors.
599  void setUndoSavedFlag(bool f);
600 
601  bool getAutoTakeUndoSavedFlag();
602 
603  // WARNING: the setAutoTakeUndoSavedFlag method should only be called from
604  // OP_Parameters. Calling it from anywhere else can cause undo errors.
605  void setAutoTakeUndoSavedFlag(bool f);
606 
607  bool getLockedFlag(int vec_idx) const;
608  bool areAllComponentsLocked() const;
609  void setLockedFlag(int vec_idx, bool f);
610  unsigned int getLockedField() const;
611  bool getAutoScopedFlag(int vec_idx) const;
612  void setAutoScopedFlag(int vec_idx, bool f);
613  unsigned int getAutoScopedField() const;
614 
615 
616  bool getMagicString(UT_TokenString &string, fpreal t,
617  int parm_group_mask /*=1*/,
618  bool add_if_default /*= true*/,
619  bool ignore_group /*= false*/,
620  int thread);
621 
622  void destroyChildParms();
623 
625  { return myOwner; }
626 
627  PRM_ParmOwner *getParmOwner() const;
628 
629  // Returns true if this parm is compatible with other_parm. Being
630  // compatible means that the two parms have the same token string,
631  // the same size and are of the same type.
632  bool isCompatible(const PRM_Parm &other_parm) const;
633 
634  // Returns true if the parm is of the basic type check_type, as defined
635  // in PRM_Type.h as basic types.
636  bool isOfBasicType(PRM_Type check_type) const;
637 
638  // Returns true if this parm and other_parm are of the same basic type,
639  // and have equal values (including evaluated expressions), and false
640  // otherwise.
641  bool isParmValueEqual(PRM_Parm &other_parm, int vec_index,
642  fpreal time, int thread) const;
643  bool isParmValueEqual(int vec_index, PRM_Parm &other_parm,
644  int other_index, fpreal time,
645  int thread) const;
646 
647  // Returns true if the channame is the token (or alias) of the channel at
648  // vec_index, and returns false otherwise.
649  // The length of channame can be given in channamelen to spped up rejections
650  // if the caller caches the string length.
651  bool hasChannelName(const UT_StringRef &channame,
652  int vec_index) const;
653 
654  // Returns the aliases of all the channels in this parm in one string
655  // separated by the character sep.
656  void getAllChannelAliases(UT_String &aliasstring,
657  char sep ='/') const;
658 
659  // Methods for accessing and setting the active handle binding flag
660  bool isActive(const int index) const;
661  void setActive(const int index, const bool active);
662 
663  int64 getMemoryUsage(bool inclusive) const;
664 
665  bool isSpareParm() const;
666  void setSpareParm(bool sp) const;
667 
668  const PRM_Instance *getMultiParmOwner() const;
669  void setMultiParmOwner(const PRM_Multi *multiparmowner);
670 
671  /// Return the list of instance indicies for this parameter.
672  /// If this parameter is part of a multi-parameter, then its index in the
673  /// multi-parm array will be inserted into the indices array. If the
674  /// multi-parm is nested in other multi-parms, then the indices array will
675  /// have multiple entries (with the outer multi-parm listed first, and the
676  /// inner-most multi-parm last in the array).
677  /// \param indices The list of index instances.
678  /// \param instance_index Each multi-parm can have multiple parameters in
679  /// each instance. If instance_index is true, the instance number will be
680  /// returned. Otherwise the raw offset into the multi-parm will be
681  /// extracted.
682  int getMultiInstanceIndex(UT_IntArray &indices,
683  bool instance_index=true) const;
684 
685  void rebuildParmDependency();
686 
687  bool isRotationParm() const;
688 
689  // For explanations of path vs ch_name, see comment for
690  // constructChannelReference
691  void setChannelReference(fpreal time,
692  int index,
693  const char *path,
694  const char *ch_name=nullptr,
695  bool evaluate=true,
696  bool rmchannel=false);
697 
698  // Construct the string representing reference to the channel given by
699  // path/name from this parameter.
700  // If name == nullptr, path is assumed to be (node path + channel name)
701  // If name not nullptr, path is assumed to be a path without channel name,
702  // name is assumed to be channel name without the path.
703  void constructChannelReference(UT_String &reference,
704  CH_ExprLanguage language,
705  const char *path,
706  const char *ch_name=nullptr);
707 
708  static bool isChanRefString(const char *str, bool is_expr,
709  UT_String *chref = 0);
710 
711  bool getHaveCompiledExpressions() const;
712 
713 
714  // Set a flag to have the label persisted with the parm.
715  // This is used to set a label on multi params
716  void setSaveLabelFlag(bool f);
717 
718  // Custom Channel Color that persists when set.
719  bool hasChannelCustomColor(int index) const;
720  const UT_Color &getChannelCustomColor(int index) const;
721  void setChannelCustomColor(int index, const UT_Color &c);
722  void resetChannelCustomColor(int index);
723 
724  bool getAutoSelectFlag(int vec_idx) const;
725  void setAutoSelectFlag(int vec_idx, bool f);
726  unsigned int getAutoSelectField() const;
727 private:
728  void privateValueChanged(
729  int vec_idx,
730  bool propagate,
731  bool update_multi);
732 
733  static PRM_AddKeyType getAddKeyValue(PRM_AddKeyType add_key);
734 
735 private:
736  PRM_Instance *myInstancePtr;
737  PRM_ParmList *myOwner;
738 
739  static bool myAlwaysHardenFlag;
740  static bool myDestructiveRevertToDefaultFlag;
741  static bool myRevertInvisibleToDefaultsFlag;
742  static bool myMakeSpareParmsForUnknownChannelsFlag;
743 
744  friend class PRM_ParmList;
745 };
746 
747 #endif
PRM_OverrideType
Definition: PRM_Parm.h:68
PRM_AddKeyType
Definition: PRM_Parm.h:57
GLsizei GLenum const void * indices
Definition: glcorearb.h:405
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
const UT_StringRef & getTokenRef() const
Definition: PRM_Parm.h:459
static bool getDestructiveRevertToDefaultFlag()
Definition: PRM_Parm.h:138
CH_ExprLanguage
CH_StringMeaning
GT_API const UT_StringHolder time
static bool getMakeSpareParmsForUnknownChannelsFlag()
Definition: PRM_Parm.h:148
const GLdouble * v
Definition: glcorearb.h:836
UT_SharedPtr< PRM_UndoData > PRM_UndoDataHandle
Definition: PRM_Parm.h:113
int getVectorSize() const
Definition: PRM_Parm.h:445
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:114
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
PRM_KeySetType
GLint GLuint mask
Definition: glcorearb.h:123
static void setMakeSpareParmsForUnknownChannelsFlag(bool v)
Definition: PRM_Parm.h:150
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:107
GLfloat f
Definition: glcorearb.h:1925
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
static void setAlwaysHardenFlag(bool o)
Definition: PRM_Parm.h:186
PRM_ChanState
Definition: PRM_ChanState.h:14
double fpreal64
Definition: SYS_Types.h:192
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
SYS_API double exp(double x)
Definition: SYS_FPUMath.h:97
void valueChanged(int vec_idx, bool propagate)
Definition: PRM_Parm.h:369
PRM_Callback getCallback()
Definition: PRM_Parm.h:376
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
int int32
Definition: SYS_Types.h:35
const UT_StringHolder & getChannelToken(int vi=0) const
Definition: PRM_Parm.h:463
static void setRevertInvisibleToDefaultsFlag(bool v)
Definition: PRM_Parm.h:145
unsigned int uint
Definition: SYS_Types.h:40
static bool getAlwaysHardenFlag()
Definition: PRM_Parm.h:185
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
PRM_TypeExtended
Definition: PRM_Type.h:506
GLuint index
Definition: glcorearb.h:785
virtual ~PRM_DataItem()
Definition: PRM_Parm.h:77
PRM_DataType
Definition: PRM_Type.h:112
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
PRM_ParmList * getOwner() const
Definition: PRM_Parm.h:624
png_infop png_uint_32 int num
Definition: png.h:2158
virtual ~PRM_UndoData()
Definition: PRM_Parm.h:107
#define PRM_API
Definition: PRM_API.h:10
virtual ~PRM_DataFactory()
Definition: PRM_Parm.h:93
float fpreal32
Definition: SYS_Types.h:191
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
GLenum src
Definition: glcorearb.h:1792