HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
POP_LocalVar.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  */
7 
8 #ifndef __POP_LocalVar_h__
9 #define __POP_LocalVar_h__
10 
11 #include "POP_API.h"
12 #include "POP_Node.h"
13 
14 
15 class UT_String;
16 
17 
18 /// A subclass of POP_Node that handles many common local variables. Many
19 /// modifier POPs will derive from this subclass instead of POP_Node.
20 
22 {
23 public:
24 
25  static CH_LocalVariable myVariables[];
27 
29 
30  GA_Offset curPtOff();
31  GEO_PointP curPoint();
32  GU_Detail *curGdp() const;
33 
34 protected:
35  POP_LocalVar (OP_Network* net, const char* name,
36  OP_Operator* entry);
37  virtual ~POP_LocalVar (void);
38 
39  virtual bool evalVariableValue(fpreal &v, int index, int thread);
40  virtual bool evalVariableValue(UT_String &v, int i, int thr)
41  { return POP_Node::evalVariableValue(v, i, thr); }
42 
43  /// Call at the beginning of a cook (typically right after lockInputs())
44  /// to initialize the use of user-defined local variables. Make sure to
45  /// call cleanupDynamicVars() at the end of the cook.
46  void setupDynamicVars (POP_ContextData* data);
47 
48  /// Call at the end of a cook to clean up state associated with the use
49  /// of user-defined local variables.
50  void cleanupDynamicVars ();
51 
52  /// Call during cooking to initialize data necessary for the evaluation
53  /// of our local variables.
54  void setupVars (POP_ContextData* data,
55  const GA_PointGroup* source = 0);
56 
57  virtual int isVarDependent (GU_Detail* gdp, POP_FParam param,
58  float t, int thread);
59  virtual int isVarDependent (GU_Detail* gdp, POP_IParam param,
60  float t, int thread);
61  virtual int isVarDependent (GU_Detail* gdp, POP_SParam param,
62  float t, int thread);
63  virtual int isVarDependent (GU_Detail* gdp, EV_EXPRESSION* expr,
64  int thread);
65 
66  virtual void allowVar (int val) { myAllowLocalVar = val; };
67 
69  const char *name);
70 
71  /// Update a ramp from a specified multiparm. A return value of true
72  /// indicates that none of the parameters evaluated for this update is
73  /// dependent on a varying (per particle) local variable. A return
74  /// value of false indicates that the ramp will need to be updated for
75  /// every particle using OP_Parameters::updateRampFromMultiParm().
76  bool updateVarIndependentRamp(GU_Detail *gdp,
77  const PRM_Parm &multi, float t,
78  UT_Ramp &ramp, int thread);
79 
80  /// The point currently being processed, used to retrieve attribute values
81  /// when evaluating local variables. The derived class is responsible for
82  /// updating this member variable.
84 
85  /// An integer representing the current processing iteration, used to
86  /// implement the $ITER local variable. The derived class is responsible
87  /// for updating this member variable.
89 
90  int myVarTest;
91 
92  /// Retrieve a list of the local variables visible to this node.
93  /// This list is unsorted and may contain duplicates.
94  virtual void buildLocalVarNames(UT_StringArray &out_vars);
95 
96 private:
97 
98  void computeBBox (void);
99 
100  int myNumPoints;
101  int myNumGroupPoints;
102  GU_Detail* myBBGdp;
103  UT_Vector3 myBBOrigin;
104  UT_Vector3 myBBScale;
105  float myTimeInc;
106 
107  int myAllowLocalVar;
108  int myVarDependent;
109 
110  POP_ContextData* myContextData;
111 
112  POP_UserVarResolveInfo myUserVarResolveInfo;
113 };
114 
115 #endif
virtual int isVarDependent(GU_Detail *gdp, POP_FParam param, float t, int thread)
GA_Offset myCurrPtOff
Definition: POP_LocalVar.h:83
#define POP_API
Definition: POP_API.h:10
const GLdouble * v
Definition: glcorearb.h:836
float(POP_Node::* POP_FParam)(float t)
Definition: POP_Node.h:403
void(POP_Node::* POP_SParam)(UT_String &s, float t)
Definition: POP_Node.h:405
virtual void buildLocalVarNames(UT_StringArray &out_vars)
png_uint_32 i
Definition: png.h:2877
virtual const CH_LocalVariable * resolveExtraVariableForSyntaxHighlight(const char *name)
GA_Size GA_Offset
Definition: GA_Types.h:617
int(POP_Node::* POP_IParam)(float t)
Definition: POP_Node.h:404
static OP_VariablePair myVariablePair
Definition: POP_LocalVar.h:26
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
double fpreal
Definition: SYS_Types.h:263
GLenum GLfloat param
Definition: glcorearb.h:103
virtual bool evalVariableValue(UT_String &v, int i, int thr)
Definition: POP_LocalVar.h:40
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
GLuint index
Definition: glcorearb.h:785
GLuint GLfloat * val
Definition: glcorearb.h:1607
virtual bool evalVariableValue(UT_String &val, int index, int thread)
DO NOT USE THIS CLASS!!!
Definition: GEO_Point.h:389
static OP_TemplatePair myTemplatePair
Definition: POP_LocalVar.h:28
virtual void allowVar(int val)
Control whether parameter evalutions are allowed to reference local variables.
Definition: POP_LocalVar.h:66