HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~PI_ScriptOperator();
39 
40  // When our parm template changes, refresh all persistent handles to
41  // make sure they aren't attached to a non-existant parameter.
42  virtual void getRefreshPICommands(OP_Node *node,
43  std::ostream &commands);
44 
45  // This method is used to specify where to add the "Controls" page
46  // in myBase during the execution of loadParmTemplates(). The
47  // insert_index is used to specify where the script parm templates
48  // occur with respect to myBase. The default argument of -1 means
49  // to append the templates after those in myBase.
50  void setControlsSwitcher(int switcher_index,
51  int page_num,
52  int insert_index = -1);
53 
54  void setAllCookParms(bool all_cook)
55  { myAllCookParms = all_cook; }
56  bool isAllCookParms() const
57  { return myAllCookParms; }
58 
59  void setAllNoResimParms(bool all_sim)
60  { myAllNoResimParms = all_sim; }
61  bool isAllNoSimParms() const
62  { return myAllNoResimParms; }
63 
64  /// Returns a callback that will run the script defined by the
65  /// "script_callback" spare data tag string of a node parameter.
66  static PRM_Callback getDefaultCallback();
67 
68 protected:
69  PI_ScriptOperator( const char *name,
70  const char *english,
71  OP_Constructor construct,
72  PRM_Template *templates,
73  const char *child_table_name,
74  unsigned min_sources,
75  unsigned max_sources = 9999,
76  CH_LocalVariable *variables = 0,
77  unsigned flags = 0,
78  const char **inputlabels = 0,
79  int maxoutputs = 1);
80 
81  virtual void removeAllBindings();
82  virtual void refreshAllBindings();
84  const char *filename,
85  UT_String &scriptName,
86  PRM_ScriptImports *&imports);
87 
88  virtual const char *getAddedDSIncludePath();
89 
90 private:
91  PRM_Template *myScriptObsoleteTemplates;
92  bool myAllCookParms;
93  bool myAllNoResimParms;
94 };
95 
96 #endif
virtual void getRefreshPICommands(OP_Node *, std::ostream &)
Definition: OP_Operator.h:526
GLbitfield flags
Definition: glcorearb.h:1595
#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:785
bool isAllNoSimParms() const
OP_Node *(* OP_Constructor)(OP_Network *, const char *, OP_Operator *)
Definition: OP_Operator.h:88
bool isAllCookParms() const
VEX_ContextType
Definition: VEX_VexTypes.h:60
void setAllNoResimParms(bool all_sim)