HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_ScriptOperator.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_ScriptOperator.h ( OP Library, C++)
7  *
8  * COMMENTS: Extends script operators to deal with PI/Selector bindings.
9  */
10 
11 #ifndef __PI_ScriptOperator__
12 #define __PI_ScriptOperator__
13 
14 #include "PI_API.h"
15 #include <OP/OP_OTLDefinition.h>
16 #include <OP/OP_ScriptOperator.h>
17 #include <iosfwd>
18 
19 class PRM_ScriptPage;
20 
22 {
23 public:
24  // If specified, the base parameters will be the first parameters in the
25  // template list.
26  static PI_ScriptOperator *createScriptOp(const OP_OTLDefinition &def,
27  OP_Constructor construct,
28  const char *child_table_name,
29  unsigned flags = 0,
30  PRM_Template *base = 0,
31  VEX_ContextType vextype =
33  CH_LocalVariable *vars = 0,
34  bool is_written_in_python =
35  false);
36  static PRM_ScriptPage *allocateScriptPage(OP_Operator *op);
37 
38  ~PI_ScriptOperator() override;
39 
40  // When our parm template changes, refresh all persistent handles to
41  // make sure they aren't attached to a non-existant parameter.
43  OP_Node *node,
44  std::ostream &commands) override;
45 
46  // This method is used to specify where to add the "Controls" page
47  // in myBase during the execution of loadParmTemplates(). The
48  // insert_index is used to specify where the script parm templates
49  // occur with respect to myBase. The default argument of -1 means
50  // to append the templates after those in myBase.
51  void setControlsSwitcher(int switcher_index,
52  int page_num,
53  int insert_index = -1);
54 
55  void setAllCookParms(bool all_cook)
56  { myAllCookParms = all_cook; }
57  bool isAllCookParms() const
58  { return myAllCookParms; }
59 
60  void setAllNoResimParms(bool all_sim)
61  { myAllNoResimParms = all_sim; }
62  bool isAllNoSimParms() const
63  { return myAllNoResimParms; }
64 
65  /// Returns a callback that will run the script defined by the
66  /// "script_callback" spare data tag string of a node parameter.
67  static PRM_Callback getDefaultCallback();
68 
69 protected:
70  PI_ScriptOperator( const char *name,
71  const char *english,
72  OP_Constructor construct,
73  PRM_Template *templates,
74  const char *child_table_name,
75  unsigned min_sources,
76  unsigned max_sources = 9999,
77  CH_LocalVariable *variables = 0,
78  unsigned flags = 0,
79  const char **inputlabels = 0,
80  int maxoutputs = 1);
81 
82  void removeAllBindings() override;
83  void refreshAllBindings() override;
85  UT_IStream &is,
86  const char *filename,
87  UT_String &scriptName,
88  PRM_ScriptImports *&imports) override;
89 
90  virtual const char *getAddedDSIncludePath();
91 
92 private:
93  PRM_Template *myScriptObsoleteTemplates;
94  bool myAllCookParms;
95  bool myAllNoResimParms;
96 };
97 
98 #endif
GLbitfield flags
Definition: glcorearb.h:1596
std::function< OP_Ptr(OP_Network *, const char *, OP_Operator *)> OP_Constructor
Definition: OP_Operator.h:107
GT_API const UT_StringHolder filename
virtual void getRefreshPICommands(OP_Node *, std::ostream &)
Definition: OP_Operator.h:579
#define PI_API
Definition: PI_API.h:10
virtual void removeAllBindings()
virtual PRM_Template * loadParmTemplates(UT_IStream &, const char *, UT_String &, PRM_ScriptImports *&)
virtual void refreshAllBindings()
void setAllCookParms(bool all_cook)
GLuint const GLchar * name
Definition: glcorearb.h:786
bool isAllNoSimParms() const
bool isAllCookParms() const
VEX_ContextType
Definition: VEX_VexTypes.h:60
void setAllNoResimParms(bool all_sim)