All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  */
10 #ifndef __VOP_Parameter_h__
11 #define __VOP_Parameter_h__
13 #include "VOP_API.h"
14 #include "VOP_ParameterBase.h"
15 #include <CH/CH_ExprLanguage.h>
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);
28  void initializeNode() override;
30  // Get the parm block information that will go in the dialog script
31  // for our VOPNET.
33  UT_String &parmdecl,
34  const VOP_Language *language,
35  const VOP_CodeGenContext &context
36  ) override;
38  UT_String &parm_comment,
39  const VOP_Language *language,
40  const VOP_CodeGenContext &context
41  ) override;
42  void getParameterBlock(
43  UT_String &parmstr,
44  const char *shader_contexts) override;
45  // Get the pragmas that define the UI for the parameter.
46  void getPragmas(
47  UT_String &pragmastr,
48  const VOP_CodeGenContext &context
49  ) override;
52  const char *parmname,
53  const VOP_TypeInfo &type_info,
54  UT_String &str,
55  bool expand_string,
56  const VOP_Language *language = nullptr
57  ) override;
59  const char *inputLabel(unsigned idx) const override;
61  void setPARMNAME(const UT_String &str) override;
62  void setPARMLABEL(const UT_String &str);
63  void setPARMTYPEINDEX(int type) override;
64  void setPARMTYPENAME(const UT_StringRef &type_name) override;
65  void setPARMSCOPE(const char *scope) override;
66  void setPARMSTORAGE(int type) override;
67  void setPARMSTRINGTYPE(const char *style);
68  void setPARMOPFILTER(const char *filter);
70  void PARMSCOPE(UT_String &str) const override;
71  void PARMACCESS(UT_String &str) const override;
72  void PARMNAME(UT_String &str) const override;
73  void PARMPREFIX(UT_String &str) const override;
74  void PARMPOSTFIX(UT_String &str) const override;
75  void PARMLABEL(UT_String &str) const override;
76  void PARMCOMMENT(UT_String &str) const override;
77  int PARMTYPEINDEX() const override;
79  UT_String &type_name) const override;
81  UT_String &menu_option) const override;
83  void TAGS(UT_JSONValueMap &map) const;
84  void setTAGS(UT_StringMap<UT_StringHolder> &tags);
86  bool isParmVisible() const override;
87  void copySettingsFrom(
88  VOP_ParmGenerator *pvop) override;
90  const PI_EditScriptedParm *parm
91  ) override;
93  /// Parameter VOP represents USD inputs and output. It can be translated
94  /// directly to an input/output attribute of a USD material primitive.
95  bool translatesDirectlyToUSD() const override
96  { return true; }
98 protected:
99  VOP_Parameter(OP_Network *parent, const char *name,
100  OP_Operator *entry);
101  ~VOP_Parameter() override;
103  bool updateParmsFlags() override;
105  // Override cook method just so we can set our warnings properly.
106  bool USEASPARMDEFINER() const override;
107  bool USEOWNEXPORTCONTEXT() const override;
109  ) const override;
110  int UNIFORM() const override;
111  int USEBOUND() const override;
112  int EXPORTPARM() const override;
114  UT_StringArray &context_names
115  ) const override;
117  void MENUCHOICES(UT_String &str) const override;
118  void MENUSCRIPT(UT_String &str) const override;
119  CH_ScriptLanguage MENUSCRIPTLANGUAGE() const override;
120  void CALLBACKSTR(UT_String &str) const;
121  void HELPTEXTSTR(UT_String &str) const;
122  int INVISIBLE() const;
123  int JOINNEXT() const;
124  int SHOWLABEL() const;
125  int IRANGE(int index) const;
126  float FRANGE(int index) const;
128  bool needsInput() override;
130  // True if the node defines a node parameter UI (eg, on a SHOP);
131  // otherwise, returns false (eg, if this parm node refers to a method arg).
132  bool definesParmUI() const;
134  // Build the code to be output when useBound() is true but the parameter
135  // is not actually bound:
136  void getUnboundCode(
137  UT_String &codestr,
138  const VOP_CodeGenContext &context
139  ) override;
142  UT_String &parm_decl,
143  const VOP_CodeGenContext &codegen_ctx,
144  const VOP_Language *language = nullptr,
145  bool export_parms = false) override;
147  // Determines based on the parm index if the PARMNAME may be changed
148  // when this parm is changed.
150  int pidx) const override;
153  VOP_TypeInfo &type_info,
154  int idx) override;
156  unsigned idx,
157  VOP_VopTypeArray &voptypes) override;
158  bool shouldCheckTimeDependence() const override;
160 private:
161  bool allowMenu(int parmtype) const;
163  // Store the indices of the parameters that can affect the cached parameter
164  // name.
165  static int theParmNameParmIndex;
166  static int theParmPrefixParmIndex;
167  static int theParmPostfixParmIndex;
168  static int theParmTypeParmIndex;
169 };
171 #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
bool translatesDirectlyToUSD() const override
Definition: VOP_Parameter.h:95
virtual int UNIFORM() const =0
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
bool updateParmsFlags() override
virtual const char * inputLabel(unsigned idx) const
virtual void copyDefaultValuesFrom(const PI_EditScriptedParm *parm)
void initializeNode() override
virtual CH_ScriptLanguage MENUSCRIPTLANGUAGE() const
virtual void getParameterBlock(UT_String &parmstr, const char *shader_contexts)
virtual bool USEOWNEXPORTCONTEXT() const
GLuint const GLchar * name
Definition: glcorearb.h:786
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 void PARMCOMMENT(UT_String &str) const
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
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 setPARMSCOPE(const char *str)
virtual void PARMPOSTFIX(UT_String &str) const
virtual bool USEASPARMDEFINER() const =0
virtual void setPARMSTORAGE(int type)
virtual void setPARMTYPENAME(const UT_StringRef &type_name)
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
Definition: core.h:1059
virtual void setPARMNAME(const UT_String &str)
virtual bool getParmCanAffectParmName(int pidx) const =0
virtual int EXPORTPARM() const