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