HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_NodeParmManager.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_NodeParmManager.h ( VOP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __VOP_NodeParmManager__
12 #define __VOP_NodeParmManager__
13 
14 #include "VOP_API.h"
15 #include "VOP_Types.h"
16 
17 class VOP_Language;
18 class VOP_TypeInfo;
19 class PRM_ChoiceList;
20 class PRM_Template;
21 class PRM_Type;
22 class UT_String;
23 
24 
25 /// Class for providing information about node parameters that correspond
26 /// to VOP data types. This manager maps VOP_Type to an appropriate PRM
27 /// parameter on a node, essentially describing the parameter UI.
29 {
30 public:
31  /// Constructor.
32  VOP_NodeParmManager( VOP_Language *language );
33 
34  /// Returns the number of parameters and parameter types known to manager.
35  int getNumParmTypes() const;
36 
37  /// @{ Returns the basic info about the i-th parameter.
38  VOP_Type getParmType(int idx) const;
39  VOP_Type getUnconditionedParmType(int idx) const;
40  const char *getParmName(int idx) const;
41  /// @}
42 
43  /// @{ Find parameter index based on VOP data type.
44  int getParmIndex(VOP_Type type) const;
45  int findUnconditionedParmIndex(VOP_Type type)const;
46  int guessParmIndex(VOP_Type voptype, PRM_Type parmtype,
47  int size) const;
48  /// @}
49 
50  /// Returns the approximate number of fields in a type. For example,
51  /// for float returns 1, for color 3. For arrays and strings returns 1.
52  int getTypeSize(VOP_Type voptype) const;
53 
54  /// Returns true if parameter allows a drop down menu.
55  bool allowsMenu(int idx) const;
56 
57  /// @{ Methods for obtaining PRM information for a i-th parameter.
58  void fillSwitcherTemplate(PRM_Template *tplate,
59  bool with_ranges) const;
60  void fillParmTemplate(int idx, PRM_Template *tplate) const;
61  int fillDialogScript(int idx,
62  UT_String &ds_type, int &ds_size) const;
63  int fillVexPragma(int idx, UT_String &vex_pragma) const;
64  bool fillParmOpFilter(int idx,
65  UT_String &op_filter, UT_String &op_relative) const;
66  /// @}
67 
68  /// @{ Checks the data type of i-th parameter
69  bool isSingleFloatParmIndex(int idx) const;
70  bool isSingleIntParmIndex(int idx) const;
71  bool isPossibleOpListIndex(int idx) const;
72  /// @}
73 
74  /// @{ Obtains PRM menu with parameter types.
75  PRM_ChoiceList *getParmTypeMenu() const;
76  PRM_ChoiceList *getParmTypeNameMenu() const;
77  /// @}
78 
79 
80  /// @{ Tests uniform-varying type.
81  bool supportsUniformVarying() const;
82  bool isParameterUniformVarying(int idx) const;
83  /// @}
84 
85 
86  /// @{ Returns the node operator name for parameters and constants.
87  const char *getParameterOpName(const VOP_TypeInfo &t)const;
88  const char *getConstantOpName() const;
89  /// @}
90 
91 private:
92  /// Needed for type conditioning.
93  VOP_Language * myLanguage;
94 };
95 
96 #endif
97 
Reprsents a language for which VOPs can generate source code.
Definition: VOP_Language.h:29
#define VOP_API
Definition: VOP_API.h:10
GLdouble t
Definition: glad.h:2397
GLsizeiptr size
Definition: glcorearb.h:664
VOP_Type
Enumeration of the built-in (basic) VOP data types.
Definition: VOP_Types.h:25
type
Definition: core.h:1059