HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROP_MDD.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: ROP_MDD.h (ROP library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __ROP_MDD__
12 #define __ROP_MDD__
13 
14 #include "ROP_API.h"
15 
16 #include <FS/FS_Writer.h>
17 
18 #include "ROP_Node.h"
19 
21 {
31 
33 };
34 
35 #define STR_PARM(name, idx, t) \
36  do { evalString(str, name, &mddIndirect[idx], 0, t); } while (false)
37 #define INT_PARM(name, idx, vi, t) \
38  do { return evalInt(name, &mddIndirect[idx], vi, t); } while (false)
39 #define FLOAT_PARM(name, idx, vi, t) \
40  do { return evalFloat(name, &mddIndirect[idx], vi, t); } while (false)
41 
42 class SOP_Node;
43 
44 class ROP_API ROP_MDD : public ROP_Node
45 {
46 public:
47  static OP_Node *myConstructor(OP_Network *net, const char*name, OP_Operator *op);
48 
49  OP_Context &getContext() { return myContext; }
50 
51  static OP_Operator *buildOperator();
52  static PRM_Template myTemplateList[];
53 
54 protected:
55  ROP_MDD(OP_Network *net, const char *name, OP_Operator *entry);
56  ~ROP_MDD() override;
57 
58  int startRender(int nframes, fpreal s, fpreal e) override;
60  ROP_RENDER_CODE endRender() override;
61 
63  const ROP_RenderDepParms &p) override;
64 
65  // Parameter fetching
66  /// File name for output
67  void OUTPUT(UT_String &str, fpreal t)
68  { getOutputOverrideEx(str, t, "file", "mkpath"); }
69 
70  /// Path to the SOP whose points we want to write to the file
71  void SOPPATH(UT_String &str, fpreal t)
72  { STR_PARM("soppath", MDD_SOPPATH, t); }
73 
74  /// Should we initialize simulation SOPs?
75  int INITSIM()
76  { INT_PARM("initsim", MDD_INITSIM, 0, 0); }
77 
78  enum CoordSysType {
79  COORDSYS_LEFT, // left-handed coordinate system (Houdini)
80  COORDSYS_RIGHT // right-handed coordinate system (Lightwave)
81  };
83  { return (CoordSysType)
84  evalInt("coordsys", &mddIndirect[MDD_COORDSYS], 0, 0); }
85 
86  int XFORMTYPE()
87  { INT_PARM("xformtype", MDD_XFORMTYPE, 0, 0); }
88 
90  { FLOAT_PARM("s", MDD_SCALE, 0, 0); }
92  { FLOAT_PARM("s", MDD_SCALE, 1, 0); }
94  { FLOAT_PARM("s", MDD_SCALE, 2, 0); }
95 
96  bool RELTIME()
97  { INT_PARM("reltime", MDD_RELTIME, 0, 0); }
98 
100  { FLOAT_PARM("restframe", MDD_RESTFRAME, 0, 0); }
101 
102 private:
103  /// This is used to look up the "real" index of ROP parameters because
104  /// there are several constant parameters always in a ROP (frame range,
105  /// etc). It is allocated once by the first ROP_MDD constructor to run,
106  /// and filled in by OP_Parameters on eval* calls using the parameter
107  /// names.
108  static int *mddIndirect;
109 
110  OP_Context myContext;
111  SOP_Node *myRenderSop;
112  FS_Writer *myFile;
113  uint32 myNumPoints;
114 };
115 
116 #undef STR_PARM
117 #undef INT_PARM
118 #undef FLOAT_PARM
119 
120 #endif
#define STR_PARM(name, idx, t)
Definition: ROP_MDD.h:35
#define FLOAT_PARM(name, idx, vi, t)
Definition: ROP_MDD.h:39
OP_Context & getContext()
Definition: ROP_MDD.h:49
ROP_RENDER_CODE
Definition: ROP_Node.h:48
virtual ROP_RENDER_CODE endRender()
GT_API const UT_StringHolder time
bool getOutputOverrideEx(UT_String &result, fpreal t, const char *output_parm_name, const char *mkdir_parm_name)
GLdouble s
Definition: glad.h:3009
#define ROP_API
Definition: ROP_API.h:10
void SOPPATH(UT_String &str, fpreal t)
Path to the SOP whose points we want to write to the file.
Definition: ROP_MDD.h:71
fpreal RESTFRAME()
Definition: ROP_MDD.h:99
virtual void buildRenderDependencies(const ROP_RenderDepParms &p)
bool RELTIME()
Definition: ROP_MDD.h:96
fpreal SX()
Definition: ROP_MDD.h:89
Class for writing files.
Definition: FS_Writer.h:32
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual ROP_RENDER_CODE renderFrame(fpreal time, UT_Interrupt *boss=0)
void OUTPUT(UT_String &str, fpreal t)
File name for output.
Definition: ROP_MDD.h:67
GLdouble t
Definition: glad.h:2397
fpreal SZ()
Definition: ROP_MDD.h:93
CoordSysType
Definition: ROP_MDD.h:78
#define INT_PARM(name, idx, vi, t)
Definition: ROP_MDD.h:37
int XFORMTYPE()
Definition: ROP_MDD.h:86
fpreal64 fpreal
Definition: SYS_Types.h:277
fpreal SY()
Definition: ROP_MDD.h:91
ropMDDParmIndex
Definition: ROP_MDD.h:20
unsigned int uint32
Definition: SYS_Types.h:40
CoordSysType COORDSYS()
Definition: ROP_MDD.h:82
exint evalInt(int pi, int vi, fpreal t) const
int INITSIM()
Should we initialize simulation SOPs?
Definition: ROP_MDD.h:75
virtual int startRender(int nframes, fpreal tstart, fpreal tend)