HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VOP_Parameter.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: VOP Library (C++)
7  *
8  */
9 
10 #ifndef __VOP_Parameter_h__
11 #define __VOP_Parameter_h__
12 
13 #include "VOP_API.h"
14 #include "VOP_ParameterBase.h"
15 #include <CH/CH_ExprLanguage.h>
16 
18 
20 {
21 public:
22  static OP_Node *myConstructor(OP_Network *net,
23  const char *name,
24  OP_Operator *entry);
25  static PRM_Template *buildTemplates(VOP_Language *language);
26  static PRM_Template *getObsolete(VOP_Language *language);
27 
28  virtual void initializeNode();
29 
30  // Get the parm block information that will go in the dialog script
31  // for our VOPNET.
32  virtual void getParameterDeclaration(UT_String &parmdecl,
33  const VOP_Language *language,
34  const VOP_CodeGenContext &context);
35  virtual void getParameterComment(UT_String &parm_comment,
36  const VOP_Language *language,
37  const VOP_CodeGenContext &context);
38  virtual void getParameterBlock(UT_String &parmstr,
39  const char *shader_contexts);
40  // Get the pragmas that define the UI for the parameter.
41  virtual void getPragmas(UT_String &pragmastr,
42  const VOP_CodeGenContext &context);
43 
44  virtual bool getParmConstantString(const char *parmname,
45  const VOP_TypeInfo &type_info,
46  UT_String &str,
47  bool expand_string,
48  const VOP_Language *language=0);
49 
50  virtual const char *inputLabel(unsigned idx) const;
51 
52  virtual void setPARMNAME(const UT_String &str);
53  void setPARMLABEL(const UT_String &str);
54  virtual void setPARMTYPEINDEX(int type);
55  virtual void setPARMSCOPE(const char *scope);
56  virtual void setPARMSTORAGE(int type);
57  void setPARMSTRINGTYPE(const char *style);
58  void setPARMOPFILTER(const char *filter);
59 
60  virtual void PARMSCOPE(UT_String &str) const;
61  virtual void PARMACCESS(UT_String &str) const;
62  virtual void PARMNAME(UT_String &str) const;
63  virtual void PARMPREFIX(UT_String &str) const;
64  virtual void PARMPOSTFIX(UT_String &str) const;
65  virtual void PARMLABEL(UT_String &str) const;
66  virtual int PARMTYPEINDEX() const;
67  virtual void PARMTYPENAME(UT_String &type_name) const;
68  virtual void PARMMENUOPTION(UT_String &menu_option) const;
69 
70  virtual bool isParmVisible() const;
71  virtual void copySettingsFrom(VOP_ParmGenerator *pvop);
72  virtual void copyDefaultValuesFrom(
73  const PI_EditScriptedParm *parm);
74 
75 protected:
76  VOP_Parameter(OP_Network *parent, const char *name,
77  OP_Operator *entry);
78  virtual ~VOP_Parameter();
79 
80  virtual bool updateParmsFlags();
81 
82  // Override cook method just so we can set our warnings properly.
83  void PARMCOMMENT(UT_String &parmcomment) const;
84  virtual bool USEASPARMDEFINER() const;
85  virtual bool USEOWNEXPORTCONTEXT() const;
86  virtual bool SHOULDHAVECORRESPONDINGCONNECTOR() const;
87  virtual int UNIFORM() const;
88  virtual int USEBOUND() const;
89  virtual int EXPORTPARM() const;
90  virtual void EXPORTSHADERCONTEXTS(
91  UT_StringArray &context_names) const;
93  virtual void MENUCHOICES(UT_String &str) const;
94  virtual void MENUSCRIPT(UT_String &str) const;
95  virtual CH_ScriptLanguage MENUSCRIPTLANGUAGE() const;
96  void CALLBACKSTR(UT_String &str) const;
97  void HELPTEXTSTR(UT_String &str) const;
98  void TAGS(UT_JSONValueMap &map) const;
99  int INVISIBLE() const;
100  int JOINNEXT() const;
101  int SHOWLABEL() const;
102  int IRANGE(int index) const;
103  float FRANGE(int index) const;
104 
105  virtual bool needsInput(void);
106 
107  // True if the node defines a node parameter UI (eg, on a SHOP);
108  // otherwise, returns false (eg, if this parm node refers to a method arg).
109  bool definesParmUI();
110 
111  // Build the code to be output when useBound() is true but the parameter
112  // is not actually bound:
113  virtual void getUnboundCode(UT_String &codestr,
114  const VOP_CodeGenContext &context);
115 
116  virtual void getParmDeclarationCode(UT_String &parm_decl,
117  const VOP_CodeGenContext &codegen_ctx,
118  const VOP_Language *language=NULL,
119  bool export_parms=false);
120 
121  // Determines based on the parm index if the PARMNAME may be changed
122  // when this parm is changed.
123  virtual bool getParmCanAffectParmName(int pidx) const;
124 
125  virtual void getInputTypeInfoSubclass(
126  VOP_TypeInfo &type_info, int idx);
127  virtual void getAllowedInputTypesSubclass(unsigned idx,
128  VOP_VopTypeArray &voptypes);
129  virtual bool shouldCheckTimeDependence() const;
130 
131 private:
132  bool allowMenu(int parmtype) const;
133 
134  // Store the indices of the parameters that can affect the cached parameter
135  // name.
136  static int theParmNameParmIndex;
137  static int theParmPrefixParmIndex;
138  static int theParmPostfixParmIndex;
139  static int theParmTypeParmIndex;
140 };
141 
142 #endif
Reprsents a language for which VOPs can generate source code.
Definition: VOP_Language.h:27
virtual bool isParmVisible() const =0
virtual int UNIFORM() const =0
virtual bool updateParmsFlags()
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
virtual void PARMNAME(UT_String &str) const =0
virtual void getParameterComment(UT_String &parm_comment, const VOP_Language *language, const VOP_CodeGenContext &context)
virtual void copySettingsFrom(VOP_ParmGenerator *pvop)
Copy settings from a source parameter generator.
virtual void getAllowedInputTypesSubclass(unsigned idx, VOP_VopTypeArray &voptypes)
virtual bool getParmConstantString(const char *parmname, const VOP_TypeInfo &type_info, UT_String &str, bool expand_string, const VOP_Language *l=0)
Get the constant code that encodes the value of the node parameter.
virtual void PARMSCOPE(UT_String &str) const
virtual void PARMACCESS(UT_String &str) const
virtual const char * inputLabel(unsigned idx) const
virtual void copyDefaultValuesFrom(const PI_EditScriptedParm *parm)
virtual CH_ScriptLanguage MENUSCRIPTLANGUAGE() const
virtual void getParameterBlock(UT_String &parmstr, const char *shader_contexts)
virtual bool SHOULDHAVECORRESPONDINGCONNECTOR() const
virtual bool USEOWNEXPORTCONTEXT() const
virtual bool shouldCheckTimeDependence() const
virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
virtual void PARMLABEL(UT_String &str) const =0
virtual void PARMPREFIX(UT_String &str) const
virtual void EXPORTSHADERCONTEXTS(UT_StringArray &context_names) const
virtual void setPARMTYPEINDEX(int type)
#define VOP_API
Definition: VOP_API.h:10
virtual int PARMTYPEINDEX() const =0
virtual void MENUSCRIPT(UT_String &str) const
virtual void getParameterDeclaration(UT_String &parmdecl, const VOP_Language *language, const VOP_CodeGenContext &context)
The parameter variable declaration using the syntax of a given language.
virtual void getPragmas(UT_String &pragmastr, const VOP_CodeGenContext &context)
Get compiler pragmas for thi snode.
virtual void PARMMENUOPTION(UT_String &str) const
virtual int USEBOUND() const
virtual void MENUCHOICES(UT_String &str) const
virtual void getUnboundCode(UT_String &codestr, const VOP_CodeGenContext &context)
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual void setPARMSCOPE(const char *str)
virtual bool needsInput(void)=0
virtual void PARMPOSTFIX(UT_String &str) const
virtual bool USEASPARMDEFINER() const =0
virtual void setPARMSTORAGE(int type)
GLuint index
Definition: glcorearb.h:785
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
virtual void getParmDeclarationCode(UT_String &parm_decl, const VOP_CodeGenContext &codegen_ctx, const VOP_Language *language=NULL, bool export_parms=false)
virtual void PARMTYPENAME(UT_String &type_name) const
virtual void setPARMNAME(const UT_String &str)
virtual bool getParmCanAffectParmName(int pidx) const =0
virtual void initializeNode()
CH_ScriptLanguage
virtual int EXPORTPARM() const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1296