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  /// Loads a type:data string, the type determines which datafactory
105  /// which then calls parseAscii(type, is);
106  static PRM_DataItemHandle loadTypedAscii(UT_IStream &is);
107  /// Saves type:data. Empty data doesn't write anything.
108  static void saveTypedAscii(PRM_DataItemHandle item, std::ostream &os);
109 };
110 
112 {
113 public:
114  virtual ~PRM_UndoData() {}
115 
116  virtual const char *getDataType() const = 0;
117  virtual int64 getMemoryUsage() const = 0;
118 };
119 
122 
123 class PRM_API PRM_Parm : public UT_SmallObject<PRM_Parm,
124  UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
125  UT_SMALLOBJECT_PAGESIZE_DEFAULT,
126  UT_SMALLOBJECT_THREADSAFE_OFF>
127 {
128 public:
129  // for these constructors, a nil CH_Collection is invalid
130  // only PRM_ParmList handles a nil correctly
131  PRM_Parm(PRM_Template *thetemplate,
132  PRM_ParmList *owner);
133  PRM_Parm(PRM_Parm *theprm,
134  PRM_ParmList *owner);
135  ~PRM_Parm();
136 
137  void adopt(PRM_Parm &thesrcparm);
138  void adoptOverrides(PRM_Parm &srcparm);
139 
140  void revertToDefaults(fpreal time);
141  void revertToDefault(fpreal time, int index, bool propagate=true);
142  void restoreFactoryDefaults();
143  void restoreFactoryDefault(int index);
144 
146  { return myDestructiveRevertToDefaultFlag; }
148  { myDestructiveRevertToDefaultFlag = v; }
149 
151  { return myRevertInvisibleToDefaultsFlag; }
153  { myRevertInvisibleToDefaultsFlag = v; }
154 
156  { return myMakeSpareParmsForUnknownChannelsFlag; }
158  { myMakeSpareParmsForUnknownChannelsFlag = v; }
159 
160  // Static functions to access PRM_Instance subclass static functions.
161  static bool isStringThatCanExpand(const char *str);
162  static bool isOrdinalExpression(const char *str,
163  const PRM_Template *tplate = nullptr);
164  static bool isOrdinalExpression(const PRM_Default &dflt,
165  const PRM_Template *tplate = nullptr);
166 
167  // Static functions to convert string parm values to and from
168  // expressions.
169  static void convertStringToExprLanguage(const char *str,
170  UT_String &expr,
171  PRM_Template *tplate = nullptr);
172  static void convertStringFromExprLanguage(const char *str,
173  UT_String &expr);
174 
175  // Static functions to access PRM_Multi static functions.
176  static bool getIsAddingOrRemovingMultiParms();
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  /// @{ Sets the new value of the parameter.
266  /// @return @c true if the value was set; false otherwise (eg, parm locked).
267  /// @note
268  /// These methods don't save the old value ont the undo stack.
269  /// For that, use OP_Parameters::setString(), or alternatively
270  /// explicitly call UTaddToUndoBlock(OP_UndoParm()) yourself.
271  bool setValue(fpreal time, const char *value,
272  CH_StringMeaning meaning,
273  bool kill_expr = false, int index = 0,
275  bool propagate = true);
276 
277  bool setValue(fpreal time, fpreal value,
278  bool kill_expr = false, int index = 0,
280  bool propagate = true);
281 
282  bool setValue(fpreal time, int32 value,
283  bool kill_expr = false, int index = 0,
285  bool propagate = true);
286 
287  bool setValue(fpreal time, int64 value,
288  bool kill_expr = false, int index = 0,
290  bool propagate = true);
291 
292  bool setValue(fpreal time, const PRM_DataItemHandle &value,
293  bool kill_expr = false, int index = 0,
295  bool propagate = true);
296  /// @}
297 
298  //
299  // The setValues methods set all entries in the vector at once...
300  // returns true if the values were set, of false otherwise (eg, parm locked)
301  //
302  bool setValues(fpreal time, const fpreal32 *values,
303  bool kill_expr = false,
305  bool propagate = true);
306  bool setValues(fpreal time, const fpreal64 *values,
307  bool kill_expr = false,
309  bool propagate = true);
310  bool setValues(fpreal time, const int32 *values,
311  bool kill_expr = false,
313  bool propagate = true);
314 
315  bool setValues(fpreal time, const int64 *values,
316  bool kill_expr = false,
318  bool propagate = true);
319 
320  //
321  // Multi Parms methods.
322  //
323 
324  // Returns true if the parm is a multi parm
325  bool isMultiParm() const;
326 
327  // Insert a new Multi Parm Instance before index.
328  // If index equals zero, the parm instance can be added at the start of the
329  // list.
330  // If index equals MultiParmNumItems(), the parm instance is added at the
331  // end of the list.
332  void insertMultiParmItem(int index, bool propagate = 1);
333 
334  // Remove Multi Parm Instance at index.
335  void removeMultiParmItem(int index, bool propagate = 1);
336 
337  // Revert Multi Parm Instance at index.
338  void revertMultiParmItem(int index);
339 
340  // Revert all the multi parm instances. This is has different behaviour for
341  // ramps in that it will revert to the initialized state.
342  void revertAllMultiParmItems();
343 
344  // Copy all the Parm Values under the Multi Parm Instance from index 'from'
345  // to index 'to'.
346  void assignMultiParmItem(int from, int to);
347 
348  // Swap 2 Multi Parm instances.
349  // This can be used to move up and down param instances in the list.
350  void swapMultiParmItem(int from, int to);
351 
352  // Move Multi Parm instances give a list of move operations.
353  // @moves is an array of from and to pair<int,int> representing the move
354  // operations to perform.
355  void moveMultiParmItems(
356  const UT_Array<std::pair<int,int>> &moves);
357 
358  // Returns the number of instance parameters.
359  int getMultiParmNumItems() const;
360 
361  // Returns the number of parameters within an instance parameter.
362  // It returns 1 for array of simple types ( int, float, string ).
363  // It returns the number of parameters within the struct for array of
364  // structs.
365  int getMultiParmInstancesPerItem() const;
366 
367  // Returns the param token for an instance parm at 'index' and child parm
368  // at 'p'.
369  const char* getMultiParmToken(int p, int index) const;
370 
371  // Returns the number of UI Parms Entries.
372  // A float3 or color4 will account for a single parameter.
373  // An int, string or float will account for one parm as well.
374  int getMultiParmUIEntries() const;
375 
376  // Returns the PRM_Template at index 'idx'
377  const PRM_Template *getMultiParmTemplate(int idx) const;
378  PRM_Template *getMultiParmTemplate(int idx);
379 
380  // These functions allow a linear traversal of all multiparm instance
381  // parameters.
382  PRM_Parm *getMultiParm(int idx) const;
383  int getMultiParmCount() const;
384 
385  // The only difference between the next two functions is that the
386  // second sends the change notification without question. The first
387  // calls the second, but only if the parm isn't a PRM_CALLBACK. In
388  // those cases we usually don't want to actually send out change
389  // notifications. The notable exception is the opparm -c command.
390  void valueChanged(int vec_idx, bool propagate)
391  { privateValueChanged(vec_idx, propagate,
392  /*update_multi*/true); }
393  void sendValueChanged(int vec_idx, bool propagate);
394  void indirectChange(int vec_idx, bool expr_changed,
395  bool update_multi = true);
396 
397  PRM_Callback getCallback() { return getTemplatePtr()->getCallback(); }
398  int setOverride(int index, int data_idx, const char *source,
400  const char *getOverride(int index) const;
401  int getOverrideDataIndex(int index) const;
402  bool getOverrideNodePath(int index, UT_String &path) const;
403  bool getOverrideTrackName(int index, UT_String &trackname) const;
404  bool getOverrideType(int index, PRM_OverrideType &type) const;
405  int setOverrideDisable(int index, int onoff);
406  int getIsOverrideActive(int index) const;
407 
408  /// copyParm() copies the value of an entire parm, including channels. If
409  /// it is a multi-parm, then all instance parameters will be also be
410  /// copied. If the they are a mismatch of vector sizes, the smaller of the
411  /// two sizes will be used.
412  void copyParm(const PRM_Parm &src);
413 
414  /// copyValue copies the value for a particular parm component. If
415  /// current_value_only is true, then only the value evaluated at time t
416  /// will be copied. Otherwise, any channels in the src_parm will be copied
417  /// wholesale.
418  void copyValue(fpreal t, int dest_vi,
419  const PRM_Parm &src_parm, int src_vi,
420  bool set_name_alias,
421  bool current_value_only,
422  bool set_value_to_default = false,
424  PRM_KeySetType key_set_type = PRM_USE_PREFERENCES);
425 
426  void addChannels();
427  void addChannel(int index, bool propagate = true);
428  void addChannel(int index, const char *theexpr,
429  CH_ExprLanguage language, bool propagate = true);
430  int addChannel(const char *name);
431  int addChannel(const char *name, const char *expr,
432  CH_ExprLanguage language);
433 
434  void clearAndDestroyChannels(bool force = false);
435  void removeChannel(int index, bool propagage = true);
436 
437  // Destroy and clear references to those channels not referenced by the
438  // supplied replacement parameter.
439  void clearAndDestroyUnrefChannels(const PRM_Parm &repl_parm);
440 
441  CH_Channel *getChannel(int subindex) const;
442  int getChannelCount() const;
443 
444  void reloadChannelPtrs();
445  int channelPtrModified(const char *name);
446 
447  int isTimeDependent() const;
448  bool isTimeDependent(int subindex) const;
449  int isDataDependent(fpreal gtime) const;
450  bool isDataDependent(fpreal gtime, int subindex) const;
451  void forceTimeDependent(int subindex);
452 
453  bool hasContextOptionDeps(int subindex) const;
454  const DEP_ContextOptionDeps &getContextOptionDeps(int subindex) const;
455  void forceContextOptionDep(int subindex,
456  const UT_StringHolder &opt);
457 
458  const PRM_Type &getType() const;
459  PRM_TypeExtended getTypeExtended() const;
460  PRM_MultiType getMultiType() const;
461  fpreal getMultiSize() const;
462  int getMultiStartOffset() const;
463 
464  bool isRampType() const;
465  bool isRampTypeColor() const;
466 
467  int getVectorSize() const
468  { return getTemplatePtr()->getVectorSize(); }
469  void getChannelToken(UT_String &thestrref, int index = 0) const;
470  void getChannelLabel(UT_String &thestrref, int index = 0) const;
471  void getToken(UT_String &thestrref) const;
472  void getLabel(UT_String &thestrref) const;
473  void getHelpText(UT_String &helptext) const;
474  void getHelpUrl(UT_String &helptext) const;
475  void getHelpTitle(UT_String &helptext) const;
476 
477  const char *getToken() const;
478  const char *getLabel() const;
479 
480  const UT_StringRef &
481  getTokenRef() const
482  { return getTemplatePtr()->getTokenRef(); }
483 
484  const UT_StringHolder &
485  getChannelToken(int vi = 0) const
486  { return getTemplatePtr()->getChannelToken(vi); }
487 
488  const UT_StringHolder &
489  getDecodedChannelToken(int vi = 0) const
490  { return getTemplatePtr()->getDecodedChannelToken(vi); }
491 
492  void getChannelLabelForUI(UT_String &thestrref, int vec_idx) const;
493 
494  const PRM_SpareData *getSparePtr() const;
495 
496  unsigned getTokenHash() const;
497 
498  bool hasChannelAlias(int subindex) const ;
499  void getChannelAlias(UT_String &stringref, int subindex) const;
500  const UT_StringHolder &
501  getChannelAlias(int subindex) const;
502 
503  // This performs all the checks to verify that a parameter can be accessed
504  bool canAccess(uint mask) const;
505 
506  // Sets a channel alias.
507  // Do not use this call -- use the OP_Node version to ensure that all
508  // dependencies and symbol tables are updated correctly.
509  bool setChannelAlias(const char *token_alias, int subindex);
510 
511  PRM_ChoiceList *getChoiceListPtr();
512  const PRM_ChoiceList *getChoiceListPtr() const;
513 
514  // Return the group input notify value. It is nil by default, but
515  // can be created by calling createInputNotifyValue.
516  PRM_Value *inputNotifyValue();
517  void createInputNotifyValue();
518 
519  DEP_MicroNode & microNode(int vi);
520  bool hasMicroNodes() const;
521 
522  // A parameter becomes dirty whenever its value is set.
523  int isDirty(int vector_idx=0) const;
524  int areAllFlagsClean() const;
525  void clearAllDirtyFlags();
526 
527  // mySendExtraFlags is a per-component bitfield that has its bit set
528  // if it needs to be dirty propagated.
529  bool isSendExtra(int vi) const;
530  bool hasAnySendExtraFlags() const;
531 
532  int findSubIndex(const char *thechannelname, bool allow_alias) const;
533 
534  const PRM_Template *getTemplatePtr() const;
535  PRM_Template *getTemplatePtr();
536 
537  const PRM_Instance *getInstancePtr() const;
538  PRM_Instance *getInstancePtr();
539 
540  CH_Collection *getChannelGroupPtr() const;
541 
542  unsigned getEnableState(int comp = -1) const;
543  unsigned getInstanceEnableState(int comp = -1) const;
544  int setEnableState(int thestate, int comp = -1);
545 
546  bool getActiveTakeFlag() const;
547  bool getAlwaysTakeFlag() const;
548  void setActiveTakeFlag(int onoff);
549  bool getBypassFlag() const;
550  void setBypassFlag(bool v);
551 
552  bool getVisibleState(int comp = -1) const;
553  bool setVisibleState(bool f, int comp = -1);
554 
555  int getExpressionState();
556  void setExpressionState(int state);
557  int getValueState();
558  void setValueState(int state);
559 
560  // Query whether a parameter dialog should call setValue() to record any
561  // changes made by the user. Note that this does not control whether or
562  // not the field should be disabled.
563  bool isValueEditableByUI(fpreal time, int index) const;
564 
565  // Query whether a parameter dialog should call setExpression() to record
566  // any changes made by the user. Note that this does not control whether
567  // or not the field should be disabled.
568  bool isExpressionEditableByUI(fpreal time, int index) const;
569 
570  // hardenChanges() will create keys if the parm already has channels
571  void hardenChanges(fpreal time, bool forceflag = 0,
572  const char *patt = 0,
573  CH_ChannelRefList *list = 0);
574  void hardenChanges(fpreal time, int index, bool forceflag = 0,
575  const char *patt = 0,
576  CH_ChannelRefList *list = 0);
577  // setKey() will create keys even if the parm has no channels
578  void setKey(fpreal time, int index);
579  void setKey(fpreal time, int index, const char *exp,
580  CH_ExprLanguage language,
581  const char *patt = 0, CH_ChannelRefList *list = 0);
582 
583  void setFullKey(fpreal gtime, int index, CH_FullKey const& key,
584  bool accel_ratios = true);
585 
586  CH_StringMeaning getStringMeaning(fpreal time, int index) const;
587 
588  // If this parm contains an expression this function returns that
589  // expression's language. Otherwise, it returns the language that it
590  // would be if it was turned into an expression.
591  CH_ExprLanguage getExprLanguageIfMadeAnExpression(fpreal time, int index) const;
592 
593  // If there is an expression, this function returns whether the
594  // expression's language for the segment at the given time is old Expr.
595  // If there is no expression, this function returns true.
596  bool isLanguageOldExprOrLiteral(fpreal time, int index);
597 
598  int changePending(int index);
599  PRM_ChanState getChanState(fpreal time) const;
600  PRM_ChanState getChanState(fpreal time, int index) const;
601 
602  void save(std::ostream &os, int binary, bool compiled) const;
603  bool load(UT_IStream &is);
604 
605  void saveUndoData(PRM_UndoDataHandle &data) const;
606  bool loadUndoData(const PRM_UndoDataHandle &data);
607 
608  void saveCommand(std::ostream &os, int values=0, int index=-1) const;
609  int loadCommand(int argc, const char *const argv[], int index,
610  bool values_only, PRM_KeySetType set_type);
611 
612  fpreal findNextKey(fpreal theoldtime, int index = -1);
613  fpreal findPrevKey(fpreal theoldtime, int index = -1);
614 
615  int findString(const char *str, bool fullword,
616  bool usewildcards) const;
617  int changeString(const char *from, const char *to, bool fullword);
618 
619  bool notifyVarChange(const char *varname);
620 
621  bool getUndoSavedFlag();
622 
623  // WARNING: the setUndoSavedFlag method should only be called from
624  // OP_Parameters. Calling it from anywhere else can cause undo errors.
625  void setUndoSavedFlag(bool f);
626 
627  bool getAutoTakeUndoSavedFlag();
628 
629  // WARNING: the setAutoTakeUndoSavedFlag method should only be called from
630  // OP_Parameters. Calling it from anywhere else can cause undo errors.
631  void setAutoTakeUndoSavedFlag(bool f);
632 
633  bool getLockedFlag(int vec_idx) const;
634  bool areAllComponentsLocked() const;
635  void setLockedFlag(int vec_idx, bool f);
636  unsigned int getLockedField() const;
637  bool getAutoScopedFlag(int vec_idx) const;
638  void setAutoScopedFlag(int vec_idx, bool f);
639  unsigned int getAutoScopedField() const;
640 
641 
642  bool getMagicString(UT_TokenString &string, fpreal t,
643  int parm_group_mask /*=1*/,
644  bool add_if_default /*= true*/,
645  bool ignore_group /*= false*/,
646  int thread);
647 
648  void destroyChildParms();
649 
651  { return myOwner; }
652 
653  PRM_ParmOwner *getParmOwner() const;
654 
655  // Returns true if this parm is compatible with other_parm. Being
656  // compatible means that the two parms have the same token string,
657  // the same size and are of the same type.
658  bool isCompatible(const PRM_Parm &other_parm) const;
659 
660  // Returns true if the parm is of the basic type check_type, as defined
661  // in PRM_Type.h as basic types.
662  bool isOfBasicType(PRM_Type check_type) const;
663 
664  // Returns true if this parm and other_parm are of the same basic type,
665  // and have equal values (including evaluated expressions), and false
666  // otherwise.
667  bool isParmValueEqual(PRM_Parm &other_parm, int vec_index,
668  fpreal time, int thread) const;
669  bool isParmValueEqual(int vec_index, PRM_Parm &other_parm,
670  int other_index, fpreal time,
671  int thread) const;
672 
673  // Returns true if the channame is the token (or alias) of the channel at
674  // vec_index, and returns false otherwise.
675  // The length of channame can be given in channamelen to spped up rejections
676  // if the caller caches the string length.
677  bool hasChannelName(const UT_StringRef &channame,
678  int vec_index) const;
679 
680  // Returns the aliases of all the channels in this parm in one string
681  // separated by the character sep.
682  void getAllChannelAliases(UT_String &aliasstring,
683  char sep ='/') const;
684 
685  // Methods for accessing and setting the active handle binding flag
686  bool isActive(const int index) const;
687  void setActive(const int index, const bool active);
688 
689  int64 getMemoryUsage(bool inclusive) const;
690 
691  bool isSpareParm() const;
692  void setSpareParm(bool sp) const;
693 
694  const PRM_Instance *getMultiParmOwner() const;
695  void setMultiParmOwner(const PRM_Multi *multiparmowner);
696 
697  /// Returns the multi-parm template for this child parm. Returns nullptr
698  /// if this parm is not part of a multi-parm
699  const PRM_Template *findMultiParmTemplate() const;
700 
701  /// Return the list of instance indicies for this parameter.
702  /// If this parameter is part of a multi-parameter, then its index in the
703  /// multi-parm array will be inserted into the indices array. If the
704  /// multi-parm is nested in other multi-parms, then the indices array will
705  /// have multiple entries (with the outer multi-parm listed first, and the
706  /// inner-most multi-parm last in the array).
707  /// \param indices The list of index instances.
708  /// \param instance_index Each multi-parm can have multiple parameters in
709  /// each instance. If instance_index is true, the instance number will be
710  /// returned. Otherwise the raw offset into the multi-parm will be
711  /// extracted.
712  int getMultiInstanceIndex(UT_IntArray &indices,
713  bool instance_index=true) const;
714 
715  void rebuildParmDependency();
716 
717  bool isRotationParm() const;
718 
719  // For explanations of path vs ch_name, see comment for
720  // constructChannelReference
721  void setChannelReference(fpreal time,
722  int index,
723  const char *path,
724  const char *ch_name=nullptr,
725  bool evaluate=true,
726  bool rmchannel=false);
727 
728  // Construct the string representing reference to the channel given by
729  // path/name from this parameter.
730  // If name == nullptr, path is assumed to be (node path + channel name)
731  // If name not nullptr, path is assumed to be a path without channel name,
732  // name is assumed to be channel name without the path.
733  void constructChannelReference(UT_String &reference,
734  CH_ExprLanguage language,
735  const char *path,
736  const char *ch_name=nullptr);
737 
738  static bool isChanRefString(const char *str, bool is_expr,
739  UT_String *chref = 0);
740 
741  bool getHaveCompiledExpressions() const;
742 
743 
744  // Set a flag to have the label persisted with the parm.
745  // This is used to set a label on multi params
746  void setSaveLabelFlag(bool f);
747 
748  // Custom Channel Color that persists when set.
749  bool hasChannelCustomColor(int index) const;
750  const UT_Color &getChannelCustomColor(int index) const;
751  void setChannelCustomColor(int index, const UT_Color &c);
752  void resetChannelCustomColor(int index);
753 
754  bool getAutoSelectFlag(int vec_idx) const;
755  void setAutoSelectFlag(int vec_idx, bool f);
756  unsigned int getAutoSelectField() const;
757 
758  void setTimeDependentMicroNode(int subindex, bool timedep) const;
759 private:
760  void privateValueChanged(
761  int vec_idx,
762  bool propagate,
763  bool update_multi);
764 
765  template <typename DstT, typename SrcT>
766  bool setValuesT(
767  const fpreal time,
768  const SrcT *values,
769  bool kill_expr,
770  PRM_AddKeyType add_key,
771  bool propagate);
772 
773  static PRM_AddKeyType getAddKeyValue(PRM_AddKeyType add_key);
774 
775 private:
776  PRM_Instance *myInstancePtr;
777  PRM_ParmList *myOwner;
778 
779  static bool myAlwaysHardenFlag;
780  static bool myDestructiveRevertToDefaultFlag;
781  static bool myRevertInvisibleToDefaultsFlag;
782  static bool myMakeSpareParmsForUnknownChannelsFlag;
783 
784  friend class PRM_ParmList;
785 };
786 
787 // UTformat support.
788 PRM_API size_t format(char *buffer, size_t buffer_size, const PRM_Parm &v);
789 
790 #endif
PRM_OverrideType
Definition: PRM_Parm.h:69
PRM_AddKeyType
Definition: PRM_Parm.h:58
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
int int32
Definition: SYS_Types.h:39
const UT_StringRef & getTokenRef() const
Definition: PRM_Parm.h:481
static bool getDestructiveRevertToDefaultFlag()
Definition: PRM_Parm.h:145
CH_ExprLanguage
CH_StringMeaning
GT_API const UT_StringHolder time
const GLdouble * v
Definition: glcorearb.h:837
static bool getMakeSpareParmsForUnknownChannelsFlag()
Definition: PRM_Parm.h:155
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:120
int getVectorSize() const
Definition: PRM_Parm.h:467
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
UT_Array< std::pair< UT_StringHolder, PRM_UndoDataHandle > > PRM_UndoDataList
Definition: PRM_Parm.h:121
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
PRM_KeySetType
static void setMakeSpareParmsForUnknownChannelsFlag(bool v)
Definition: PRM_Parm.h:157
float fpreal32
Definition: SYS_Types.h:200
virtual UT_JSONValueMap * getKeyValueDict() const
Definition: PRM_Parm.h:87
static bool getRevertInvisibleToDefaultsFlag()
Definition: PRM_Parm.h:150
double fpreal64
Definition: SYS_Types.h:201
GLfloat f
Definition: glcorearb.h:1926
Definition: core.h:760
const UT_StringHolder & getDecodedChannelToken(int vi=0) const
Definition: PRM_Parm.h:489
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
static void setAlwaysHardenFlag(bool o)
Definition: PRM_Parm.h:187
PRM_ChanState
Definition: PRM_ChanState.h:14
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLint GLuint mask
Definition: glcorearb.h:124
void valueChanged(int vec_idx, bool propagate)
Definition: PRM_Parm.h:390
long long int64
Definition: SYS_Types.h:116
PRM_Callback getCallback()
Definition: PRM_Parm.h:397
GLuint const GLchar * name
Definition: glcorearb.h:786
const UT_StringHolder & getChannelToken(int vi=0) const
Definition: PRM_Parm.h:485
static void setRevertInvisibleToDefaultsFlag(bool v)
Definition: PRM_Parm.h:152
GLdouble t
Definition: glad.h:2397
static bool getAlwaysHardenFlag()
Definition: PRM_Parm.h:186
**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
SIM_API const UT_StringHolder force
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
PRM_TypeExtended
Definition: PRM_Type.h:509
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
virtual ~PRM_DataItem()
Definition: PRM_Parm.h:78
PRM_DataType
Definition: PRM_Type.h:112
PRM_ParmList * getOwner() const
Definition: PRM_Parm.h:650
Definition: core.h:1131
virtual ~PRM_UndoData()
Definition: PRM_Parm.h:114
type
Definition: core.h:1059
#define PRM_API
Definition: PRM_API.h:10
unsigned int uint
Definition: SYS_Types.h:45
virtual ~PRM_DataFactory()
Definition: PRM_Parm.h:94
static void setDestructiveRevertToDefaultFlag(bool v)
Definition: PRM_Parm.h:147
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
Definition: format.h:895
PRM_MultiType
This type enum defines the different types of multi (dynamic) parameters.
Definition: PRM_Type.h:417
GLenum src
Definition: glcorearb.h:1793