HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_Bind.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_Bind_h__
11 #define __VOP_Bind_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 
26  void initializeNode() override;
27 
28  const VOP_Bind *castToBind() const override { return this; }
29  VOP_Bind *castToBind() override { return this; }
30 
31  // Get the parm block information that will go in the dialog script
32  // for our VOPNET.
34  UT_String &parmdecl,
35  const VOP_Language *language,
36  const VOP_CodeGenContext &context
37  ) override;
38 
40  const char *parmname,
41  const VOP_TypeInfo &type_info,
42  UT_String &str,
43  bool expand_string,
44  const VOP_Language *language=0
45  ) override;
46 
47  const char *inputLabel(unsigned idx) const override;
48 
49  void setPARMNAME(const UT_String &str) override;
50  void setPARMLABEL(const UT_String &str);
51  void setPARMTYPEINDEX(int type) override;
52  void setPARMSTORAGE(int type) override;
53  void setPARMSTRINGTYPE(const char *style);
54  void setPARMOPFILTER(const char *filter);
55 
56  void PARMNAME(UT_String &str) const override;
57  void PARMPREFIX(UT_String &str) const override;
58  void PARMPOSTFIX(UT_String &str) const override;
59  void PARMLABEL(UT_String &str) const override;
60  int PARMTYPEINDEX() const override;
61  void PARMTYPENAME(
62  UT_String &type_name) const override;
63 
64  bool isParmVisible() const override;
65  void copySettingsFrom(
66  VOP_ParmGenerator *pvop) override;
68  const PI_EditScriptedParm *parm
69  ) override;
70 
71  /// Bind VOP represents (and can be translated directly to)
72  /// the USD Primvar Reader shader primitive.
73  bool translatesDirectlyToUSD() const override
74  { return true; }
75 
76 protected:
77  VOP_Bind(OP_Network *parent, const char *name,
78  OP_Operator *entry);
79  ~VOP_Bind() override;
80 
81  bool updateParmsFlags() override;
82 
83  // Override cook method just so we can set our warnings properly.
84  bool USEASPARMDEFINER() const override;
85  bool USEOWNEXPORTCONTEXT() const override;
87  ) const override;
88  int UNIFORM() const override;
89  int USEBOUND() const override;
90  int EXPORTPARM() const override;
92  UT_StringArray &context_names
93  ) const override;
95  void MENUCHOICES(UT_String &str) const override;
96  void CALLBACKSTR(UT_String &str) const;
97  void HELPTEXTSTR(UT_String &str) const;
98  int INVISIBLE() const;
99  int JOINNEXT() const;
100  int SHOWLABEL() const;
101  int IRANGE(int index) const;
102  float FRANGE(int index) const;
103 
104  bool needsInput() override;
105 
106  // Build the code to be output when useBound() is true but the parameter
107  // is not actually bound:
108  void getUnboundCode(UT_String &codestr,
109  const VOP_CodeGenContext &context
110  ) override;
111 
113  UT_String &parm_decl,
114  const VOP_CodeGenContext &codegen_ctx,
115  const VOP_Language *language=NULL,
116  bool export_parms=false) override;
117 
118  // Determines based on the parm index if the PARMNAME may be changed
119  // when this parm is changed.
121  int pidx) const override;
122 
124  VOP_TypeInfo &type_info,
125  int idx) override;
127  unsigned idx,
128  VOP_VopTypeArray &voptypes) override;
129 
130 private:
131  bool allowMenu(int parmtype) const;
132 
133  // Store the index of the Bind Name and Parameter Type parameters.
134  static int theParmNameParmIndex;
135  static int theParmTypeParmIndex;
136 };
137 
138 #endif
Reprsents a language for which VOPs can generate source code.
Definition: VOP_Language.h:27
bool translatesDirectlyToUSD() const override
Definition: VOP_Bind.h:73
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.
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.
VOP_Bind * castToBind() override
Definition: VOP_Bind.h:29
const VOP_Bind * castToBind() const override
Definition: VOP_Bind.h:28
bool updateParmsFlags() override
virtual const char * inputLabel(unsigned idx) const
virtual void copyDefaultValuesFrom(const PI_EditScriptedParm *parm)
void initializeNode() override
virtual bool SHOULDHAVECORRESPONDINGCONNECTOR() const
virtual bool USEOWNEXPORTCONTEXT() const
GLuint const GLchar * name
Definition: glcorearb.h:786
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 getParameterDeclaration(UT_String &parmdecl, const VOP_Language *language, const VOP_CodeGenContext &context)
The parameter variable declaration using the syntax of a given language.
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
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
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
type
Definition: core.h:1059
virtual void setPARMNAME(const UT_String &str)
virtual bool getParmCanAffectParmName(int pidx) const =0
virtual int EXPORTPARM() const