HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  bool operator!=(const SOP_PackPointsParms &src) const
52  {
53  return !operator==(src);
54  }
55 
56 
57 
58  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
59  {
60  if (true)
61  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
62  else myGroup = ""_sh;
63  if (true)
64  OP_Utils::evalOpParm(myTileSize, node, "tilesize", time, 0);
65  else myTileSize = 0.1;
66  if (true)
67  OP_Utils::evalOpParm(myViewportLOD, node, "viewportlod", time, 0);
68  else myViewportLOD = "full"_sh;
69  if (true)
70  OP_Utils::evalOpParm(myPath, node, "path", time, 0);
71  else myPath = ""_sh;
72  if (true)
73  OP_Utils::evalOpParm(myPivot, node, "pivot", time, 0);
74  else myPivot = 1;
75 
76  }
77 
78 
79  virtual void loadFromOpSubclass(const LoadParms &loadparms)
80  {
81  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
82  }
83 
84 
85  virtual void copyFrom(const SOP_NodeParms *src)
86  {
87  *this = *((const SOP_PackPointsParms *)src);
88  }
89 
90  template <typename T>
91  void
92  doGetParmValue(exint idx, T &value) const
93  {
94  switch (idx)
95  {
96  case 0:
97  coerceValue(value, myGroup);
98  break;
99  case 1:
100  coerceValue(value, myTileSize);
101  break;
102  case 2:
103  coerceValue(value, myViewportLOD);
104  break;
105  case 3:
106  coerceValue(value, myPath);
107  break;
108  case 4:
109  coerceValue(value, myPivot);
110  break;
111 
112  }
113  }
114 
115  void getParmValue(exint idx, exint &value) const
116  { doGetParmValue(idx, value); }
117  void getParmValue(exint idx, fpreal &value) const
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); }
134  { doGetParmValue(idx, value); }
136  { doGetParmValue(idx, value); }
137 
138  template <typename T>
139  void
140  doSetParmValue(exint idx, const T &value)
141  {
142  switch (idx)
143  {
144  case 0:
145  coerceValue(myGroup, value);
146  break;
147  case 1:
148  coerceValue(myTileSize, value);
149  break;
150  case 2:
151  coerceValue(myViewportLOD, value);
152  break;
153  case 3:
154  coerceValue(myPath, value);
155  break;
156  case 4:
157  coerceValue(myPivot, value);
158  break;
159 
160  }
161  }
162 
163  void setParmValue(exint idx, const exint &value)
164  { doSetParmValue(idx, value); }
165  void setParmValue(exint idx, const fpreal &value)
166  { doSetParmValue(idx, value); }
167  void setParmValue(exint idx, const UT_Vector2D &value)
168  { doSetParmValue(idx, value); }
169  void setParmValue(exint idx, const UT_Vector3D &value)
170  { doSetParmValue(idx, value); }
171  void setParmValue(exint idx, const UT_Vector4D &value)
172  { doSetParmValue(idx, value); }
173  void setParmValue(exint idx, const UT_Matrix2D &value)
174  { doSetParmValue(idx, value); }
175  void setParmValue(exint idx, const UT_Matrix3D &value)
176  { doSetParmValue(idx, value); }
177  void setParmValue(exint idx, const UT_Matrix4D &value)
178  { doSetParmValue(idx, value); }
180  { doSetParmValue(idx, value); }
182  { doSetParmValue(idx, value); }
184  { doSetParmValue(idx, value); }
185 
186  virtual exint getNumParms() const
187  {
188  return 5;
189  }
190 
191  virtual const char *getParmName(exint fieldnum) const
192  {
193  switch (fieldnum)
194  {
195  case 0:
196  return "group";
197  case 1:
198  return "tilesize";
199  case 2:
200  return "viewportlod";
201  case 3:
202  return "path";
203  case 4:
204  return "pivot";
205 
206  }
207  return 0;
208  }
209 
210  virtual ParmType getParmType(exint fieldnum) const
211  {
212  switch (fieldnum)
213  {
214  case 0:
215  return PARM_STRING;
216  case 1:
217  return PARM_FLOAT;
218  case 2:
219  return PARM_STRING;
220  case 3:
221  return PARM_STRING;
222  case 4:
223  return PARM_INTEGER;
224 
225  }
226  return PARM_UNSUPPORTED;
227  }
228 
229  // Boiler plate to load individual types.
230  static void loadData(UT_IStream &is, int64 &v)
231  { is.bread(&v, 1); }
232  static void loadData(UT_IStream &is, bool &v)
233  { int64 iv; is.bread(&iv, 1); v = iv; }
234  static void loadData(UT_IStream &is, fpreal64 &v)
235  { is.bread<fpreal64>(&v, 1); }
236  static void loadData(UT_IStream &is, UT_Vector2D &v)
237  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
238  static void loadData(UT_IStream &is, UT_Vector3D &v)
239  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
240  is.bread<fpreal64>(&v.z(), 1); }
241  static void loadData(UT_IStream &is, UT_Vector4D &v)
242  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
243  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
244  static void loadData(UT_IStream &is, UT_Matrix2D &v)
245  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
246  static void loadData(UT_IStream &is, UT_Matrix3D &v)
247  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
248  static void loadData(UT_IStream &is, UT_Matrix4D &v)
249  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
250  static void loadData(UT_IStream &is, UT_Vector2I &v)
251  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
252  static void loadData(UT_IStream &is, UT_Vector3I &v)
253  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
254  is.bread<int64>(&v.z(), 1); }
255  static void loadData(UT_IStream &is, UT_Vector4I &v)
256  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
257  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
259  { is.bread(v); }
261  { UT_StringHolder rampdata;
262  loadData(is, rampdata);
263  if (rampdata.isstring())
264  {
265  v.reset(new UT_Ramp());
266  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
267  v->load(istr);
268  }
269  else v.reset();
270  }
273  loadData(is, data);
274  if (data.isstring())
275  {
276  // Find the data type.
277  char *colon = UT_StringWrap(data).findChar(':');
278  if (colon)
279  {
280  int typelen = colon - data.buffer();
282  type.strncpy(data.buffer(), typelen);
283  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
284 
285  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
286  }
287  }
288  else v.reset();
289  }
290 
291  static void saveData(std::ostream &os, int64 v)
292  { UTwrite(os, &v); }
293  static void saveData(std::ostream &os, bool v)
294  { int64 iv = v; UTwrite(os, &iv); }
295  static void saveData(std::ostream &os, fpreal64 v)
296  { UTwrite<fpreal64>(os, &v); }
297  static void saveData(std::ostream &os, UT_Vector2D v)
298  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
299  static void saveData(std::ostream &os, UT_Vector3D v)
300  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
301  UTwrite<fpreal64>(os, &v.z()); }
302  static void saveData(std::ostream &os, UT_Vector4D v)
303  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
304  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
305  static void saveData(std::ostream &os, UT_Matrix2D v)
307  static void saveData(std::ostream &os, UT_Matrix3D v)
309  static void saveData(std::ostream &os, UT_Matrix4D v)
311  static void saveData(std::ostream &os, UT_StringHolder s)
312  { UT_StringWrap(s).saveBinary(os); }
313  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
314  { UT_StringHolder result;
315  UT_OStringStream ostr;
316  if (s) s->save(ostr);
317  result = ostr.str();
318  saveData(os, result);
319  }
320  static void saveData(std::ostream &os, PRM_DataItemHandle s)
321  { UT_StringHolder result;
322  UT_OStringStream ostr;
323  if (s)
324  {
325  ostr << s->getDataTypeToken();
326  ostr << ":";
327  s->saveBinary(ostr);
328  }
329  result = ostr.str();
330  saveData(os, result);
331  }
332 
333 
334  void save(std::ostream &os) const
335  {
336  int32 v = version();
337  UTwrite(os, &v);
338  saveData(os, myGroup);
339  saveData(os, myTileSize);
340  saveData(os, myViewportLOD);
341  saveData(os, myPath);
342  saveData(os, myPivot);
343 
344  }
345 
346  bool load(UT_IStream &is)
347  {
348  int32 v;
349  is.bread(&v, 1);
350  if (version() != v)
351  {
352  // Fail incompatible versions
353  return false;
354  }
355  loadData(is, myGroup);
356  loadData(is, myTileSize);
357  loadData(is, myViewportLOD);
358  loadData(is, myPath);
359  loadData(is, myPivot);
360 
361  return true;
362  }
363 
364  const UT_StringHolder & getGroup() const { return myGroup; }
365  void setGroup(const UT_StringHolder & val) { myGroup = val; }
367  {
368  SOP_Node *thissop = cookparms.getNode();
369  if (!thissop) return getGroup();
370  UT_StringHolder result;
371  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
372  return result;
373  }
374  fpreal64 getTileSize() const { return myTileSize; }
375  void setTileSize(fpreal64 val) { myTileSize = val; }
377  {
378  SOP_Node *thissop = cookparms.getNode();
379  if (!thissop) return getTileSize();
380  fpreal64 result;
381  OP_Utils::evalOpParm(result, thissop, "tilesize", cookparms.getCookTime(), 0);
382  return result;
383  }
384  const UT_StringHolder & getViewportLOD() const { return myViewportLOD; }
385  void setViewportLOD(const UT_StringHolder & val) { myViewportLOD = val; }
387  {
388  SOP_Node *thissop = cookparms.getNode();
389  if (!thissop) return getViewportLOD();
390  UT_StringHolder result;
391  OP_Utils::evalOpParm(result, thissop, "viewportlod", cookparms.getCookTime(), 0);
392  return result;
393  }
394  const UT_StringHolder & getPath() const { return myPath; }
395  void setPath(const UT_StringHolder & val) { myPath = val; }
397  {
398  SOP_Node *thissop = cookparms.getNode();
399  if (!thissop) return getPath();
400  UT_StringHolder result;
401  OP_Utils::evalOpParm(result, thissop, "path", cookparms.getCookTime(), 0);
402  return result;
403  }
404  int64 getPivot() const { return myPivot; }
405  void setPivot(int64 val) { myPivot = val; }
406  int64 opPivot(const SOP_NodeVerb::CookParms &cookparms) const
407  {
408  SOP_Node *thissop = cookparms.getNode();
409  if (!thissop) return getPivot();
410  int64 result;
411  OP_Utils::evalOpParm(result, thissop, "pivot", cookparms.getCookTime(), 0);
412  return result;
413  }
414 
415 private:
416  UT_StringHolder myGroup;
417  fpreal64 myTileSize;
418  UT_StringHolder myViewportLOD;
419  UT_StringHolder myPath;
420  int64 myPivot;
421 
422 };
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:494
void getParmValue(exint idx, UT_StringHolder &value) const
T & z(void)
Definition: UT_Vector4.h:379
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)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
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)
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, UT_Matrix2D v)
T & x(void)
Definition: UT_Vector2.h:285
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:498
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:502
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:107
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
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
int64 exint
Definition: SYS_Types.h:116
void getParmValue(exint idx, UT_Matrix3D &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:192
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
bool operator!=(const SOP_PackPointsParms &src) 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:35
T & y(void)
Definition: UT_Vector4.h:377
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
GT_API const UT_StringHolder version
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:500
const UT_StringHolder & getGroup() const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
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
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:501
static void loadData(UT_IStream &is, UT_Vector4I &v)
T & x(void)
Definition: UT_Vector4.h:375
T & y(void)
Definition: UT_Vector2.h:287
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:381
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
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)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
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)