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