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