HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Line.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 namespace SOP_LineEnums
22 {
23  enum class Type
24  {
25  POLY = 0,
26  NURBS,
27  BEZIER,
28  POINTS
29  };
30 }
31 
32 
34 {
35 public:
36  static int version() { return 1; }
37 
39  {
40  myType = 0;
41  myOrigin = UT_Vector3D(0,0,0);
42  myDir = UT_Vector3D(0,1,0);
43  myDist = 1;
44  myPoints = 2;
45  myOrder = 4;
46 
47  }
48 
49  explicit SOP_LineParms(const SOP_LineParms &) = default;
50 
51  virtual ~SOP_LineParms() {}
52 
53  bool operator==(const SOP_LineParms &src) const
54  {
55  if (myType != src.myType) return false;
56  if (myOrigin != src.myOrigin) return false;
57  if (myDir != src.myDir) return false;
58  if (myDist != src.myDist) return false;
59  if (myPoints != src.myPoints) return false;
60  if (myOrder != src.myOrder) return false;
61 
62  return true;
63  }
65 
66 
67 
68  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
69  {
70  if (true)
71  OP_Utils::evalOpParm(myType, node, "type", time, 0);
72  else myType = 0;
73  if (true)
74  OP_Utils::evalOpParm(myOrigin, node, "origin", time, 0);
75  else myOrigin = UT_Vector3D(0,0,0);
76  if (true)
77  OP_Utils::evalOpParm(myDir, node, "dir", time, 0);
78  else myDir = UT_Vector3D(0,1,0);
79  if (true)
80  OP_Utils::evalOpParm(myDist, node, "dist", time, 0);
81  else myDist = 1;
82  if (true)
83  OP_Utils::evalOpParm(myPoints, node, "points", time, 0);
84  else myPoints = 2;
85  if (true && ( (!(((int64(getType())==0))||((int64(getType())==3)))) ) )
86  OP_Utils::evalOpParm(myOrder, node, "order", time, 0);
87  else myOrder = 4;
88 
89  }
90 
91 
92  virtual void loadFromOpSubclass(const LoadParms &loadparms)
93  {
94  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
95  }
96 
97 
98  virtual void copyFrom(const SOP_NodeParms *src)
99  {
100  *this = *((const SOP_LineParms *)src);
101  }
102 
103  template <typename T>
104  void
105  doGetParmValue(exint idx, T &value) const
106  {
107  switch (idx)
108  {
109  case 0:
110  coerceValue(value, myType);
111  break;
112  case 1:
113  coerceValue(value, myOrigin);
114  break;
115  case 2:
116  coerceValue(value, myDir);
117  break;
118  case 3:
119  coerceValue(value, myDist);
120  break;
121  case 4:
122  coerceValue(value, myPoints);
123  break;
124  case 5:
125  coerceValue(value, myOrder);
126  break;
127 
128  }
129  }
130 
131  void getParmValue(exint idx, exint &value) const
132  { doGetParmValue(idx, value); }
133  void getParmValue(exint idx, fpreal &value) const
134  { doGetParmValue(idx, value); }
136  { doGetParmValue(idx, value); }
138  { doGetParmValue(idx, value); }
140  { doGetParmValue(idx, value); }
142  { doGetParmValue(idx, value); }
144  { doGetParmValue(idx, value); }
146  { doGetParmValue(idx, value); }
148  { doGetParmValue(idx, value); }
150  { doGetParmValue(idx, value); }
152  { doGetParmValue(idx, value); }
153 
154  template <typename T>
155  void
156  doSetParmValue(exint idx, const T &value)
157  {
158  switch (idx)
159  {
160  case 0:
161  coerceValue(myType, value);
162  break;
163  case 1:
164  coerceValue(myOrigin, value);
165  break;
166  case 2:
167  coerceValue(myDir, value);
168  break;
169  case 3:
170  coerceValue(myDist, value);
171  break;
172  case 4:
173  coerceValue(myPoints, value);
174  break;
175  case 5:
176  coerceValue(myOrder, value);
177  break;
178 
179  }
180  }
181 
182  void setParmValue(exint idx, const exint &value)
183  { doSetParmValue(idx, value); }
184  void setParmValue(exint idx, const fpreal &value)
185  { doSetParmValue(idx, value); }
186  void setParmValue(exint idx, const UT_Vector2D &value)
187  { doSetParmValue(idx, value); }
188  void setParmValue(exint idx, const UT_Vector3D &value)
189  { doSetParmValue(idx, value); }
190  void setParmValue(exint idx, const UT_Vector4D &value)
191  { doSetParmValue(idx, value); }
192  void setParmValue(exint idx, const UT_Matrix2D &value)
193  { doSetParmValue(idx, value); }
194  void setParmValue(exint idx, const UT_Matrix3D &value)
195  { doSetParmValue(idx, value); }
196  void setParmValue(exint idx, const UT_Matrix4D &value)
197  { doSetParmValue(idx, value); }
199  { doSetParmValue(idx, value); }
201  { doSetParmValue(idx, value); }
203  { doSetParmValue(idx, value); }
204 
205  virtual exint getNumParms() const
206  {
207  return 6;
208  }
209 
210  virtual const char *getParmName(exint fieldnum) const
211  {
212  switch (fieldnum)
213  {
214  case 0:
215  return "type";
216  case 1:
217  return "origin";
218  case 2:
219  return "dir";
220  case 3:
221  return "dist";
222  case 4:
223  return "points";
224  case 5:
225  return "order";
226 
227  }
228  return 0;
229  }
230 
231  virtual ParmType getParmType(exint fieldnum) const
232  {
233  switch (fieldnum)
234  {
235  case 0:
236  return PARM_INTEGER;
237  case 1:
238  return PARM_VECTOR3;
239  case 2:
240  return PARM_VECTOR3;
241  case 3:
242  return PARM_FLOAT;
243  case 4:
244  return PARM_INTEGER;
245  case 5:
246  return PARM_INTEGER;
247 
248  }
249  return PARM_UNSUPPORTED;
250  }
251 
252  // Boiler plate to load individual types.
253  static void loadData(UT_IStream &is, int64 &v)
254  { is.bread(&v, 1); }
255  static void loadData(UT_IStream &is, bool &v)
256  { int64 iv; is.bread(&iv, 1); v = iv; }
257  static void loadData(UT_IStream &is, fpreal64 &v)
258  { is.bread<fpreal64>(&v, 1); }
259  static void loadData(UT_IStream &is, UT_Vector2D &v)
260  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
261  static void loadData(UT_IStream &is, UT_Vector3D &v)
262  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
263  is.bread<fpreal64>(&v.z(), 1); }
264  static void loadData(UT_IStream &is, UT_Vector4D &v)
265  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
266  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
267  static void loadData(UT_IStream &is, UT_Matrix2D &v)
268  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
269  static void loadData(UT_IStream &is, UT_Matrix3D &v)
270  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
271  static void loadData(UT_IStream &is, UT_Matrix4D &v)
272  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
273  static void loadData(UT_IStream &is, UT_Vector2I &v)
274  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
275  static void loadData(UT_IStream &is, UT_Vector3I &v)
276  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
277  is.bread<int64>(&v.z(), 1); }
278  static void loadData(UT_IStream &is, UT_Vector4I &v)
279  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
280  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
282  { is.bread(v); }
284  { UT_StringHolder rampdata;
285  loadData(is, rampdata);
286  if (rampdata.isstring())
287  {
288  v.reset(new UT_Ramp());
289  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
290  v->load(istr);
291  }
292  else v.reset();
293  }
296  loadData(is, data);
297  if (data.isstring())
298  {
299  // Find the data type.
300  char *colon = UT_StringWrap(data).findChar(':');
301  if (colon)
302  {
303  int typelen = colon - data.buffer();
305  type.strncpy(data.buffer(), typelen);
306  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
307 
308  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
309  }
310  }
311  else v.reset();
312  }
313 
314  static void saveData(std::ostream &os, int64 v)
315  { UTwrite(os, &v); }
316  static void saveData(std::ostream &os, bool v)
317  { int64 iv = v; UTwrite(os, &iv); }
318  static void saveData(std::ostream &os, fpreal64 v)
319  { UTwrite<fpreal64>(os, &v); }
320  static void saveData(std::ostream &os, UT_Vector2D v)
321  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
322  static void saveData(std::ostream &os, UT_Vector3D v)
323  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
324  UTwrite<fpreal64>(os, &v.z()); }
325  static void saveData(std::ostream &os, UT_Vector4D v)
326  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
327  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
328  static void saveData(std::ostream &os, UT_Matrix2D v)
330  static void saveData(std::ostream &os, UT_Matrix3D v)
332  static void saveData(std::ostream &os, UT_Matrix4D v)
334  static void saveData(std::ostream &os, UT_StringHolder s)
335  { UT_StringWrap(s).saveBinary(os); }
336  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
337  { UT_StringHolder result;
338  UT_OStringStream ostr;
339  if (s) s->save(ostr);
340  result = ostr.str();
341  saveData(os, result);
342  }
343  static void saveData(std::ostream &os, PRM_DataItemHandle s)
344  { UT_StringHolder result;
345  UT_OStringStream ostr;
346  if (s)
347  {
348  ostr << s->getDataTypeToken();
349  ostr << ":";
350  s->saveBinary(ostr);
351  }
352  result = ostr.str();
353  saveData(os, result);
354  }
355 
356 
357  void save(std::ostream &os) const
358  {
359  int32 v = version();
360  UTwrite(os, &v);
361  saveData(os, myType);
362  saveData(os, myOrigin);
363  saveData(os, myDir);
364  saveData(os, myDist);
365  saveData(os, myPoints);
366  saveData(os, myOrder);
367 
368  }
369 
370  bool load(UT_IStream &is)
371  {
372  int32 v;
373  is.bread(&v, 1);
374  if (version() != v)
375  {
376  // Fail incompatible versions
377  return false;
378  }
379  loadData(is, myType);
380  loadData(is, myOrigin);
381  loadData(is, myDir);
382  loadData(is, myDist);
383  loadData(is, myPoints);
384  loadData(is, myOrder);
385 
386  return true;
387  }
388 
389  Type getType() const { return Type(myType); }
390  void setType(Type val) { myType = int64(val); }
391  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
392  {
393  SOP_Node *thissop = cookparms.getNode();
394  if (!thissop) return getType();
395  int64 result;
396  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
397  return Type(result);
398  }
399  UT_Vector3D getOrigin() const { return myOrigin; }
400  void setOrigin(UT_Vector3D val) { myOrigin = val; }
402  {
403  SOP_Node *thissop = cookparms.getNode();
404  if (!thissop) return getOrigin();
405  UT_Vector3D result;
406  OP_Utils::evalOpParm(result, thissop, "origin", cookparms.getCookTime(), 0);
407  return result;
408  }
409  UT_Vector3D getDir() const { return myDir; }
410  void setDir(UT_Vector3D val) { myDir = val; }
411  UT_Vector3D opDir(const SOP_NodeVerb::CookParms &cookparms) const
412  {
413  SOP_Node *thissop = cookparms.getNode();
414  if (!thissop) return getDir();
415  UT_Vector3D result;
416  OP_Utils::evalOpParm(result, thissop, "dir", cookparms.getCookTime(), 0);
417  return result;
418  }
419  fpreal64 getDist() const { return myDist; }
420  void setDist(fpreal64 val) { myDist = val; }
421  fpreal64 opDist(const SOP_NodeVerb::CookParms &cookparms) const
422  {
423  SOP_Node *thissop = cookparms.getNode();
424  if (!thissop) return getDist();
425  fpreal64 result;
426  OP_Utils::evalOpParm(result, thissop, "dist", cookparms.getCookTime(), 0);
427  return result;
428  }
429  int64 getPoints() const { return myPoints; }
430  void setPoints(int64 val) { myPoints = val; }
431  int64 opPoints(const SOP_NodeVerb::CookParms &cookparms) const
432  {
433  SOP_Node *thissop = cookparms.getNode();
434  if (!thissop) return getPoints();
435  int64 result;
436  OP_Utils::evalOpParm(result, thissop, "points", cookparms.getCookTime(), 0);
437  return result;
438  }
439  int64 getOrder() const { return myOrder; }
440  void setOrder(int64 val) { myOrder = val; }
441  int64 opOrder(const SOP_NodeVerb::CookParms &cookparms) const
442  {
443  SOP_Node *thissop = cookparms.getNode();
444  if (!thissop) return getOrder();
445  int64 result;
446  OP_Utils::evalOpParm(result, thissop, "order", cookparms.getCookTime(), 0);
447  return result;
448  }
449 
450 private:
451  int64 myType;
452  UT_Vector3D myOrigin;
453  UT_Vector3D myDir;
454  fpreal64 myDist;
455  int64 myPoints;
456  int64 myOrder;
457 
458 };
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void loadData(UT_IStream &is, fpreal64 &v)
fpreal64 opDist(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, fpreal64 v)
int64 getPoints() const
void setParmValue(exint idx, const fpreal &value)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
static void loadData(UT_IStream &is, UT_StringHolder &v)
T & z(void)
Definition: UT_Vector4.h:372
virtual const char * getParmName(exint fieldnum) const
int myOrder
Definition: GT_CurveEval.h:263
void setParmValue(exint idx, const UT_Matrix4D &value)
UT_Vector3D opDir(const SOP_NodeVerb::CookParms &cookparms) const
int64 getOrder() const
exint bread(int32 *buffer, exint asize=1)
void getParmValue(exint idx, fpreal &value) const
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void getParmValue(exint idx, UT_StringHolder &value) const
void doGetParmValue(exint idx, T &value) const
T & x(void)
Definition: UT_Vector2.h:284
static void loadData(UT_IStream &is, UT_Vector2D &v)
An output stream object that owns its own string buffer storage.
void setParmValue(exint idx, const UT_Vector3D &value)
static void saveData(std::ostream &os, UT_Vector3D v)
void doSetParmValue(exint idx, const T &value)
void setParmValue(exint idx, const UT_Vector4D &value)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
UT_Vector3D getDir() const
void setType(Type val)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
void setOrigin(UT_Vector3D val)
void getParmValue(exint idx, UT_Matrix3D &value) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
int64 opOrder(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void getParmValue(exint idx, UT_Matrix4D &value) const
static void saveData(std::ostream &os, bool v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
void setParmValue(exint idx, const UT_StringHolder &value)
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, bool &v)
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, UT_Vector3D &v)
int64 exint
Definition: SYS_Types.h:109
void getParmValue(exint idx, PRM_DataItemHandle &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:185
virtual ~SOP_LineParms()
void getParmValue(exint idx, UT_Vector4D &value) const
static void saveData(std::ostream &os, UT_Vector2D v)
void getParmValue(exint idx, UT_Vector3D &value) const
virtual ParmType getParmType(exint fieldnum) const
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
virtual exint getNumParms() const
UT_Vector3T< fpreal64 > UT_Vector3D
static void saveData(std::ostream &os, UT_Matrix4D v)
GLboolean * data
Definition: glcorearb.h:130
Type getType() const
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
void setDist(fpreal64 val)
bool load(UT_IStream &is)
void setParmValue(exint idx, const UT_Matrix3D &value)
virtual void copyFrom(const SOP_NodeParms *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void getParmValue(exint idx, UT_Vector2D &value) const
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
fpreal64 getDist() const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
void strncpy(const char *src, exint maxlen)
void setOrder(int64 val)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setParmValue(exint idx, const UT_Matrix2D &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector3D opOrigin(const SOP_NodeVerb::CookParms &cookparms) const
void setPoints(int64 val)
int64 opPoints(const SOP_NodeVerb::CookParms &cookparms) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, UT_StringHolder s)
void setDir(UT_Vector3D val)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
T & x(void)
Definition: UT_Vector4.h:368
void getParmValue(exint idx, exint &value) const
void getParmValue(exint idx, UT_Matrix2D &value) const
bool operator==(const SOP_LineParms &src) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
T & y(void)
Definition: UT_Vector2.h:286
static void saveData(std::ostream &os, int64 v)
void save(std::ostream &os) const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
GLboolean r
Definition: glcorearb.h:1221
void setParmValue(exint idx, const exint &value)
void setParmValue(exint idx, const UT_Vector2D &value)
UT_Vector3D getOrigin() const
T & w(void)
Definition: UT_Vector4.h:374
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
static int version()
static void saveData(std::ostream &os, UT_Matrix2D v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
static void loadData(UT_IStream &is, UT_Vector4I &v)
SYS_FORCE_INLINE bool isstring() const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
GLenum src
Definition: glcorearb.h:1792