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 
212  const char *getOpFilter() const;
213  void setOpFilter(const char *value);
214  void setOpFilter(const PRM_SpareData *spareptr);
215  const char *getRManType() const;
216  void setRManType(const char *value);
217  int getMultiStartOffset() const;
218  void setMultiStartOffset(int value);
219  void setRampColorType(UT_ColorType color_type);
220  UT_ColorType getRampColorType() const;
221  const char *getRampBasisVar() const;
222  void setRampBasisVar(const char *value);
223  const char *getRampKeysVar() const;
224  void setRampKeysVar(const char *value);
225  const char *getRampValuesVar() const;
226  void setRampValuesVar(const char *value);
227  const char *getImportSource() const;
228  void setImportSource(const char *value);
229  const char *getImportToken() const;
230  void setImportToken(const char *value);
231  const char *getImportMask() const;
232  void setImportMask(const char *value);
233  bool getImportEnable() const;
234  void setImportEnable(bool value);
235  bool getExportDisable() const;
236  void setExportDisable(bool value);
237  bool getUnquotedFlag() const;
238  void setUnquotedFlag(bool value);
239  bool getIsGroupStart() const;
240  bool getIsGroupEnd() const;
241  bool getIsGroupParm() const;
242  bool getIsMultiParm() const;
243  bool getIsRampParm() const;
244  bool getIsRampParmColor() const;
245  bool getIsRampParmFloat() const;
246  bool getIsFileParm() const;
247  bool getIsBasicStringParm() const;
248  bool getIsButtonParm() const;
249  bool getIsLabelParm() const;
250 
251  bool getIsColorParm() const;
252  PRM_ColorType getColorType() const;
253  void setColorType(PRM_ColorType color_type);
254  bool getColorWheel() const;
255  void setColorWheel(bool value);
256  bool getColorDynamic() const;
257  void setColorDynamic(bool value);
258 
259  bool getIsKeyValueDictParm() const;
260  const char *getKeyValueDictKeyLabel() const;
261  void setKeyValueDictKeyLabel(const char *label);
262  const char *getKeyValueDictValueLabel() const;
263  void setKeyValueDictValueLabel(const char *label);
264  bool getKeyValueDictUseChooser() const;
265  void setKeyValueDictUseChooser(bool use_chooser);
266  const char *getKeyValueDictChooserLabel() const;
267  void setKeyValueDictChooserLabel(const char *label);
268  const char *getKeyValueDictChooserCallback() const;
269  void setKeyValueDictChooserCallback(const char *callback);
270 
271  const char *getRampBasisDefault() const;
272  void setRampBasisDefault(const char *value);
273  bool getRampShowControlsDefault() const;
274  void setRampShowControlsDefault(bool value);
275  bool getRampGrayscaleDefault() const;
276  void setRampGrayscaleDefault(bool value);
277 
278  void clearRampDefaults();
279  bool hasRampDefaultValue() const;
280  void setRampDefaultFromParm(const PRM_Parm &ramp_parm);
281 
282  const char *getFileChooserMode() const;
283  void setFileChooserMode(const char *value);
284  void setFileChooserMode(const PRM_SpareData *spareptr);
285 
286  const char *getFileChooserPattern() const;
287  void setFileChooserPattern(const char *value);
288  void setFileChooserPattern(const PRM_SpareData *spareptr);
289 
290  const char *getButtonIcon() const;
291  void setButtonIcon(const char *value);
292 
293  const char *getScriptAction() const;
294  void setScriptAction(const char *value);
295  const char *getScriptActionHelp() const;
296  void setScriptActionHelp(const char *value);
297  const char *getScriptActionIcon() const;
298  void setScriptActionIcon(const char *value);
299 
300  // This utility method returns string constants.
301  static const char *getScriptType(const PRM_Type &ptype,
302  PRM_TypeExtended etype,
303  PRM_MultiType mtype, int size);
304 
305  static bool parmTypeUsesOpFilter(const char *type);
306  static bool parmTypeUsesFileChooser(const char *type);
307 
308  static const char *getExportDisableToken();
309  static bool isSwitcherLevelSpareToken(const char *token);
310 
311  static PI_EditScriptedParmFolderType getSwitcherFolderType(
312  const PRM_Template &tplate);
313  static PI_EditScriptedParmFolderType getSwitcherFolderType(
314  const PRM_Type &type,
315  const PRM_SpareData *spare);
316 
324  int myExport;
325  int mySize;
327  CH_StringMeaning myDefaultsStringMeaning[
330  float myRange[2];
331  bool myRangeLock[2];
338  int myDoAutolink[PI_MAX_SCRIPT_PARM_SIZE];
349 
351  public:
352  const char *myLabel;
353  const char *myDSToken;
354  const PRM_Type &myType;
355  const char *myIcon;
356  int myExport;
357  int mySize;
358  int myMenu;
359  int myString;
360  int myRange;
361  float myMin, myMax;
362  const char *myDefault;
363  const char *mySuffix[PI_MAX_SCRIPT_PARM_SIZE];
365  };
366  static PI_ParmType theParmTypes[];
367 
368 private:
369  void defaultInit();
370  void initMenu(const PRM_ChoiceList *menu,
371  PRM_TypeExtended extended_menu_type);
372 
373  void rebuildChannelNameCache(
374  const UT_StringRef &parm_name,
375  int parmtypeidx) const;
376 
377  // internal implementation that gets either plain or decoded name
378  const UT_StringArray &getChannelNamesPrivate(bool decoded) const;
379  const UT_StringArray &getChannelNamesPrivate(const UT_StringRef &new_parm,
380  bool decoded) const;
381 
382  UT_StringHolder myType;
383  mutable int myCachedTypeIndex;
384 
385  // A mutable cache for the channel names last built for this parameter,
386  // along with the settings last used to build it.
387  mutable UT_StringArray myCachedChannelNames;
388  mutable UT_StringArray myCachedDecodedChannelNames;
389  mutable UT_StringHolder myChannelCacheToken;
390  mutable int myChannelCacheTypeIndex;
391 
392 };
393 
395 
397 {
398 public:
400  // Use this constructor to edit spare parameters.
401  // If skip_parm_vops is true, then the parameters
402  // coming from Parameter VOPs (ramp, etc) will
403  // not be included in the list, otherwise they will be.
404  // If allow_switch_rename is true then the
405  // switcher (folder) names will be changed to a uniuqe
406  // name, so that they are not marked as reserved,
407  // otherwise, if false, such names will remain
408  // unchanged (usually renaming is desirable, because
409  // having reserved switchers confuses things and
410  // makes them uneditable, but other times all
411  // parameters should keep their original names).
413  bool add_reserved_parms,
414  bool init_auto_links,
415  bool skip_parm_vops = false,
416  bool allow_switch_rename = true);
417  // Use this constructor to edit DA parameters.
418  // You can optionally include spare parameters
419  // anyway but with this constructor, DA parameters
420  // are not treated as reserved parameters.
422  OP_Node *node,
423  bool add_reserved_parms,
424  bool spareparms=false,
425  bool skip_parm_vops=false);
426  // Use this constructor to edit optype override
427  // parameters. Base and DA parameters are treated as
428  // reserved parameters.
430  bool add_reserved_parms,
431  bool skip_parm_vops=false);
432  // Get parameters from a dialog script.
433  // The node is just a reference used to determine
434  // what parameters should be reserved.
436  UT_IStream &is,
437  bool spareparms,
438  bool skip_reserved,
439  bool init_auto_links,
440  bool fix_invalid_joins);
441  // Get parameters from a array of parm templates.
442  // The node is just a reference used to determine
443  // what parameters should be reserved.
445  const PRM_Template *tplate,
446  bool spareparms,
447  bool skip_reserved,
448  bool init_auto_links);
449  // Copy constructor.
452 
453  // Merge the contents of another PI_EditScriptedParms into this one.
454  // The only change to the parms being merged is to resolve conflicts
455  // with existing parm names, and ensure no reserved parm names are used.
456  // The new parms are always added to the end of the current parms. The
457  // reserved flag from the source parms is preserved, so be careful when
458  // merging parameters from different sources.
459  void mergeParms(const PI_EditScriptedParms &src);
460 
461  // Remove all our parameters.
462  void clearParms();
463 
464  // Save the parms in dialog script format.
465  int save(std::ostream &os, UT_String &warnings,
466  bool validate_joins);
467 
468  // Dump the parameters, in a meaningless format, but useful for debugging.
469  void dump(std::ostream &os);
470 
471  // Compile these parameters, which means eliminating all information
472  // about the parameters that is not absolutely required for proper
473  // functioning.
474  void compile();
475 
476  // Get our individual parms.
477  PI_EditScriptedParmArray &getParms() { return myParms; }
478  int getNParms() const;
479  PI_EditScriptedParm *getParm(int i);
480  const PI_EditScriptedParm *getParm(int i) const;
481  int getParmIndexWithName(const UT_StringRef &name);
482  PI_EditScriptedParm *getParmWithName(const UT_StringRef &name);
483  int getParmIndex(PI_EditScriptedParm *p);
484  int getFolderIndexWithLabel(
485  const UT_StringRef &label);
486  int getFolderIndexWithName(
487  const UT_StringRef &name);
488  PI_EditScriptedParm *getFolderWithLabel(
489  const UT_StringRef &label);
490  PI_EditScriptedParm *getFolderWithName(
491  const UT_StringRef &name);
492 
493  // Remove all folder group parameters that do not contain any
494  // regular parameters (not folder groups and not separators).
495  void removeEmptyFolders();
496 
497  // Given a list of folder names, return the index of the start of the
498  // innermost folder, or -1 if there is no such folder.
499  int getNestedFolderIndex(
500  const UT_StringArray &folder_labels);
501 
502  // Given the index of a parameter, return the parms corresponding to the
503  // containing folders.
504  void getContainingFolders(
505  int parm_index,
507 
508  // Find a parm that already has a particular autolink.
509  PI_EditScriptedParm *getParmWithAutolink(const char *channelpath,
510  const char *nodepath,
511  int *linkedsubidx = 0);
512 
513  // For a group start parm or group end parm, find the opposite end of
514  // that group. Otherwise return -1.
515  int getMatchingGroupParm(int parm) const;
516 
517  // Returns true if the group parameter specified is the first page
518  // in a series of folders.
519  bool getIsFirstPage(int parm) const;
520 
521  // Returns the position of the group parameter that contains the specified
522  // parameter. If there is no parent group parameter, -1 is returned.
523  int getParentGroupParm(int parm);
524 
525  // Get information about the menu associated with a particular parameter.
526  int getNMenu(int parm);
527  PI_EditScriptedParmMenu *getMenu(int parm, int i);
528  const char *getMenuScript(int parm);
529 
530  // Test if a parameter can be moved from srcidx to dstidx. For example,
531  // a folder start token is not allowed to be moved beyond a corresponding
532  // end token. Returns true if parm move is allowed, false otherwise.
533  bool isParmMoveAllowed(int first, int last, int offset);
534 
535  // Add, remove, and reorder parameters.
536  bool updateNode();
537  void addParm(PI_EditScriptedParm *parm);
538  bool moveParms(int first, int last, int offset,
539  bool remove_invalid_groups=true);
540  void moveParms(const UT_IntArray &movingparms, int destpos,
541  bool remove_invalid_groups=true);
542 
543  // Adds parms for the multiparm templates attached to the specified
544  // parm. This function works recursively if the multiparm templates
545  // contain other multiparms.
546  void insertMultiParmTemplates(const PRM_Template *tplate,
547  const char *parentparmname,
548  const OP_Node *linktonode,
549  const char *nameprefix,
550  const char *labelprefix,
551  int insertat,
552  bool include_invisible_parms);
553 
554  // Apply a permutation to a block of parameters. This method only does
555  // sanity checking on the permutation itself, and not on the parameters
556  // themselves, so use it with caution. For example, don't screw up the
557  // order of group begin and end entries.
558  //
559  // The permutation array must consist of a permutation of the indicies
560  // [first..(first + permutation.entries() - 1)].
561  //
562  // The operation applied is basically:
563  // new_parms(first+i) = old_parms(permutation(i))
564  void permuteParms(int first,
565  const UT_IntArray &permutation);
566 
567  // If we are told to remove a group start or end parm, we automatically
568  // remove the opposite end of that group. Returns the number of parms
569  // removed.
570  int removeParms(int first, int last,
571  bool remove_invalid_joins=true);
572 
573  // joins cannot occur over folder boundaries, or at the end of the parm
574  // list.
575  void removeInvalidJoins();
576 
577  // Copy default parm values from the current values on the specified node.
578  void copyDefaultsFromNode(OP_Node *node);
579 
580  int checkReservedName(const char *name) const;
581  bool containsReservedParm() const;
582  void initializeReserveNames(OP_Parameters *node);
583  void initializeReserveFlags();
584  void clearReserveNamesAndFlags();
585  bool makeSafeParmName(PI_EditScriptedParm *parm,
586  UT_String &parmname,
587  const UT_StringSet *extrareserved,
588  bool checkexistingparms);
589  bool makeSafeParmName(PI_EditScriptedParm *parm,
590  UT_StringHolder &parmname,
591  const UT_StringSet *extrareserved,
592  bool checkexistingparms);
593 
594  // Set all autolink values for all parameters to the current set of
595  // links.
596  void setAutolinksToCurrentLinks();
597 
598  // Take the list of parm or channel names and add those parms or channels
599  // to the autolink fields of the appropriate PI_EditScriptedParm. The
600  // links array will be filled with the name of the parameter each of the
601  // parms was linked to (or an emtpy string if no link was made for that
602  // parm).
603  void addParametersToAutolinks(PI_EditScriptedParm &destparm,
604  const UT_StringArray &parms,
605  const char *nodepath,
606  bool linkinvisibles,
607  PI_EditScriptedParmArray &changedparms,
608  UT_StringArray &errors);
609 
610  // Makes sure that none of our parm names contain too many or too few
611  // hashes for the multiparm instance level they are at. This is called
612  // right before saving. Extra hashes are converted to underscores.
613  void fixParmNamesForInstanceLevel();
614 
615  // Find any reserved parms that have been placed incorrectly. In
616  // particular, reserved parms cannot be in a non-reserved multiparm.
617  void findMisplacedReservedParms(
618  UT_IntArray &misplaced_parms);
619 
620  // Turn the auto link values from all our parms into channel references
621  // on the appropriate nodes. The function is not const because it actually
622  // changes the auto link values.
623  void applyAutoLinks(UT_StringArray &errors,
624  OP_NodeList &changednodes,
625  UT_IntArray &changedparms);
626 
627  // The applyAutoLinks call happens before the node's templates are
628  // updated. So after updating the templates, we need to force any
629  // changed nodes to rebuild their dependencies and recook.
630  void updateNodesFromApplyAutoLinks(
631  OP_NodeList &changednodes,
632  UT_IntArray &changedparms);
633 
634  // This function is called whenever a node's name is changed. It goes
635  // through all our parm's auto links and changes any references from the
636  // old node name to the new node name.
637  bool updateAutoLinksForNameChange(
638  const UT_String &refnodepath,
639  const UT_String &oldpath,
640  const UT_String &newpath);
641 
642  // Gets the node that is associated with these parms. This value is
643  // used for finding and setting parameter links, and detecting parm
644  // name conflicts.
645  OP_Node *getNode() const;
646 
647  // These functions are used to control the table of multiparm link
648  // information used by piGetCurrentLinks.
649  static void buildMultiparmInfo(OP_Node *refnode);
650  static void clearMultiparmInfo();
651  static void lockMultiparmInfo();
652  static void releaseMultiparmInfo();
653  static const PI_BuiltMultiParmInfo &getBuiltMultiparmInfo();
654 
655  // Adds additional links so that dstparm has the additional links to the
656  // srcchannel. They must be both ramp parameters of the same type
657  // designated by is_color_ramp.
658  static void addRampAutoLinks(
659  OP_Node *dstnode,
660  PRM_Parm *dstparm,
661  const char *dstchannel,
662  const char *srcrelpath,
663  const char *srcchannel,
664  bool is_color_ramp,
665  UT_String &error);
666  /// Deletes ramp references added via addRampAutoLinks()
667  static void deleteRampAutoLinks(
668  OP_Node *dstnode,
669  PRM_Parm *dstparm,
670  const char *dstchannel,
671  bool is_color_ramp,
672  UT_String &error,
673  bool also_revert = false);
674 
675 private:
676  // Returns a pointer to the base parm templates, which is the myBase
677  // member if editing HDA parms, or the operator templates if editing
678  // spare parameters.
679  const PRM_Template *getBaseParmTemplates() const;
680  // Returns a pointer to the base parm template (if any) that matches
681  // the supplied parameter name.
682  const PRM_Template *getBaseParmTemplate(const char *parmname) const;
683 
684  // This utility function helps makeSafeParmName generate a list of all
685  // multiparm instance parms in this PI_EditScriptedParms.
686  void buildMParmInst(PI_EditScriptedParm *skipparm,
687  UT_StringArray &mparminst,
688  UT_IntArray &mparmlvl) const;
689 
690  // This utility function figures out the depth of multiparm nesting
691  // for the specified parm.
692  int getMultiParmInstanceLevel(
693  PI_EditScriptedParm *parm) const;
694 
695  // Utility function for makeSafeParmName which recursively checks a
696  // PRM_Template array (and any multiparm templates in that array) for
697  // conflicting parm names.
698  bool conflictsWithTemplate(const PRM_Template *tplate,
699  const UT_StringArray &mparmtplates,
700  const UT_StringArray &channels,
701  const UT_StringArray &mparminst,
702  const UT_IntArray &mparmlvl) const;
703 
704  void createImportGroups(int offset,
705  UT_Array<pi_GroupData> &gstack,
706  const PRM_ScriptImports *imports,
707  int &import_index);
708  void createImportGroupsBeforeGroupEnd(
709  int offset, int depth,
710  int switcher_index, int folder,
711  const PRM_ScriptImports *imports,
712  int &import_index);
713  void createParms(const PRM_Template *tplates,
714  const PRM_ScriptImports *imports,
715  bool skip_reserved,
716  bool init_auto_links = true,
717  bool skip_parm_vops = false,
718  bool allow_switch_rename = true);
719  void createParms(UT_ValArray<const PRM_Template *> &tplates,
720  const PRM_ScriptImports *imports,
721  bool skip_reserved,
722  bool init_auto_links = true,
723  bool skip_parm_vops = false,
724  bool allow_switch_rename = true);
725  void removeInvalidGroups(int startpos);
726 
727  void saveGroupHeader(std::ostream &os, int index,
728  bool first_page,
729  int &glevel,
730  int &import_depth,
731  bool &in_import_block);
732  void saveGroupFooter(std::ostream &os, int index,
733  int &glevel,
734  int &import_depth,
735  bool &in_import_block);
736  void saveImportHeader(std::ostream &os, int index,
737  int &glevel,
738  int &import_depth,
739  bool &in_import_block);
740  void saveImportFooter(std::ostream &os, int index,
741  int &glevel,
742  int &import_depth,
743  bool &in_import_block);
744  void saveMultiParmHeader(std::ostream &os, int index,
745  int &glevel,
746  int &import_depth,
747  bool &in_import_block);
748  void saveMultiParmFooter(std::ostream &os, int index,
749  int &glevel,
750  int &import_depth,
751  bool &in_import_block);
752 
753  PI_EditScriptedParmArray myParms;
754  UT_ArrayStringSet myReservedParmNames;
755  OP_Operator *myOp;
756  int myNodeId;
757  bool myIsEditingSpareParms;
758  bool myIsEditingOverrideParms;
759 };
760 
761 
762 // ============================================================================
763 // Abstracts edited parameters that may come from different nodes.
765 {
766 public:
767  PI_EditScriptedParmsAggregate() = default;
768  ~PI_EditScriptedParmsAggregate() = default;
769 
772  PI_EditScriptedParmsAggregate &) = delete;
773 
774  /// @{ Methods corresponding to the PI_EditScriptedParms class.
775  int getNParms() const;
776  PI_EditScriptedParm * getParm(int parm_idx);
777  OP_Node * getNode(int parm_idx);
778  int getMatchingGroupParm(int parm_idx) const;
779  int removeParms(int first_parm_idx, int last_parm_idx);
780  /// @}
781 
782  /// Gets list containing i-th parameter.
783  PRM_ParmList * getParmList(int parm_idx);
784 
785  /// Copies the member parameters to the given parms.
786  void copyToParms( PI_EditScriptedParms &parms ) const;
787 
788 protected:
789  /// @{ Node and parm management methods for subclasses.
790  void appendToAggregate(
791  OP_Node *node,
793  /// @}
794 
795 private:
796  int getParmIndex( int node_idx, int parm_sub_idx ) const;
797  void getNodeAndParmIndices( int &node_idx, int &parm_sub_idx,
798  int parm_idx ) const;
799 
800  // Nodes the parameters come from.
801  UT_ValArray<OP_Node *> mySrcNodes;
802 
803  /// Each entry contains parms from a corresponding OP in mySrcNodes list.
805 };
806 
807 #endif
808 
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
< returns > If no error
Definition: snippets.dox:2
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