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