HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_EditScriptedParms.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: PI_EditScriptedParms.h ( OP Library, C++)
7  *
8  * COMMENTS: Provides a data structure for holding all the information
9  * required to edit the parameters of a PI_ScriptOperator.
10  */
11 
12 #ifndef __PI_EditScriptedParms__
13 #define __PI_EditScriptedParms__
14 
15 #include "PI_API.h"
16 #include <UT/UT_Array.h>
17 #include <UT/UT_ArrayStringSet.h>
18 #include <UT/UT_Color.h>
19 #include <UT/UT_String.h>
20 #include <UT/UT_StringArray.h>
21 #include <UT/UT_StringHolder.h>
22 #include <UT/UT_SymbolTable.h>
23 #include <UT/UT_UniquePtr.h>
24 #include <UT/UT_ValArray.h>
25 #include <CH/CH_ExprLanguage.h>
26 #include <PRM/PRM_Type.h>
27 #include <OP/OP_Node.h>
28 #include <iosfwd>
29 
30 class PRM_Template;
31 class PRM_SpareData;
32 class PRM_Parm;
33 class PRM_Range;
34 class PRM_ChoiceList;
35 class PRM_ScriptImports;
36 class OP_Operator;
38 class pi_GroupData;
39 
40 #define PI_MAX_SCRIPT_PARM_SIZE 16
41 #define PI_FOLDER_DEFAULTNAME "folder0"
42 #define PI_PARM_DEFAULTNAME "newparameter"
43 
44 typedef enum {
51 
52 typedef enum {
57 
58 typedef enum {
70 
72 
74 {
75 public:
76  bool isValidChoice() const
77  {
78  return myToken.isstring() || myLabel.isstring();
79  }
80 
83 };
84 
86 {
87 public:
89  PI_EditScriptedParm(const PRM_Template &tplate, OP_Node *node,
90  bool init_auto_links=true);
94 
95  /// Assignment operator.
97 
99  {
100  myType = type;
101  myCachedTypeIndex = -2;
102  }
103  const UT_StringHolder &getType() const { return myType; }
104 
105  void changeTypeToRampColor();
106  void changeTypeToRampFloat();
107 
108  // Copy default parm values from the current values on the given parameter
109  // starting at the specified subindex on that parameter (mapping it to 0
110  // on this parameter).
111  void copyDefaultValuesFromParm(PRM_Parm *parm, int subidx);
112 
113  // Resets the autolink values from one or more channels of this parm
114  // to the set of currently existing links. Setting subidx to -1 causes
115  // all channels to reset their autolinks.
116  void setAutolinksToCurrentLinks(OP_Node *node, int subidx);
117 
118  // Take the incoming list of parm or channel names and add those parms
119  // or channels to our autolink values in an intelligent way. The
120  // links array will be filled with the name of the parameter each of the
121  // parms was linked to (or an emtpy string if no link was made for that
122  // parm).
123  void addParametersToAutolink(const UT_StringArray &parms,
124  const char *nodepath,
125  bool linkinvisibles,
126  PI_EditScriptedParms *owner,
127  UT_StringArray &errors);
128 
129  void setRange(const PRM_Range &range);
130 
131  int save(std::ostream &os, int indent, OP_Operator *op,
132  bool validate_join,
133  const PI_EditScriptedParm *nextparm,
134  bool in_import_block);
135  int saveSelectors(std::ostream &os, const char *tokeni,
136  OP_Operator *op);
137  void saveSpareData(std::ostream &os,
138  const char *tokeni,
139  bool skip_import_data,
140  bool first_group_page);
141  void saveSpareValue(std::ostream &os, const char *tokeni,
142  const char *spare_token);
143  void saveConditional(std::ostream &os, int indent,
144  const char *name,
145  UT_StringHolder &conditional);
146  // Debug dump of data
147  void dump(std::ostream &os);
148 
149  int getNMenu() const { return myMenu.entries(); }
150  void addMenu(
151  const UT_StringHolder &token = UT_StringHolder(),
153  void moveMenu(int idx);
154  void destroyMenu(int idx);
155  int checkNullMenu();
156  void clearMenuItems();
157  void clearCachedChannels();
158 
159  void setMenu(const PRM_ChoiceList *menu,
160  PRM_TypeExtended extended_menu_type);
161 
162  // Get our parm type index from our string type for use when building
163  // channels, or applying autolinks. It will return -1 for import blocks
164  // and tab folder which do not allow any of this sort of activity.
165  // The return value can be used to interface to theParmTypes array ONLY!
166  int getParmTypeIdxForChannels() const;
167  // Set the parameter size in a safe way.
168  void setSize(int size);
169 
170  // Accessor to get the list of channel names. This method
171  // updates the channel name cache, if necessary, and returns a constant
172  // reference directly to the cache in an attempt to avoid the overhead of
173  // building a UT_StringArray.
174  const UT_StringArray &getChannelNames() const;
175  const UT_StringArray &getDecodedChannelNames() const;
176 
177  // Get list of channel names for particular potential new parm name, using
178  // the internal channel token cache.
179  const UT_StringArray &getChannelNames(
180  const UT_StringRef &new_parm) const;
181  const UT_StringArray &getDecodedChannelNames(
182  const UT_StringRef &new_parm) const;
183 
184  const UT_StringHolder &findDecodedChannelName(
185  const UT_StringRef &encoded_name) const;
186 
187  const UT_StringHolder &findEncodedChannelName(
188  const UT_StringRef &decoded_name) const;
189 
190  // Copy all the spare data for the specified folder index from the given
191  // reference data. The index is the vector index of this folder in the
192  // corresponding switcher parameter.
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  bool getRampGrayscaleDefault() const;
275  void setRampGrayscaleDefault(bool value);
276 
277  void clearRampDefaults();
278  bool hasRampDefaultValue() const;
279  void setRampDefaultFromParm(const PRM_Parm &ramp_parm);
280 
281  const char *getFileChooserMode() const;
282  void setFileChooserMode(const char *value);
283  void setFileChooserMode(const PRM_SpareData *spareptr);
284 
285  const char *getFileChooserPattern() const;
286  void setFileChooserPattern(const char *value);
287  void setFileChooserPattern(const PRM_SpareData *spareptr);
288 
289  const char *getButtonIcon() const;
290  void setButtonIcon(const char *value);
291 
292  const char *getScriptAction() const;
293  void setScriptAction(const char *value);
294  const char *getScriptActionHelp() const;
295  void setScriptActionHelp(const char *value);
296  const char *getScriptActionIcon() const;
297  void setScriptActionIcon(const char *value);
298 
299  // This utility method returns string constants.
300  static const char *getScriptType(const PRM_Type &ptype,
301  PRM_TypeExtended etype,
302  PRM_MultiType mtype, int size);
303 
304  static bool parmTypeUsesOpFilter(const char *type);
305  static bool parmTypeUsesFileChooser(const char *type);
306 
307  static const char *getExportDisableToken();
308  static bool isSwitcherLevelSpareToken(const char *token);
309 
310  static PI_EditScriptedParmFolderType getSwitcherFolderType(
311  const PRM_Template &tplate);
312  static PI_EditScriptedParmFolderType getSwitcherFolderType(
313  const PRM_Type &type,
314  const PRM_SpareData *spare);
315 
323  int myExport;
324  int mySize;
326  CH_StringMeaning myDefaultsStringMeaning[
329  float myRange[2];
330  bool myRangeLock[2];
337  int myDoAutolink[PI_MAX_SCRIPT_PARM_SIZE];
348 
350  public:
351  const char *myLabel;
352  const char *myDSToken;
353  const PRM_Type &myType;
354  const char *myIcon;
355  int myExport;
356  int mySize;
357  int myMenu;
358  int myString;
359  int myRange;
360  float myMin, myMax;
361  const char *myDefault;
362  const char *mySuffix[PI_MAX_SCRIPT_PARM_SIZE];
364  };
365  static PI_ParmType theParmTypes[];
366 
367 private:
368  void defaultInit();
369  void initMenu(const PRM_ChoiceList *menu,
370  PRM_TypeExtended extended_menu_type);
371 
372  void rebuildChannelNameCache(
373  const UT_StringRef &parm_name,
374  int parmtypeidx) const;
375 
376  // internal implementation that gets either plain or decoded name
377  const UT_StringArray &getChannelNamesPrivate(bool decoded) const;
378  const UT_StringArray &getChannelNamesPrivate(const UT_StringRef &new_parm,
379  bool decoded) const;
380 
381  UT_StringHolder myType;
382  mutable int myCachedTypeIndex;
383 
384  // A mutable cache for the channel names last built for this parameter,
385  // along with the settings last used to build it.
386  mutable UT_StringArray myCachedChannelNames;
387  mutable UT_StringArray myCachedDecodedChannelNames;
388  mutable UT_StringHolder myChannelCacheToken;
389  mutable int myChannelCacheTypeIndex;
390 
391 };
392 
394 
396 {
397 public:
399  // Use this constructor to edit spare parameters.
400  // If skip_parm_vops is true, then the parameters
401  // coming from Parameter VOPs (ramp, etc) will
402  // not be included in the list, otherwise they will be.
403  // If allow_switch_rename is true then the
404  // switcher (folder) names will be changed to a uniuqe
405  // name, so that they are not marked as reserved,
406  // otherwise, if false, such names will remain
407  // unchanged (usually renaming is desirable, because
408  // having reserved switchers confuses things and
409  // makes them uneditable, but other times all
410  // parameters should keep their original names).
412  bool add_reserved_parms,
413  bool init_auto_links,
414  bool skip_parm_vops = false,
415  bool allow_switch_rename = true);
416  // Use this constructor to edit DA parameters.
417  // You can optionally include spare parameters
418  // anyway but with this constructor, DA parameters
419  // are not treated as reserved parameters.
421  OP_Node *node,
422  bool add_reserved_parms,
423  bool spareparms=false,
424  bool skip_parm_vops=false);
425  // Use this constructor to edit optype override
426  // parameters. Base and DA parameters are treated as
427  // reserved parameters.
429  bool add_reserved_parms,
430  bool skip_parm_vops=false);
431  // Get parameters from a dialog script.
432  // The node is just a reference used to determine
433  // what parameters should be reserved.
435  UT_IStream &is,
436  bool spareparms,
437  bool skip_reserved,
438  bool init_auto_links,
439  bool fix_invalid_joins);
440  // Get parameters from a array of parm templates.
441  // The node is just a reference used to determine
442  // what parameters should be reserved.
444  const PRM_Template *tplate,
445  bool spareparms,
446  bool skip_reserved,
447  bool init_auto_links);
448  // Copy constructor.
451 
452  // Merge the contents of another PI_EditScriptedParms into this one.
453  // The only change to the parms being merged is to resolve conflicts
454  // with existing parm names, and ensure no reserved parm names are used.
455  // The new parms are always added to the end of the current parms. The
456  // reserved flag from the source parms is preserved, so be careful when
457  // merging parameters from different sources.
458  void mergeParms(const PI_EditScriptedParms &src);
459 
460  // Remove all our parameters.
461  void clearParms();
462 
463  // Save the parms in dialog script format.
464  int save(std::ostream &os, UT_String &warnings,
465  bool validate_joins);
466 
467  // Dump the parameters, in a meaningless format, but useful for debugging.
468  void dump(std::ostream &os);
469 
470  // Compile these parameters, which means eliminating all information
471  // about the parameters that is not absolutely required for proper
472  // functioning.
473  void compile();
474 
475  // Get our individual parms.
476  PI_EditScriptedParmArray &getParms() { return myParms; }
477  int getNParms() const;
478  PI_EditScriptedParm *getParm(int i);
479  const PI_EditScriptedParm *getParm(int i) const;
480  int getParmIndexWithName(const UT_StringRef &name);
481  PI_EditScriptedParm *getParmWithName(const UT_StringRef &name);
482  int getParmIndex(PI_EditScriptedParm *p);
483  int getFolderIndexWithLabel(
484  const UT_StringRef &label);
485  int getFolderIndexWithName(
486  const UT_StringRef &name);
487  PI_EditScriptedParm *getFolderWithLabel(
488  const UT_StringRef &label);
489  PI_EditScriptedParm *getFolderWithName(
490  const UT_StringRef &name);
491 
492  // Remove all folder group parameters that do not contain any
493  // regular parameters (not folder groups and not separators).
494  void removeEmptyFolders();
495 
496  // Given a list of folder names, return the index of the start of the
497  // innermost folder, or -1 if there is no such folder.
498  int getNestedFolderIndex(
499  const UT_StringArray &folder_labels);
500 
501  // Given the index of a parameter, return the parms corresponding to the
502  // containing folders.
503  void getContainingFolders(
504  int parm_index,
506 
507  // Find a parm that already has a particular autolink.
508  PI_EditScriptedParm *getParmWithAutolink(const char *channelpath,
509  const char *nodepath,
510  int *linkedsubidx = 0);
511 
512  // For a group start parm or group end parm, find the opposite end of
513  // that group. Otherwise return -1.
514  int getMatchingGroupParm(int parm) const;
515 
516  // Returns true if the group parameter specified is the first page
517  // in a series of folders.
518  bool getIsFirstPage(int parm) const;
519 
520  // Returns the position of the group parameter that contains the specified
521  // parameter. If there is no parent group parameter, -1 is returned.
522  int getParentGroupParm(int parm);
523 
524  // Get information about the menu associated with a particular parameter.
525  int getNMenu(int parm);
526  PI_EditScriptedParmMenu *getMenu(int parm, int i);
527  const char *getMenuScript(int parm);
528 
529  // Test if a parameter can be moved from srcidx to dstidx. For example,
530  // a folder start token is not allowed to be moved beyond a corresponding
531  // end token. Returns true if parm move is allowed, false otherwise.
532  bool isParmMoveAllowed(int first, int last, int offset);
533 
534  // Add, remove, and reorder parameters.
535  bool updateNode();
536  void addParm(PI_EditScriptedParm *parm);
537  bool moveParms(int first, int last, int offset,
538  bool remove_invalid_groups=true);
539  void moveParms(const UT_IntArray &movingparms, int destpos,
540  bool remove_invalid_groups=true);
541 
542  // Adds parms for the multiparm templates attached to the specified
543  // parm. This function works recursively if the multiparm templates
544  // contain other multiparms.
545  void insertMultiParmTemplates(const PRM_Template *tplate,
546  const char *parentparmname,
547  const OP_Node *linktonode,
548  const char *nameprefix,
549  const char *labelprefix,
550  int insertat,
551  bool include_invisible_parms);
552 
553  // Apply a permutation to a block of parameters. This method only does
554  // sanity checking on the permutation itself, and not on the parameters
555  // themselves, so use it with caution. For example, don't screw up the
556  // order of group begin and end entries.
557  //
558  // The permutation array must consist of a permutation of the indicies
559  // [first..(first + permutation.entries() - 1)].
560  //
561  // The operation applied is basically:
562  // new_parms(first+i) = old_parms(permutation(i))
563  void permuteParms(int first,
564  const UT_IntArray &permutation);
565 
566  // If we are told to remove a group start or end parm, we automatically
567  // remove the opposite end of that group. Returns the number of parms
568  // removed.
569  int removeParms(int first, int last,
570  bool remove_invalid_joins=true);
571 
572  // joins cannot occur over folder boundaries, or at the end of the parm
573  // list.
574  void removeInvalidJoins();
575 
576  // Copy default parm values from the current values on the specified node.
577  void copyDefaultsFromNode(OP_Node *node);
578 
579  int checkReservedName(const char *name) const;
580  bool containsReservedParm() const;
581  void initializeReserveNames(OP_Parameters *node);
582  void initializeReserveFlags();
583  void clearReserveNamesAndFlags();
584  bool makeSafeParmName(PI_EditScriptedParm *parm,
585  UT_String &parmname,
586  const UT_StringSet *extrareserved,
587  bool checkexistingparms);
588  bool makeSafeParmName(PI_EditScriptedParm *parm,
589  UT_StringHolder &parmname,
590  const UT_StringSet *extrareserved,
591  bool checkexistingparms);
592 
593  // Set all autolink values for all parameters to the current set of
594  // links.
595  void setAutolinksToCurrentLinks();
596 
597  // Take the list of parm or channel names and add those parms or channels
598  // to the autolink fields of the appropriate PI_EditScriptedParm. The
599  // links array will be filled with the name of the parameter each of the
600  // parms was linked to (or an emtpy string if no link was made for that
601  // parm).
602  void addParametersToAutolinks(PI_EditScriptedParm &destparm,
603  const UT_StringArray &parms,
604  const char *nodepath,
605  bool linkinvisibles,
606  PI_EditScriptedParmArray &changedparms,
607  UT_StringArray &errors);
608 
609  // Makes sure that none of our parm names contain too many or too few
610  // hashes for the multiparm instance level they are at. This is called
611  // right before saving. Extra hashes are converted to underscores.
612  void fixParmNamesForInstanceLevel();
613 
614  // Find any reserved parms that have been placed incorrectly. In
615  // particular, reserved parms cannot be in a non-reserved multiparm.
616  void findMisplacedReservedParms(
617  UT_IntArray &misplaced_parms);
618 
619  // Turn the auto link values from all our parms into channel references
620  // on the appropriate nodes. The function is not const because it actually
621  // changes the auto link values.
622  void applyAutoLinks(UT_StringArray &errors,
623  OP_NodeList &changednodes,
624  UT_IntArray &changedparms);
625 
626  // The applyAutoLinks call happens before the node's templates are
627  // updated. So after updating the templates, we need to force any
628  // changed nodes to rebuild their dependencies and recook.
629  void updateNodesFromApplyAutoLinks(
630  OP_NodeList &changednodes,
631  UT_IntArray &changedparms);
632 
633  // This function is called whenever a node's name is changed. It goes
634  // through all our parm's auto links and changes any references from the
635  // old node name to the new node name.
636  bool updateAutoLinksForNameChange(
637  const UT_String &refnodepath,
638  const UT_String &oldpath,
639  const UT_String &newpath);
640 
641  // Gets the node that is associated with these parms. This value is
642  // used for finding and setting parameter links, and detecting parm
643  // name conflicts.
644  OP_Node *getNode() const;
645 
646  // These functions are used to control the table of multiparm link
647  // information used by piGetCurrentLinks.
648  static void buildMultiparmInfo(OP_Node *refnode);
649  static void clearMultiparmInfo();
650  static void lockMultiparmInfo();
651  static void releaseMultiparmInfo();
652  static const PI_BuiltMultiParmInfo &getBuiltMultiparmInfo();
653 
654  // Adds additional links so that dstparm has the additional links to the
655  // srcchannel. They must be both ramp parameters of the same type
656  // designated by is_color_ramp.
657  static void addRampAutoLinks(
658  OP_Node *dstnode,
659  PRM_Parm *dstparm,
660  const char *dstchannel,
661  const char *srcrelpath,
662  const char *srcchannel,
663  bool is_color_ramp,
664  UT_String &error);
665  /// Deletes ramp references added via addRampAutoLinks()
666  static void deleteRampAutoLinks(
667  OP_Node *dstnode,
668  PRM_Parm *dstparm,
669  const char *dstchannel,
670  bool is_color_ramp,
671  UT_String &error,
672  bool also_revert = false);
673 
674 private:
675  // Returns a pointer to the base parm templates, which is the myBase
676  // member if editing HDA parms, or the operator templates if editing
677  // spare parameters.
678  const PRM_Template *getBaseParmTemplates() const;
679  // Returns a pointer to the base parm template (if any) that matches
680  // the supplied parameter name.
681  const PRM_Template *getBaseParmTemplate(const char *parmname) const;
682 
683  // This utility function helps makeSafeParmName generate a list of all
684  // multiparm instance parms in this PI_EditScriptedParms.
685  void buildMParmInst(PI_EditScriptedParm *skipparm,
686  UT_StringArray &mparminst,
687  UT_IntArray &mparmlvl) const;
688 
689  // This utility function figures out the depth of multiparm nesting
690  // for the specified parm.
691  int getMultiParmInstanceLevel(
692  PI_EditScriptedParm *parm) const;
693 
694  // Utility function for makeSafeParmName which recursively checks a
695  // PRM_Template array (and any multiparm templates in that array) for
696  // conflicting parm names.
697  bool conflictsWithTemplate(const PRM_Template *tplate,
698  const UT_StringArray &mparmtplates,
699  const UT_StringArray &channels,
700  const UT_StringArray &mparminst,
701  const UT_IntArray &mparmlvl) const;
702 
703  void createImportGroups(int offset,
704  UT_Array<pi_GroupData> &gstack,
705  const PRM_ScriptImports *imports,
706  int &import_index);
707  void createImportGroupsBeforeGroupEnd(
708  int offset, int depth,
709  int switcher_index, int folder,
710  const PRM_ScriptImports *imports,
711  int &import_index);
712  void createParms(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 createParms(UT_ValArray<const PRM_Template *> &tplates,
719  const PRM_ScriptImports *imports,
720  bool skip_reserved,
721  bool init_auto_links = true,
722  bool skip_parm_vops = false,
723  bool allow_switch_rename = true);
724  void removeInvalidGroups(int startpos);
725 
726  void saveGroupHeader(std::ostream &os, int index,
727  bool first_page,
728  int &glevel,
729  int &import_depth,
730  bool &in_import_block);
731  void saveGroupFooter(std::ostream &os, int index,
732  int &glevel,
733  int &import_depth,
734  bool &in_import_block);
735  void saveImportHeader(std::ostream &os, int index,
736  int &glevel,
737  int &import_depth,
738  bool &in_import_block);
739  void saveImportFooter(std::ostream &os, int index,
740  int &glevel,
741  int &import_depth,
742  bool &in_import_block);
743  void saveMultiParmHeader(std::ostream &os, int index,
744  int &glevel,
745  int &import_depth,
746  bool &in_import_block);
747  void saveMultiParmFooter(std::ostream &os, int index,
748  int &glevel,
749  int &import_depth,
750  bool &in_import_block);
751 
752  PI_EditScriptedParmArray myParms;
753  UT_ArrayStringSet myReservedParmNames;
754  OP_Operator *myOp;
755  int myNodeId;
756  bool myIsEditingSpareParms;
757  bool myIsEditingOverrideParms;
758 };
759 
760 
761 // ============================================================================
762 // Abstracts edited parameters that may come from different nodes.
764 {
765 public:
766  PI_EditScriptedParmsAggregate() = default;
767  ~PI_EditScriptedParmsAggregate() = default;
768 
771  PI_EditScriptedParmsAggregate &) = delete;
772 
773  /// @{ Methods corresponding to the PI_EditScriptedParms class.
774  int getNParms() const;
775  PI_EditScriptedParm * getParm(int parm_idx);
776  OP_Node * getNode(int parm_idx);
777  int getMatchingGroupParm(int parm_idx) const;
778  int removeParms(int first_parm_idx, int last_parm_idx);
779  /// @}
780 
781  /// Gets list containing i-th parameter.
782  PRM_ParmList * getParmList(int parm_idx);
783 
784  /// Copies the member parameters to the given parms.
785  void copyToParms( PI_EditScriptedParms &parms ) const;
786 
787 protected:
788  /// @{ Node and parm management methods for subclasses.
789  void appendToAggregate(
790  OP_Node *node,
792  /// @}
793 
794 private:
795  int getParmIndex( int node_idx, int parm_sub_idx ) const;
796  void getNodeAndParmIndices( int &node_idx, int &parm_sub_idx,
797  int parm_idx ) const;
798 
799  // Nodes the parameters come from.
800  UT_ValArray<OP_Node *> mySrcNodes;
801 
802  /// Each entry contains parms from a corresponding OP in mySrcNodes list.
804 };
805 
806 #endif
807 
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
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:5976
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:510
void setType(const UT_StringHolder &type)
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
const UT_StringHolder & getType() const
CH_ScriptLanguage myMenuScriptLanguage
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