HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_EditScriptedParms.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: PI_EditScriptedParms.h ( OP Library, C++)
7  *
8  * COMMENTS: Provides a data structure for holding all the information
9  * required to edit the parameters of a PI_ScriptOperator.
10  */
11 
12 #ifndef __PI_EditScriptedParms__
13 #define __PI_EditScriptedParms__
14 
15 #include "PI_API.h"
16 #include <UT/UT_Array.h>
17 #include <UT/UT_ArrayStringSet.h>
18 #include <UT/UT_Color.h>
19 #include <UT/UT_String.h>
20 #include <UT/UT_StringArray.h>
21 #include <UT/UT_StringHolder.h>
22 #include <UT/UT_SymbolTable.h>
23 #include <UT/UT_UniquePtr.h>
24 #include <UT/UT_ValArray.h>
25 #include <CH/CH_ExprLanguage.h>
26 #include <PRM/PRM_Type.h>
27 #include <OP/OP_Node.h>
28 #include <iosfwd>
29 
30 class PRM_Template;
31 class PRM_SpareData;
32 class PRM_Parm;
33 class PRM_Range;
34 class PRM_ChoiceList;
35 class PRM_ScriptImports;
36 class OP_Operator;
38 class pi_GroupData;
39 
40 #define PI_MAX_SCRIPT_PARM_SIZE 16
41 #define PI_FOLDER_DEFAULTNAME "folder0"
42 #define PI_PARM_DEFAULTNAME "newparameter"
43 
44 typedef enum {
51 
52 typedef enum {
57 
58 typedef enum {
70 
72 
74 {
75 public:
76  bool isValidChoice() const
77  {
78  return myToken.isstring() || myLabel.isstring();
79  }
80 
83 };
84 
86 {
87 public:
89  PI_EditScriptedParm(const PRM_Template &tplate, OP_Node *node,
90  bool init_auto_links=true);
94 
95  /// Assignment operator.
97 
99  {
100  myType = type;
101  myCachedTypeIndex = -2;
102  }
103  const UT_StringHolder &getType() const { return myType; }
104 
105  void changeTypeToRampColor();
106  void changeTypeToRampFloat();
107 
108  // Copy default parm values from the current values on the given parameter
109  // starting at the specified subindex on that parameter (mapping it to 0
110  // on this parameter).
111  void copyDefaultValuesFromParm(PRM_Parm *parm, int subidx);
112 
113  // Resets the autolink values from one or more channels of this parm
114  // to the set of currently existing links. Setting subidx to -1 causes
115  // all channels to reset their autolinks.
116  void setAutolinksToCurrentLinks(OP_Node *node, int subidx);
117 
118  // Take the incoming list of parm or channel names and add those parms
119  // or channels to our autolink values in an intelligent way. The
120  // links array will be filled with the name of the parameter each of the
121  // parms was linked to (or an emtpy string if no link was made for that
122  // parm).
123  void addParametersToAutolink(const UT_StringArray &parms,
124  const char *nodepath,
125  bool linkinvisibles,
126  PI_EditScriptedParms *owner,
127  UT_StringArray &errors);
128 
129  void setRange(const PRM_Range &range);
130 
131  int save(std::ostream &os, int indent, OP_Operator *op,
132  bool validate_join,
133  const PI_EditScriptedParm *nextparm,
134  bool in_import_block);
135  int saveSelectors(std::ostream &os, const char *tokeni,
136  OP_Operator *op);
137  void saveSpareData(std::ostream &os,
138  const char *tokeni,
139  bool skip_import_data,
140  bool first_group_page);
141  void saveSpareValue(std::ostream &os, const char *tokeni,
142  const char *spare_token);
143  void saveConditional(std::ostream &os, int indent,
144  const char *name,
145  UT_StringHolder &conditional);
146  // Debug dump of data
147  void dump(std::ostream &os);
148 
149  int getNMenu() const { return myMenu.entries(); }
150  void addMenu(
151  const UT_StringHolder &token = UT_StringHolder(),
153  void moveMenu(int idx);
154  void destroyMenu(int idx);
155  int checkNullMenu();
156  void clearMenuItems();
157  void clearCachedChannels();
158 
159  void setMenu(const PRM_ChoiceList *menu,
160  PRM_TypeExtended extended_menu_type);
161 
162  // Get our parm type index from our string type for use when building
163  // channels, or applying autolinks. It will return -1 for import blocks
164  // and tab folder which do not allow any of this sort of activity.
165  // The return value can be used to interface to theParmTypes array ONLY!
166  int getParmTypeIdxForChannels() const;
167  // Set the parameter size in a safe way.
168  void setSize(int size);
169 
170  // Accessor to get the list of channel names. This method
171  // updates the channel name cache, if necessary, and returns a constant
172  // reference directly to the cache in an attempt to avoid the overhead of
173  // building a UT_StringArray.
174  const UT_StringArray &getChannelNames() const;
175  const UT_StringArray &getDecodedChannelNames() const;
176 
177  // Get list of channel names for particular potential new parm name, using
178  // the internal channel token cache.
179  const UT_StringArray &getChannelNames(
180  const UT_StringRef &new_parm) const;
181  const UT_StringArray &getDecodedChannelNames(
182  const UT_StringRef &new_parm) const;
183 
184  const UT_StringHolder &findDecodedChannelName(
185  const UT_StringRef &encoded_name) const;
186 
187  const UT_StringHolder &findEncodedChannelName(
188  const UT_StringRef &decoded_name) const;
189 
190  // Copy all the spare data for the specified folder index from the given
191  // reference data. The index is the vector index of this folder in the
192  // corresponding switcher parameter. Erases existing tokens by default.
193  void extractGroupSpareData(const PRM_SpareData *ref,
194  int index,
195  bool keep_existing = false);
196 
197  // Merges the provided spare data into our spare data.
198  void mergeSpareData(const PRM_SpareData *srcsparedata);
199  // Insert spare data without erasing existing tokens.
200  void addSpareData(const PRM_SpareData *srcsparedata);
201 
202  const char *getSpareValue(const char *token) const;
203  void setSpareValue(const char *token, const char *value);
204  void copySpareValue(const char *token,
205  const PRM_SpareData &ref);
206 
207  const char *getCallbackData() const;
208  void setCallbackData(const char *value);
209  CH_ScriptLanguage getCallbackLanguage() const;
210  void setCallbackLanguage(CH_ScriptLanguage language);
211  bool getCallbackFromUI() const;
212  void setCallbackFromUI(bool enable);
213 
214  const char *getOpFilter() const;
215  void setOpFilter(const char *value);
216  void setOpFilter(const PRM_SpareData *spareptr);
217  const char *getRManType() const;
218  void setRManType(const char *value);
219  int getMultiStartOffset() const;
220  void setMultiStartOffset(int value);
221  void setRampColorType(UT_ColorType color_type);
222  UT_ColorType getRampColorType() const;
223  const char *getRampBasisVar() const;
224  void setRampBasisVar(const char *value);
225  const char *getRampKeysVar() const;
226  void setRampKeysVar(const char *value);
227  const char *getRampValuesVar() const;
228  void setRampValuesVar(const char *value);
229  const char *getImportSource() const;
230  void setImportSource(const char *value);
231  const char *getImportToken() const;
232  void setImportToken(const char *value);
233  const char *getImportMask() const;
234  void setImportMask(const char *value);
235  bool getImportEnable() const;
236  void setImportEnable(bool value);
237  bool getExportDisable() const;
238  void setExportDisable(bool value);
239  bool getUnquotedFlag() const;
240  void setUnquotedFlag(bool value);
241  bool getIsGroupStart() const;
242  bool getIsGroupEnd() const;
243  bool getIsGroupParm() const;
244  bool getIsMultiParm() const;
245  bool getIsRampParm() const;
246  bool getIsRampParmColor() const;
247  bool getIsRampParmFloat() const;
248  bool getIsFileParm() const;
249  bool getIsBasicStringParm() const;
250  bool getIsButtonParm() const;
251  bool getIsLabelParm() const;
252 
253  bool getIsColorParm() const;
254  PRM_ColorType getColorType() const;
255  void setColorType(PRM_ColorType color_type);
256  bool getColorWheel() const;
257  void setColorWheel(bool value);
258  bool getColorDynamic() const;
259  void setColorDynamic(bool value);
260 
261  bool getIsKeyValueDictParm() const;
262  const char *getKeyValueDictKeyLabel() const;
263  void setKeyValueDictKeyLabel(const char *label);
264  const char *getKeyValueDictValueLabel() const;
265  void setKeyValueDictValueLabel(const char *label);
266  bool getKeyValueDictUseChooser() const;
267  void setKeyValueDictUseChooser(bool use_chooser);
268  const char *getKeyValueDictChooserLabel() const;
269  void setKeyValueDictChooserLabel(const char *label);
270  const char *getKeyValueDictChooserCallback() const;
271  void setKeyValueDictChooserCallback(const char *callback);
272 
273  const char *getRampBasisDefault() const;
274  void setRampBasisDefault(const char *value);
275  bool getRampShowControlsDefault() const;
276  void setRampShowControlsDefault(bool value);
277  bool getRampGrayscaleDefault() const;
278  void setRampGrayscaleDefault(bool value);
279 
280  void clearRampDefaults();
281  bool hasRampDefaultValue() const;
282  void setRampDefaultFromParm(const PRM_Parm &ramp_parm);
283 
284  const char *getFileChooserMode() const;
285  void setFileChooserMode(const char *value);
286  void setFileChooserMode(const PRM_SpareData *spareptr);
287 
288  const char *getFileChooserPattern() const;
289  void setFileChooserPattern(const char *value);
290  void setFileChooserPattern(const PRM_SpareData *spareptr);
291 
292  const char *getButtonIcon() const;
293  void setButtonIcon(const char *value);
294 
295  const char *getScriptAction() const;
296  void setScriptAction(const char *value);
297  const char *getScriptActionHelp() const;
298  void setScriptActionHelp(const char *value);
299  const char *getScriptActionIcon() const;
300  void setScriptActionIcon(const char *value);
301 
302  // This utility method returns string constants.
303  static const char *getScriptType(const PRM_Type &ptype,
304  PRM_TypeExtended etype,
305  PRM_MultiType mtype, int size);
306 
307  static bool parmTypeUsesOpFilter(const char *type);
308  static bool parmTypeUsesFileChooser(const char *type);
309 
310  static const char *getExportDisableToken();
311  static bool isSwitcherLevelSpareToken(const char *token);
312 
313  static PI_EditScriptedParmFolderType getSwitcherFolderType(
314  const PRM_Template &tplate);
315  static PI_EditScriptedParmFolderType getSwitcherFolderType(
316  const PRM_Type &type,
317  const PRM_SpareData *spare);
318 
326  int myExport;
327  int mySize;
329  CH_StringMeaning myDefaultsStringMeaning[
332  float myRange[2];
333  bool myRangeLock[2];
340  int myDoAutolink[PI_MAX_SCRIPT_PARM_SIZE];
351 
353  public:
354  const char *myLabel;
355  const char *myDSToken;
356  const PRM_Type &myType;
357  const char *myIcon;
358  int myExport;
359  int mySize;
360  int myMenu;
361  int myString;
362  int myRange;
363  float myMin, myMax;
364  const char *myDefault;
365  const char *mySuffix[PI_MAX_SCRIPT_PARM_SIZE];
367  };
368  static PI_ParmType theParmTypes[];
369 
370 private:
371  void defaultInit();
372  void initMenu(const PRM_ChoiceList *menu,
373  PRM_TypeExtended extended_menu_type);
374 
375  void rebuildChannelNameCache(
376  const UT_StringRef &parm_name,
377  int parmtypeidx) const;
378 
379  // internal implementation that gets either plain or decoded name
380  const UT_StringArray &getChannelNamesPrivate(bool decoded) const;
381  const UT_StringArray &getChannelNamesPrivate(const UT_StringRef &new_parm,
382  bool decoded) const;
383 
384  UT_StringHolder myType;
385  mutable int myCachedTypeIndex;
386 
387  // A mutable cache for the channel names last built for this parameter,
388  // along with the settings last used to build it.
389  mutable UT_StringArray myCachedChannelNames;
390  mutable UT_StringArray myCachedDecodedChannelNames;
391  mutable UT_StringHolder myChannelCacheToken;
392  mutable int myChannelCacheTypeIndex;
393 
394 };
395 
397 
399 {
400 public:
402  // Use this constructor to edit spare parameters.
403  // If skip_parm_vops is true, then the parameters
404  // coming from Parameter VOPs (ramp, etc) will
405  // not be included in the list, otherwise they will be.
406  // If allow_switch_rename is true then the
407  // switcher (folder) names will be changed to a uniuqe
408  // name, so that they are not marked as reserved,
409  // otherwise, if false, such names will remain
410  // unchanged (usually renaming is desirable, because
411  // having reserved switchers confuses things and
412  // makes them uneditable, but other times all
413  // parameters should keep their original names).
415  bool add_reserved_parms,
416  bool init_auto_links,
417  bool skip_parm_vops = false,
418  bool allow_switch_rename = true);
419  // Use this constructor to edit DA parameters.
420  // You can optionally include spare parameters
421  // anyway but with this constructor, DA parameters
422  // are not treated as reserved parameters.
424  OP_Node *node,
425  bool add_reserved_parms,
426  bool spareparms=false,
427  bool skip_parm_vops=false);
428  // Use this constructor to edit optype override
429  // parameters. Base and DA parameters are treated as
430  // reserved parameters.
432  bool add_reserved_parms,
433  bool skip_parm_vops=false);
434  // Get parameters from a dialog script.
435  // The node is just a reference used to determine
436  // what parameters should be reserved.
438  UT_IStream &is,
439  bool spareparms,
440  bool skip_reserved,
441  bool init_auto_links,
442  bool fix_invalid_joins);
443  // Get parameters from a array of parm templates.
444  // The node is just a reference used to determine
445  // what parameters should be reserved.
447  const PRM_Template *tplate,
448  bool spareparms,
449  bool skip_reserved,
450  bool init_auto_links);
451  // Copy constructor.
454 
455  // Merge the contents of another PI_EditScriptedParms into this one.
456  // The only change to the parms being merged is to resolve conflicts
457  // with existing parm names, and ensure no reserved parm names are used.
458  // The new parms are always added to the end of the current parms. The
459  // reserved flag from the source parms is preserved, so be careful when
460  // merging parameters from different sources.
461  void mergeParms(const PI_EditScriptedParms &src);
462 
463  // Remove all our parameters.
464  void clearParms();
465 
466  // Save the parms in dialog script format.
467  int save(std::ostream &os, UT_String &warnings,
468  bool validate_joins);
469 
470  // Dump the parameters, in a meaningless format, but useful for debugging.
471  void dump(std::ostream &os);
472 
473  // Compile these parameters, which means eliminating all information
474  // about the parameters that is not absolutely required for proper
475  // functioning.
476  void compile();
477 
478  // Get our individual parms.
479  PI_EditScriptedParmArray &getParms() { return myParms; }
480  int getNParms() const;
481  PI_EditScriptedParm *getParm(int i);
482  const PI_EditScriptedParm *getParm(int i) const;
483  int getParmIndexWithName(const UT_StringRef &name);
484  PI_EditScriptedParm *getParmWithName(const UT_StringRef &name);
485  int getParmIndex(PI_EditScriptedParm *p);
486  int getFolderIndexWithLabel(
487  const UT_StringRef &label);
488  int getFolderIndexWithName(
489  const UT_StringRef &name);
490  PI_EditScriptedParm *getFolderWithLabel(
491  const UT_StringRef &label);
492  PI_EditScriptedParm *getFolderWithName(
493  const UT_StringRef &name);
494 
495  // Remove all folder group parameters that do not contain any
496  // regular parameters (not folder groups and not separators).
497  void removeEmptyFolders();
498 
499  // Given a list of folder names, return the index of the start of the
500  // innermost folder, or -1 if there is no such folder.
501  int getNestedFolderIndex(
502  const UT_StringArray &folder_labels);
503 
504  // Given the index of a parameter, return the parms corresponding to the
505  // containing folders.
506  void getContainingFolders(
507  int parm_index,
509 
510  // Find a parm that already has a particular autolink.
511  PI_EditScriptedParm *getParmWithAutolink(const char *channelpath,
512  const char *nodepath,
513  int *linkedsubidx = 0);
514 
515  // For a group start parm or group end parm, find the opposite end of
516  // that group. Otherwise return -1.
517  int getMatchingGroupParm(int parm) const;
518 
519  // Returns true if the group parameter specified is the first page
520  // in a series of folders.
521  bool getIsFirstPage(int parm) const;
522 
523  // Returns the position of the group parameter that contains the specified
524  // parameter. If there is no parent group parameter, -1 is returned.
525  int getParentGroupParm(int parm);
526 
527  // Get information about the menu associated with a particular parameter.
528  int getNMenu(int parm);
529  PI_EditScriptedParmMenu *getMenu(int parm, int i);
530  const char *getMenuScript(int parm);
531 
532  // Test if a parameter can be moved from srcidx to dstidx. For example,
533  // a folder start token is not allowed to be moved beyond a corresponding
534  // end token. Returns true if parm move is allowed, false otherwise.
535  bool isParmMoveAllowed(int first, int last, int offset);
536 
537  // Add, remove, and reorder parameters.
538  bool updateNode();
539  void addParm(PI_EditScriptedParm *parm);
540  bool moveParms(int first, int last, int offset,
541  bool remove_invalid_groups=true);
542  void moveParms(const UT_IntArray &movingparms, int destpos,
543  bool remove_invalid_groups=true);
544 
545  // Adds parms for the multiparm templates attached to the specified
546  // parm. This function works recursively if the multiparm templates
547  // contain other multiparms.
548  void insertMultiParmTemplates(const PRM_Template *tplate,
549  const char *parentparmname,
550  const OP_Node *linktonode,
551  const char *nameprefix,
552  const char *labelprefix,
553  int insertat,
554  bool include_invisible_parms);
555 
556  // Apply a permutation to a block of parameters. This method only does
557  // sanity checking on the permutation itself, and not on the parameters
558  // themselves, so use it with caution. For example, don't screw up the
559  // order of group begin and end entries.
560  //
561  // The permutation array must consist of a permutation of the indicies
562  // [first..(first + permutation.entries() - 1)].
563  //
564  // The operation applied is basically:
565  // new_parms(first+i) = old_parms(permutation(i))
566  void permuteParms(int first,
567  const UT_IntArray &permutation);
568 
569  // If we are told to remove a group start or end parm, we automatically
570  // remove the opposite end of that group. Returns the number of parms
571  // removed.
572  int removeParms(int first, int last,
573  bool remove_invalid_joins=true);
574 
575  // joins cannot occur over folder boundaries, or at the end of the parm
576  // list.
577  void removeInvalidJoins();
578 
579  // Copy default parm values from the current values on the specified node.
580  void copyDefaultsFromNode(OP_Node *node);
581 
582  int checkReservedName(const char *name) const;
583  bool containsReservedParm() const;
584  void initializeReserveNames(OP_Parameters *node);
585  void initializeReserveFlags();
586  void clearReserveNamesAndFlags();
587  bool makeSafeParmName(PI_EditScriptedParm *parm,
588  UT_String &parmname,
589  const UT_StringSet *extrareserved,
590  bool checkexistingparms);
591  bool makeSafeParmName(PI_EditScriptedParm *parm,
592  UT_StringHolder &parmname,
593  const UT_StringSet *extrareserved,
594  bool checkexistingparms);
595 
596  // Set all autolink values for all parameters to the current set of
597  // links.
598  void setAutolinksToCurrentLinks();
599 
600  // Take the list of parm or channel names and add those parms or channels
601  // to the autolink fields of the appropriate PI_EditScriptedParm. The
602  // links array will be filled with the name of the parameter each of the
603  // parms was linked to (or an emtpy string if no link was made for that
604  // parm).
605  void addParametersToAutolinks(PI_EditScriptedParm &destparm,
606  const UT_StringArray &parms,
607  const char *nodepath,
608  bool linkinvisibles,
609  PI_EditScriptedParmArray &changedparms,
610  UT_StringArray &errors);
611 
612  // Makes sure that none of our parm names contain too many or too few
613  // hashes for the multiparm instance level they are at. This is called
614  // right before saving. Extra hashes are converted to underscores.
615  void fixParmNamesForInstanceLevel();
616 
617  // Find any reserved parms that have been placed incorrectly. In
618  // particular, reserved parms cannot be in a non-reserved multiparm.
619  void findMisplacedReservedParms(
620  UT_IntArray &misplaced_parms);
621 
622  // Turn the auto link values from all our parms into channel references
623  // on the appropriate nodes. The function is not const because it actually
624  // changes the auto link values.
625  void applyAutoLinks(UT_StringArray &errors,
626  OP_NodeList &changednodes,
627  UT_IntArray &changedparms);
628 
629  // The applyAutoLinks call happens before the node's templates are
630  // updated. So after updating the templates, we need to force any
631  // changed nodes to rebuild their dependencies and recook.
632  void updateNodesFromApplyAutoLinks(
633  OP_NodeList &changednodes,
634  UT_IntArray &changedparms);
635 
636  // This function is called whenever a node's name is changed. It goes
637  // through all our parm's auto links and changes any references from the
638  // old node name to the new node name.
639  bool updateAutoLinksForNameChange(
640  const UT_String &refnodepath,
641  const UT_String &oldpath,
642  const UT_String &newpath);
643 
644  // Gets the node that is associated with these parms. This value is
645  // used for finding and setting parameter links, and detecting parm
646  // name conflicts.
647  OP_Node *getNode() const;
648 
649  // These functions are used to control the table of multiparm link
650  // information used by piGetCurrentLinks.
651  static void buildMultiparmInfo(OP_Node *refnode);
652  static void clearMultiparmInfo();
653  static void lockMultiparmInfo();
654  static void releaseMultiparmInfo();
655  static const PI_BuiltMultiParmInfo &getBuiltMultiparmInfo();
656 
657 private:
658  // Returns a pointer to the base parm templates, which is the myBase
659  // member if editing HDA parms, or the operator templates if editing
660  // spare parameters.
661  const PRM_Template *getBaseParmTemplates() const;
662  // Returns a pointer to the base parm template (if any) that matches
663  // the supplied parameter name.
664  const PRM_Template *getBaseParmTemplate(const char *parmname) const;
665 
666  // This utility function helps makeSafeParmName generate a list of all
667  // multiparm instance parms in this PI_EditScriptedParms.
668  void buildMParmInst(PI_EditScriptedParm *skipparm,
669  UT_StringArray &mparminst,
670  UT_IntArray &mparmlvl) const;
671 
672  // This utility function figures out the depth of multiparm nesting
673  // for the specified parm.
674  int getMultiParmInstanceLevel(
675  PI_EditScriptedParm *parm) const;
676 
677  // Utility function for makeSafeParmName which recursively checks a
678  // PRM_Template array (and any multiparm templates in that array) for
679  // conflicting parm names.
680  bool conflictsWithTemplate(const PRM_Template *tplate,
681  const UT_StringArray &mparmtplates,
682  const UT_StringArray &channels,
683  const UT_StringArray &mparminst,
684  const UT_IntArray &mparmlvl) const;
685 
686  void createImportGroups(int offset,
687  UT_Array<pi_GroupData> &gstack,
688  const PRM_ScriptImports *imports,
689  int &import_index);
690  void createImportGroupsBeforeGroupEnd(
691  int offset, int depth,
692  int switcher_index, int folder,
693  const PRM_ScriptImports *imports,
694  int &import_index);
695  void createParms(const PRM_Template *tplates,
696  const PRM_ScriptImports *imports,
697  bool skip_reserved,
698  bool init_auto_links = true,
699  bool skip_parm_vops = false,
700  bool allow_switch_rename = true);
701  void createParms(UT_ValArray<const PRM_Template *> &tplates,
702  const PRM_ScriptImports *imports,
703  bool skip_reserved,
704  bool init_auto_links = true,
705  bool skip_parm_vops = false,
706  bool allow_switch_rename = true);
707  void removeInvalidGroups(int startpos);
708 
709  void saveGroupHeader(std::ostream &os, int index,
710  bool first_page,
711  int &glevel,
712  int &import_depth,
713  bool &in_import_block);
714  void saveGroupFooter(std::ostream &os, int index,
715  int &glevel,
716  int &import_depth,
717  bool &in_import_block);
718  void saveImportHeader(std::ostream &os, int index,
719  int &glevel,
720  int &import_depth,
721  bool &in_import_block);
722  void saveImportFooter(std::ostream &os, int index,
723  int &glevel,
724  int &import_depth,
725  bool &in_import_block);
726  void saveMultiParmHeader(std::ostream &os, int index,
727  int &glevel,
728  int &import_depth,
729  bool &in_import_block);
730  void saveMultiParmFooter(std::ostream &os, int index,
731  int &glevel,
732  int &import_depth,
733  bool &in_import_block);
734 
735  PI_EditScriptedParmArray myParms;
736  UT_ArrayStringSet myReservedParmNames;
737  OP_Operator *myOp;
738  int myNodeId;
739  bool myIsEditingSpareParms;
740  bool myIsEditingOverrideParms;
741 };
742 
743 
744 // ============================================================================
745 // Abstracts edited parameters that may come from different nodes.
747 {
748 public:
749  PI_EditScriptedParmsAggregate() = default;
750  ~PI_EditScriptedParmsAggregate() = default;
751 
754  PI_EditScriptedParmsAggregate &) = delete;
755 
756  /// @{ Methods corresponding to the PI_EditScriptedParms class.
757  int getNParms() const;
758  PI_EditScriptedParm * getParm(int parm_idx);
759  OP_Node * getNode(int parm_idx);
760  int getMatchingGroupParm(int parm_idx) const;
761  int removeParms(int first_parm_idx, int last_parm_idx);
762  /// @}
763 
764  /// Gets list containing i-th parameter.
765  PRM_ParmList * getParmList(int parm_idx);
766 
767  /// Copies the member parameters to the given parms.
768  void copyToParms( PI_EditScriptedParms &parms ) const;
769 
770 protected:
771  /// @{ Node and parm management methods for subclasses.
772  void appendToAggregate(
773  OP_Node *node,
775  /// @}
776 
777 private:
778  int getParmIndex( int node_idx, int parm_sub_idx ) const;
779  void getNodeAndParmIndices( int &node_idx, int &parm_sub_idx,
780  int parm_idx ) const;
781 
782  // Nodes the parameters come from.
783  UT_ValArray<OP_Node *> mySrcNodes;
784 
785  /// Each entry contains parms from a corresponding OP in mySrcNodes list.
787 };
788 
789 #endif
790 
type
Definition: core.h:556
UT_StringHolder myHelpText
GLint first
Definition: glcorearb.h:405
PI_EditScriptedParmMenuEnable
#define PI_MAX_SCRIPT_PARM_SIZE
GLenum GLint * range
Definition: glcorearb.h:1925
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
CH_StringMeaning
GLsizei const GLfloat * value
Definition: glcorearb.h:824
PI_EditScriptedParmFolderType
UT_ValArray< PI_EditScriptedParm * > PI_EditScriptedParmArray
#define PI_API
Definition: PI_API.h:10
**But if you need a result
Definition: thread.h:622
PI_EditScriptedParmMenuType
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
PI_EditScriptedParmMenuType myMenuType
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
GLintptr offset
Definition: glcorearb.h:665
GLint ref
Definition: glcorearb.h:124
PI_EditScriptedParmArray & getParms()
UT_StringHolder myMenuScript
GLuint const GLchar * name
Definition: glcorearb.h:786
PRM_SpareData * mySpareData
PI_EditScriptedParmFolderType myFolderType
UT_SymbolMap< UT_StringArray * > PI_BuiltMultiParmInfo
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:5976
GLsizeiptr size
Definition: glcorearb.h:664
PRM_ColorType
Definition: PRM_Type.h:443
GA_API const UT_StringHolder parms
UT_ColorType
Definition: UT_Color.h:24
PRM_TypeExtended
Definition: PRM_Type.h:521
void setType(const UT_StringHolder &type)
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
const UT_StringHolder & getType() const
CH_ScriptLanguage myMenuScriptLanguage
UT_StringHolder myCategory
UT_ValArray< PI_EditScriptedParmMenu > myMenu
PI_EditScriptedParmMenuEnable myMenuEnable
PRM_MultiType
This type enum defines the different types of multi (dynamic) parameters.
Definition: PRM_Type.h:426
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
CH_ScriptLanguage
GLenum src
Definition: glcorearb.h:1793