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