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