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