HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_PackPointsParms.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SOP/SOP_NodeVerb.h>
7 #include <OP/OP_Utils.h>
8 #include <PRM/PRM_Parm.h>
9 #include <UT/UT_IStream.h>
10 #include <UT/UT_NTStreamUtil.h>
11 #include <UT/UT_Ramp.h>
12 #include <UT/UT_SharedPtr.h>
13 #include <UT/UT_StringHolder.h>
14 #include <UT/UT_StringStream.h>
15 #include <UT/UT_VectorTypes.h>
16 #include <SYS/SYS_Types.h>
17 
18 using namespace UT::Literal;
19 
20 class DEP_MicroNode;
21 
23 {
24 public:
25  static int version() { return 1; }
26 
28  {
29  myGroup = ""_sh;
30  myTileSize = 0.1;
31  myViewportLOD = "full"_sh;
32  myPath = ""_sh;
33  myPivot = 1;
34 
35  }
36 
37  explicit SOP_PackPointsParms(const SOP_PackPointsParms &) = default;
38 
39  virtual ~SOP_PackPointsParms() {}
40 
41  bool operator==(const SOP_PackPointsParms &src) const
42  {
43  if (myGroup != src.myGroup) return false;
44  if (myTileSize != src.myTileSize) return false;
45  if (myViewportLOD != src.myViewportLOD) return false;
46  if (myPath != src.myPath) return false;
47  if (myPivot != src.myPivot) return false;
48 
49  return true;
50  }
51 
52 
53 
54  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
55  {
56  if (true)
57  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
58  else myGroup = ""_sh;
59  if (true)
60  OP_Utils::evalOpParm(myTileSize, node, "tilesize", time, 0);
61  else myTileSize = 0.1;
62  if (true)
63  OP_Utils::evalOpParm(myViewportLOD, node, "viewportlod", time, 0);
64  else myViewportLOD = "full"_sh;
65  if (true)
66  OP_Utils::evalOpParm(myPath, node, "path", time, 0);
67  else myPath = ""_sh;
68  if (true)
69  OP_Utils::evalOpParm(myPivot, node, "pivot", time, 0);
70  else myPivot = 1;
71 
72  }
73 
74 
75  virtual void loadFromOpSubclass(const LoadParms &loadparms)
76  {
77  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
78  }
79 
80 
81  virtual void copyFrom(const SOP_NodeParms *src)
82  {
83  *this = *((const SOP_PackPointsParms *)src);
84  }
85 
86  template <typename T>
87  void
88  doGetParmValue(exint idx, T &value) const
89  {
90  switch (idx)
91  {
92  case 0:
93  coerceValue(value, myGroup);
94  break;
95  case 1:
96  coerceValue(value, myTileSize);
97  break;
98  case 2:
99  coerceValue(value, myViewportLOD);
100  break;
101  case 3:
102  coerceValue(value, myPath);
103  break;
104  case 4:
105  coerceValue(value, myPivot);
106  break;
107 
108  }
109  }
110 
111  void getParmValue(exint idx, exint &value) const
112  { doGetParmValue(idx, value); }
113  void getParmValue(exint idx, fpreal &value) const
114  { doGetParmValue(idx, value); }
116  { doGetParmValue(idx, value); }
118  { doGetParmValue(idx, value); }
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
126  { doGetParmValue(idx, value); }
128  { doGetParmValue(idx, value); }
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
133 
134  template <typename T>
135  void
136  doSetParmValue(exint idx, const T &value)
137  {
138  switch (idx)
139  {
140  case 0:
141  coerceValue(myGroup, value);
142  break;
143  case 1:
144  coerceValue(myTileSize, value);
145  break;
146  case 2:
147  coerceValue(myViewportLOD, value);
148  break;
149  case 3:
150  coerceValue(myPath, value);
151  break;
152  case 4:
153  coerceValue(myPivot, value);
154  break;
155 
156  }
157  }
158 
159  void setParmValue(exint idx, const exint &value)
160  { doSetParmValue(idx, value); }
161  void setParmValue(exint idx, const fpreal &value)
162  { doSetParmValue(idx, value); }
163  void setParmValue(exint idx, const UT_Vector2D &value)
164  { doSetParmValue(idx, value); }
165  void setParmValue(exint idx, const UT_Vector3D &value)
166  { doSetParmValue(idx, value); }
167  void setParmValue(exint idx, const UT_Vector4D &value)
168  { doSetParmValue(idx, value); }
169  void setParmValue(exint idx, const UT_Matrix2D &value)
170  { doSetParmValue(idx, value); }
171  void setParmValue(exint idx, const UT_Matrix3D &value)
172  { doSetParmValue(idx, value); }
173  void setParmValue(exint idx, const UT_Matrix4D &value)
174  { doSetParmValue(idx, value); }
176  { doSetParmValue(idx, value); }
178  { doSetParmValue(idx, value); }
180  { doSetParmValue(idx, value); }
181 
182  virtual exint getNumParms() const
183  {
184  return 5;
185  }
186 
187  virtual const char *getParmName(exint fieldnum) const
188  {
189  switch (fieldnum)
190  {
191  case 0:
192  return "group";
193  case 1:
194  return "tilesize";
195  case 2:
196  return "viewportlod";
197  case 3:
198  return "path";
199  case 4:
200  return "pivot";
201 
202  }
203  return 0;
204  }
205 
206  virtual ParmType getParmType(exint fieldnum) const
207  {
208  switch (fieldnum)
209  {
210  case 0:
211  return PARM_STRING;
212  case 1:
213  return PARM_FLOAT;
214  case 2:
215  return PARM_STRING;
216  case 3:
217  return PARM_STRING;
218  case 4:
219  return PARM_INTEGER;
220 
221  }
222  return PARM_UNSUPPORTED;
223  }
224 
225  // Boiler plate to load individual types.
226  static void loadData(UT_IStream &is, int64 &v)
227  { is.bread(&v, 1); }
228  static void loadData(UT_IStream &is, bool &v)
229  { int64 iv; is.bread(&iv, 1); v = iv; }
230  static void loadData(UT_IStream &is, fpreal64 &v)
231  { is.bread<fpreal64>(&v, 1); }
232  static void loadData(UT_IStream &is, UT_Vector2D &v)
233  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
234  static void loadData(UT_IStream &is, UT_Vector3D &v)
235  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
236  is.bread<fpreal64>(&v.z(), 1); }
237  static void loadData(UT_IStream &is, UT_Vector4D &v)
238  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
239  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
240  static void loadData(UT_IStream &is, UT_Matrix2D &v)
241  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
242  static void loadData(UT_IStream &is, UT_Matrix3D &v)
243  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
244  static void loadData(UT_IStream &is, UT_Matrix4D &v)
245  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
246  static void loadData(UT_IStream &is, UT_Vector2I &v)
247  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
248  static void loadData(UT_IStream &is, UT_Vector3I &v)
249  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
250  is.bread<int64>(&v.z(), 1); }
251  static void loadData(UT_IStream &is, UT_Vector4I &v)
252  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
253  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
255  { is.bread(v); }
257  { UT_StringHolder rampdata;
258  loadData(is, rampdata);
259  if (rampdata.isstring())
260  {
261  v.reset(new UT_Ramp());
262  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
263  v->load(istr);
264  }
265  else v.reset();
266  }
269  loadData(is, data);
270  if (data.isstring())
271  {
272  // Find the data type.
273  char *colon = UT_StringWrap(data).findChar(':');
274  if (colon)
275  {
276  int typelen = colon - data.buffer();
278  type.strncpy(data.buffer(), typelen);
279  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
280 
281  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
282  }
283  }
284  else v.reset();
285  }
286 
287  static void saveData(std::ostream &os, int64 v)
288  { UTwrite(os, &v); }
289  static void saveData(std::ostream &os, bool v)
290  { int64 iv = v; UTwrite(os, &iv); }
291  static void saveData(std::ostream &os, fpreal64 v)
292  { UTwrite<fpreal64>(os, &v); }
293  static void saveData(std::ostream &os, UT_Vector2D v)
294  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
295  static void saveData(std::ostream &os, UT_Vector3D v)
296  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
297  UTwrite<fpreal64>(os, &v.z()); }
298  static void saveData(std::ostream &os, UT_Vector4D v)
299  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
300  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
301  static void saveData(std::ostream &os, UT_Matrix2D v)
303  static void saveData(std::ostream &os, UT_Matrix3D v)
305  static void saveData(std::ostream &os, UT_Matrix4D v)
307  static void saveData(std::ostream &os, UT_StringHolder s)
308  { UT_StringWrap(s).saveBinary(os); }
309  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
310  { UT_StringHolder result;
311  UT_OStringStream ostr;
312  if (s) s->save(ostr);
313  result = ostr.str();
314  saveData(os, result);
315  }
316  static void saveData(std::ostream &os, PRM_DataItemHandle s)
317  { UT_StringHolder result;
318  UT_OStringStream ostr;
319  if (s)
320  {
321  ostr << s->getDataTypeToken();
322  ostr << ":";
323  s->saveBinary(ostr);
324  }
325  result = ostr.str();
326  saveData(os, result);
327  }
328 
329 
330  void save(std::ostream &os) const
331  {
332  int32 v = version();
333  UTwrite(os, &v);
334  saveData(os, myGroup);
335  saveData(os, myTileSize);
336  saveData(os, myViewportLOD);
337  saveData(os, myPath);
338  saveData(os, myPivot);
339 
340  }
341 
342  bool load(UT_IStream &is)
343  {
344  int32 v;
345  is.bread(&v, 1);
346  if (version() != v)
347  {
348  // Fail incompatible versions
349  return false;
350  }
351  loadData(is, myGroup);
352  loadData(is, myTileSize);
353  loadData(is, myViewportLOD);
354  loadData(is, myPath);
355  loadData(is, myPivot);
356 
357  return true;
358  }
359 
360  const UT_StringHolder & getGroup() const { return myGroup; }
361  void setGroup(const UT_StringHolder & val) { myGroup = val; }
363  {
364  SOP_Node *thissop = cookparms.getNode();
365  if (!thissop) return getGroup();
366  UT_StringHolder result;
367  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
368  return result;
369  }
370  fpreal64 getTileSize() const { return myTileSize; }
371  void setTileSize(fpreal64 val) { myTileSize = val; }
373  {
374  SOP_Node *thissop = cookparms.getNode();
375  if (!thissop) return getTileSize();
376  fpreal64 result;
377  OP_Utils::evalOpParm(result, thissop, "tilesize", cookparms.getCookTime(), 0);
378  return result;
379  }
380  const UT_StringHolder & getViewportLOD() const { return myViewportLOD; }
381  void setViewportLOD(const UT_StringHolder & val) { myViewportLOD = val; }
383  {
384  SOP_Node *thissop = cookparms.getNode();
385  if (!thissop) return getViewportLOD();
386  UT_StringHolder result;
387  OP_Utils::evalOpParm(result, thissop, "viewportlod", cookparms.getCookTime(), 0);
388  return result;
389  }
390  const UT_StringHolder & getPath() const { return myPath; }
391  void setPath(const UT_StringHolder & val) { myPath = val; }
393  {
394  SOP_Node *thissop = cookparms.getNode();
395  if (!thissop) return getPath();
396  UT_StringHolder result;
397  OP_Utils::evalOpParm(result, thissop, "path", cookparms.getCookTime(), 0);
398  return result;
399  }
400  int64 getPivot() const { return myPivot; }
401  void setPivot(int64 val) { myPivot = val; }
402  int64 opPivot(const SOP_NodeVerb::CookParms &cookparms) const
403  {
404  SOP_Node *thissop = cookparms.getNode();
405  if (!thissop) return getPivot();
406  int64 result;
407  OP_Utils::evalOpParm(result, thissop, "pivot", cookparms.getCookTime(), 0);
408  return result;
409  }
410 
411 private:
412  UT_StringHolder myGroup;
413  fpreal64 myTileSize;
414  UT_StringHolder myViewportLOD;
415  UT_StringHolder myPath;
416  int64 myPivot;
417 
418 };
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
static void saveData(std::ostream &os, bool v)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
virtual exint getNumParms() const
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
void getParmValue(exint idx, UT_StringHolder &value) const
T & z(void)
Definition: UT_Vector4.h:372
static void saveData(std::ostream &os, int64 v)
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, UT_Vector3D &v)
void getParmValue(exint idx, fpreal &value) const
exint bread(int32 *buffer, exint asize=1)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void save(std::ostream &os) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
static void saveData(std::ostream &os, UT_Vector4D v)
static void saveData(std::ostream &os, UT_Matrix2D v)
T & x(void)
Definition: UT_Vector2.h:284
An output stream object that owns its own string buffer storage.
void getParmValue(exint idx, UT_Vector3D &value) const
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
static void saveData(std::ostream &os, UT_StringHolder s)
void setParmValue(exint idx, const UT_StringHolder &value)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static void loadData(UT_IStream &is, UT_Vector4D &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
UT_StringHolder opViewportLOD(const SOP_NodeVerb::CookParms &cookparms) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
static void saveData(std::ostream &os, fpreal64 v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:106
void setParmValue(exint idx, const fpreal &value)
static void loadData(UT_IStream &is, UT_Vector2D &v)
const UT_StringHolder & getViewportLOD() const
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
static void loadData(UT_IStream &is, UT_Vector2I &v)
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:115
void getParmValue(exint idx, UT_Matrix3D &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setParmValue(exint idx, const UT_Matrix3D &value)
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
virtual const char * getParmName(exint fieldnum) const
void setParmValue(exint idx, const UT_Matrix2D &value)
GLboolean * data
Definition: glcorearb.h:130
virtual ParmType getParmType(exint fieldnum) const
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
void setTileSize(fpreal64 val)
void getParmValue(exint idx, exint &value) const
static void saveData(std::ostream &os, UT_Vector3D v)
void setParmValue(exint idx, const exint &value)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setPath(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
const UT_StringHolder & getGroup() const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:269
void strncpy(const char *src, exint maxlen)
bool operator==(const SOP_PackPointsParms &src) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void getParmValue(exint idx, UT_Vector2D &value) const
fpreal64 opTileSize(const SOP_NodeVerb::CookParms &cookparms) const
void doGetParmValue(exint idx, T &value) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setParmValue(exint idx, const UT_Vector3D &value)
GLuint GLfloat * val
Definition: glcorearb.h:1607
void getParmValue(exint idx, UT_Matrix4D &value) const
int64 opPivot(const SOP_NodeVerb::CookParms &cookparms) const
#define SOP_API
Definition: SOP_API.h:10
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
static void loadData(UT_IStream &is, UT_Vector4I &v)
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Vector2D v)
void getParmValue(exint idx, UT_Vector4D &value) const
const UT_StringHolder & getPath() const
GLboolean r
Definition: glcorearb.h:1221
UT_StringHolder opPath(const SOP_NodeVerb::CookParms &cookparms) const
T & w(void)
Definition: UT_Vector4.h:374
static void loadData(UT_IStream &is, bool &v)
void setParmValue(exint idx, const UT_Matrix4D &value)
void setViewportLOD(const UT_StringHolder &val)
static void loadData(UT_IStream &is, fpreal64 &v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
virtual void copyFrom(const SOP_NodeParms *src)
void getParmValue(exint idx, UT_Matrix2D &value) const
SYS_FORCE_INLINE bool isstring() const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void setParmValue(exint idx, const UT_Vector2D &value)
GLenum src
Definition: glcorearb.h:1792
virtual void loadFromOpSubclass(const LoadParms &loadparms)
void setParmValue(exint idx, const UT_Vector4D &value)