HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  }
64  bool operator!=(const SOP_LineParms &src) const
65  {
66  return !operator==(src);
67  }
69 
70 
71 
72  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
73  {
74  if (true)
75  OP_Utils::evalOpParm(myType, node, "type", time, 0);
76  else myType = 0;
77  if (true)
78  OP_Utils::evalOpParm(myOrigin, node, "origin", time, 0);
79  else myOrigin = UT_Vector3D(0,0,0);
80  if (true)
81  OP_Utils::evalOpParm(myDir, node, "dir", time, 0);
82  else myDir = UT_Vector3D(0,1,0);
83  if (true)
84  OP_Utils::evalOpParm(myDist, node, "dist", time, 0);
85  else myDist = 1;
86  if (true)
87  OP_Utils::evalOpParm(myPoints, node, "points", time, 0);
88  else myPoints = 2;
89  if (true && ( (!(((int64(getType())==0))||((int64(getType())==3)))) ) )
90  OP_Utils::evalOpParm(myOrder, node, "order", time, 0);
91  else myOrder = 4;
92 
93  }
94 
95 
96  virtual void loadFromOpSubclass(const LoadParms &loadparms)
97  {
98  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
99  }
100 
101 
102  virtual void copyFrom(const SOP_NodeParms *src)
103  {
104  *this = *((const SOP_LineParms *)src);
105  }
106 
107  template <typename T>
108  void
109  doGetParmValue(exint idx, T &value) const
110  {
111  switch (idx)
112  {
113  case 0:
114  coerceValue(value, myType);
115  break;
116  case 1:
117  coerceValue(value, myOrigin);
118  break;
119  case 2:
120  coerceValue(value, myDir);
121  break;
122  case 3:
123  coerceValue(value, myDist);
124  break;
125  case 4:
126  coerceValue(value, myPoints);
127  break;
128  case 5:
129  coerceValue(value, myOrder);
130  break;
131 
132  }
133  }
134 
135  void getParmValue(exint idx, exint &value) const
136  { doGetParmValue(idx, value); }
137  void getParmValue(exint idx, fpreal &value) const
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); }
154  { doGetParmValue(idx, value); }
156  { doGetParmValue(idx, value); }
157 
158  template <typename T>
159  void
160  doSetParmValue(exint idx, const T &value)
161  {
162  switch (idx)
163  {
164  case 0:
165  coerceValue(myType, value);
166  break;
167  case 1:
168  coerceValue(myOrigin, value);
169  break;
170  case 2:
171  coerceValue(myDir, value);
172  break;
173  case 3:
174  coerceValue(myDist, value);
175  break;
176  case 4:
177  coerceValue(myPoints, value);
178  break;
179  case 5:
180  coerceValue(myOrder, value);
181  break;
182 
183  }
184  }
185 
186  void setParmValue(exint idx, const exint &value)
187  { doSetParmValue(idx, value); }
188  void setParmValue(exint idx, const fpreal &value)
189  { doSetParmValue(idx, value); }
190  void setParmValue(exint idx, const UT_Vector2D &value)
191  { doSetParmValue(idx, value); }
192  void setParmValue(exint idx, const UT_Vector3D &value)
193  { doSetParmValue(idx, value); }
194  void setParmValue(exint idx, const UT_Vector4D &value)
195  { doSetParmValue(idx, value); }
196  void setParmValue(exint idx, const UT_Matrix2D &value)
197  { doSetParmValue(idx, value); }
198  void setParmValue(exint idx, const UT_Matrix3D &value)
199  { doSetParmValue(idx, value); }
200  void setParmValue(exint idx, const UT_Matrix4D &value)
201  { doSetParmValue(idx, value); }
203  { doSetParmValue(idx, value); }
205  { doSetParmValue(idx, value); }
207  { doSetParmValue(idx, value); }
208 
209  virtual exint getNumParms() const
210  {
211  return 6;
212  }
213 
214  virtual const char *getParmName(exint fieldnum) const
215  {
216  switch (fieldnum)
217  {
218  case 0:
219  return "type";
220  case 1:
221  return "origin";
222  case 2:
223  return "dir";
224  case 3:
225  return "dist";
226  case 4:
227  return "points";
228  case 5:
229  return "order";
230 
231  }
232  return 0;
233  }
234 
235  virtual ParmType getParmType(exint fieldnum) const
236  {
237  switch (fieldnum)
238  {
239  case 0:
240  return PARM_INTEGER;
241  case 1:
242  return PARM_VECTOR3;
243  case 2:
244  return PARM_VECTOR3;
245  case 3:
246  return PARM_FLOAT;
247  case 4:
248  return PARM_INTEGER;
249  case 5:
250  return PARM_INTEGER;
251 
252  }
253  return PARM_UNSUPPORTED;
254  }
255 
256  // Boiler plate to load individual types.
257  static void loadData(UT_IStream &is, int64 &v)
258  { is.bread(&v, 1); }
259  static void loadData(UT_IStream &is, bool &v)
260  { int64 iv; is.bread(&iv, 1); v = iv; }
261  static void loadData(UT_IStream &is, fpreal64 &v)
262  { is.bread<fpreal64>(&v, 1); }
263  static void loadData(UT_IStream &is, UT_Vector2D &v)
264  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
265  static void loadData(UT_IStream &is, UT_Vector3D &v)
266  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
267  is.bread<fpreal64>(&v.z(), 1); }
268  static void loadData(UT_IStream &is, UT_Vector4D &v)
269  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
270  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
271  static void loadData(UT_IStream &is, UT_Matrix2D &v)
272  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
273  static void loadData(UT_IStream &is, UT_Matrix3D &v)
274  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
275  static void loadData(UT_IStream &is, UT_Matrix4D &v)
276  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
277  static void loadData(UT_IStream &is, UT_Vector2I &v)
278  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
279  static void loadData(UT_IStream &is, UT_Vector3I &v)
280  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
281  is.bread<int64>(&v.z(), 1); }
282  static void loadData(UT_IStream &is, UT_Vector4I &v)
283  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
284  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
286  { is.bread(v); }
288  { UT_StringHolder rampdata;
289  loadData(is, rampdata);
290  if (rampdata.isstring())
291  {
292  v.reset(new UT_Ramp());
293  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
294  v->load(istr);
295  }
296  else v.reset();
297  }
300  loadData(is, data);
301  if (data.isstring())
302  {
303  // Find the data type.
304  char *colon = UT_StringWrap(data).findChar(':');
305  if (colon)
306  {
307  int typelen = colon - data.buffer();
309  type.strncpy(data.buffer(), typelen);
310  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
311 
312  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
313  }
314  }
315  else v.reset();
316  }
317 
318  static void saveData(std::ostream &os, int64 v)
319  { UTwrite(os, &v); }
320  static void saveData(std::ostream &os, bool v)
321  { int64 iv = v; UTwrite(os, &iv); }
322  static void saveData(std::ostream &os, fpreal64 v)
323  { UTwrite<fpreal64>(os, &v); }
324  static void saveData(std::ostream &os, UT_Vector2D v)
325  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
326  static void saveData(std::ostream &os, UT_Vector3D v)
327  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
328  UTwrite<fpreal64>(os, &v.z()); }
329  static void saveData(std::ostream &os, UT_Vector4D v)
330  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
331  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
332  static void saveData(std::ostream &os, UT_Matrix2D v)
334  static void saveData(std::ostream &os, UT_Matrix3D v)
336  static void saveData(std::ostream &os, UT_Matrix4D v)
338  static void saveData(std::ostream &os, UT_StringHolder s)
339  { UT_StringWrap(s).saveBinary(os); }
340  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
341  { UT_StringHolder result;
342  UT_OStringStream ostr;
343  if (s) s->save(ostr);
344  result = ostr.str();
345  saveData(os, result);
346  }
347  static void saveData(std::ostream &os, PRM_DataItemHandle s)
348  { UT_StringHolder result;
349  UT_OStringStream ostr;
350  if (s)
351  {
352  ostr << s->getDataTypeToken();
353  ostr << ":";
354  s->saveBinary(ostr);
355  }
356  result = ostr.str();
357  saveData(os, result);
358  }
359 
360 
361  void save(std::ostream &os) const
362  {
363  int32 v = version();
364  UTwrite(os, &v);
365  saveData(os, myType);
366  saveData(os, myOrigin);
367  saveData(os, myDir);
368  saveData(os, myDist);
369  saveData(os, myPoints);
370  saveData(os, myOrder);
371 
372  }
373 
374  bool load(UT_IStream &is)
375  {
376  int32 v;
377  is.bread(&v, 1);
378  if (version() != v)
379  {
380  // Fail incompatible versions
381  return false;
382  }
383  loadData(is, myType);
384  loadData(is, myOrigin);
385  loadData(is, myDir);
386  loadData(is, myDist);
387  loadData(is, myPoints);
388  loadData(is, myOrder);
389 
390  return true;
391  }
392 
393  Type getType() const { return Type(myType); }
394  void setType(Type val) { myType = int64(val); }
395  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
396  {
397  SOP_Node *thissop = cookparms.getNode();
398  if (!thissop) return getType();
399  int64 result;
400  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
401  return Type(result);
402  }
403  UT_Vector3D getOrigin() const { return myOrigin; }
404  void setOrigin(UT_Vector3D val) { myOrigin = val; }
406  {
407  SOP_Node *thissop = cookparms.getNode();
408  if (!thissop) return getOrigin();
409  UT_Vector3D result;
410  OP_Utils::evalOpParm(result, thissop, "origin", cookparms.getCookTime(), 0);
411  return result;
412  }
413  UT_Vector3D getDir() const { return myDir; }
414  void setDir(UT_Vector3D val) { myDir = val; }
415  UT_Vector3D opDir(const SOP_NodeVerb::CookParms &cookparms) const
416  {
417  SOP_Node *thissop = cookparms.getNode();
418  if (!thissop) return getDir();
419  UT_Vector3D result;
420  OP_Utils::evalOpParm(result, thissop, "dir", cookparms.getCookTime(), 0);
421  return result;
422  }
423  fpreal64 getDist() const { return myDist; }
424  void setDist(fpreal64 val) { myDist = val; }
425  fpreal64 opDist(const SOP_NodeVerb::CookParms &cookparms) const
426  {
427  SOP_Node *thissop = cookparms.getNode();
428  if (!thissop) return getDist();
429  fpreal64 result;
430  OP_Utils::evalOpParm(result, thissop, "dist", cookparms.getCookTime(), 0);
431  return result;
432  }
433  int64 getPoints() const { return myPoints; }
434  void setPoints(int64 val) { myPoints = val; }
435  int64 opPoints(const SOP_NodeVerb::CookParms &cookparms) const
436  {
437  SOP_Node *thissop = cookparms.getNode();
438  if (!thissop) return getPoints();
439  int64 result;
440  OP_Utils::evalOpParm(result, thissop, "points", cookparms.getCookTime(), 0);
441  return result;
442  }
443  int64 getOrder() const { return myOrder; }
444  void setOrder(int64 val) { myOrder = val; }
445  int64 opOrder(const SOP_NodeVerb::CookParms &cookparms) const
446  {
447  SOP_Node *thissop = cookparms.getNode();
448  if (!thissop) return getOrder();
449  int64 result;
450  OP_Utils::evalOpParm(result, thissop, "order", cookparms.getCookTime(), 0);
451  return result;
452  }
453 
454 private:
455  int64 myType;
456  UT_Vector3D myOrigin;
457  UT_Vector3D myDir;
458  fpreal64 myDist;
459  int64 myPoints;
460  int64 myOrder;
461 
462 };
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:494
static void loadData(UT_IStream &is, UT_StringHolder &v)
T & z(void)
Definition: UT_Vector4.h:379
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)
GT_API const UT_StringHolder time
void getParmValue(exint idx, fpreal &value) const
fpreal getTime() const
Definition: OP_Context.h:60
const GLdouble * v
Definition: glcorearb.h:836
void getParmValue(exint idx, UT_StringHolder &value) const
void doGetParmValue(exint idx, T &value) const
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
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:498
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: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 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
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
static void loadData(UT_IStream &is, UT_Vector3D &v)
int64 exint
Definition: SYS_Types.h:116
void getParmValue(exint idx, PRM_DataItemHandle &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:192
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:35
T & y(void)
Definition: UT_Vector4.h:377
void setDist(fpreal64 val)
bool load(UT_IStream &is)
bool operator!=(const SOP_LineParms &src) const
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
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
fpreal64 getDist() const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
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)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:501
T & x(void)
Definition: UT_Vector4.h:375
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:287
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:381
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
static void loadData(UT_IStream &is, UT_Vector4I &v)
SYS_FORCE_INLINE bool isstring() const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1792