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