HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_Visualize.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_Visualize_h__
11 #define __VOP_Visualize_h__
12 
13 #include "VOP_API.h"
14 #include "VOP_ParameterBase.h"
15 
17 
19 {
20 public:
21  static OP_Node *myConstructor(OP_Network *net,
22  const char *name,
23  OP_Operator *entry);
24  static PRM_Template *buildTemplates(VOP_Language *language);
25  void getCode(UT_String &codestr,
26  const VOP_CodeGenContext &context
27  ) override;
28 
29  void initializeNode() override;
30 
32  bool check_shader_context) const override
33  {
34  if (!getInput(0))
35  return false;
37  check_shader_context);
38  }
39 
40  bool getIsParmGenerator() const override
41  { if (!getInput(0)) return false;
43 
44  // Because we switch in and out of being an op generator we
45  // have to dirty the parm generator explicitly on a rewire.
46  void opChanged(OP_EventType reason,
47  void *data=0) override;
48 
49  // Get the parm block information that will go in the dialog script
50  // for our VOPNET.
52  UT_String &parmdecl,
53  const VOP_Language *language,
54  const VOP_CodeGenContext &context
55  ) override;
56 
58  const char *parmname,
59  const VOP_TypeInfo &type_info,
60  UT_String &str,
61  bool expand_string,
62  const VOP_Language *language = nullptr
63  ) override;
64 
65  const char *inputLabel(unsigned idx) const override;
66 
67  void setPARMNAME(const UT_String &str) override;
68  void setPARMLABEL(const UT_String &str);
69  void setPARMTYPEINDEX(int type) override;
70  void setPARMSTORAGE(int type) override;
71  void setPARMSTRINGTYPE(const char *style);
72  void setPARMOPFILTER(const char *filter);
73 
74  void PARMNAME(UT_String &str) const override;
75  void PARMPREFIX(UT_String &str) const override;
76  void PARMPOSTFIX(UT_String &str) const override;
77  void PARMLABEL(UT_String &str) const override;
78  int PARMTYPEINDEX() const override;
79 
80  bool isParmVisible() const override;
81  void copySettingsFrom(
82  VOP_ParmGenerator *pvop) override;
84  const PI_EditScriptedParm *parm) override;
85 
86 protected:
87  VOP_Visualize(OP_Network *parent, const char *name,
88  OP_Operator *entry);
89  ~VOP_Visualize() override;
90 
91  bool updateParmsFlags() override;
92 
93  // Override cook method just so we can set our warnings properly.
94  bool USEASPARMDEFINER() const override;
95  int UNIFORM() const override;
96  int USEBOUND() const override;
97  int EXPORTPARM() const override;
99  UT_StringArray &context_names
100  ) const override;
102  void MENUCHOICES(UT_String &str) const override;
103  void CALLBACKSTR(UT_String &str) const;
104  void HELPTEXTSTR(UT_String &str) const;
105  int INVISIBLE() const;
106  int JOINNEXT() const;
107  int SHOWLABEL() const;
108  int IRANGE(int index) const;
109  float FRANGE(int index) const;
110 
111  bool needsInput() override;
112 
113  // Build the code to be output when useBound() is true but the parameter
114  // is not actually bound:
115  void getUnboundCode(UT_String &codestr,
116  const VOP_CodeGenContext &context) override;
117 
119  UT_String &parm_decl,
120  const VOP_CodeGenContext &codegen_ctx,
121  const VOP_Language *language=NULL,
122  bool export_parms=false) override;
123 
124  // Determines based on the parm index if the PARMNAME may be changed
125  // when this parm is changed.
127  int pidx) const override;
128 
130  VOP_TypeInfo &type_info,
131  int idx) override;
133  VOP_TypeInfo &type_info,
134  int idx) override;
135 private:
136  bool allowMenu(int parmtype) const;
137 
138  // Store the index of the Visualize Name and Parameter Type parameters.
139  static int theParmNameParmIndex;
140  static int theParmTypeParmIndex;
141 };
142 
143 #endif
Reprsents a language for which VOPs can generate source code.
Definition: VOP_Language.h:27
virtual bool needsInput()=0
virtual bool isParmVisible() const =0
virtual int UNIFORM() const =0
virtual void PARMNAME(UT_String &str) const =0
virtual void copySettingsFrom(VOP_ParmGenerator *pvop)
Copy settings from a source parameter generator.
void getCode(UT_String &codestr, const VOP_CodeGenContext &context) override
Get the code fragment to be included in the shader code.
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.
bool updateParmsFlags() override
virtual const char * inputLabel(unsigned idx) const
virtual void copyDefaultValuesFrom(const PI_EditScriptedParm *parm)
void initializeNode() override
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
bool getIsParmGenerator() const override
Returns true if this VOP is a VOP_ParmGenerator or subclass.
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)
void opChanged(OP_EventType reason, void *data=nullptr) override
#define VOP_API
Definition: VOP_API.h:10
virtual int PARMTYPEINDEX() const =0
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.
OP_Node * getInput(unsigned idx, bool mark_used=false) const
Returns the node connected to a particular input (may be null).
void getOutputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx) override
virtual int USEBOUND() const
virtual void MENUCHOICES(UT_String &str) const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
bool forceCodeGenerationOfInputs(const VOP_CodeGenContext &ctx, bool check_shader_context) const override
virtual void getUnboundCode(UT_String &codestr, const VOP_CodeGenContext &context)
virtual void PARMPOSTFIX(UT_String &str) const
virtual bool USEASPARMDEFINER() const =0
virtual void setPARMSTORAGE(int type)
GLuint index
Definition: glcorearb.h:786
OP_EventType
Definition: OP_Value.h:22
virtual void getParmDeclarationCode(UT_String &parm_decl, const VOP_CodeGenContext &codegen_ctx, const VOP_Language *language=NULL, bool export_parms=false)
type
Definition: core.h:1059
bool forceCodeGenerationOfInputs(const VOP_CodeGenContext &ctx, bool check_shader_context) const override
Definition: VOP_Visualize.h:31
virtual void setPARMNAME(const UT_String &str)
virtual bool getParmCanAffectParmName(int pidx) const =0
Definition: format.h:895
virtual int EXPORTPARM() const
bool getIsParmGenerator() const override
Returns true if this VOP is a VOP_ParmGenerator or subclass.
Definition: VOP_Visualize.h:40