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