HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_VertexSplit.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  myAttribname = ""_sh;
31  myTol = 0.001;
32  myPromote = false;
33 
34  }
35 
36  explicit SOP_VertexSplitParms(const SOP_VertexSplitParms &) = default;
37 
38  virtual ~SOP_VertexSplitParms() {}
39 
40  bool operator==(const SOP_VertexSplitParms &src) const
41  {
42  if (myGroup != src.myGroup) return false;
43  if (myAttribname != src.myAttribname) return false;
44  if (myTol != src.myTol) return false;
45  if (myPromote != src.myPromote) return false;
46 
47  return true;
48  }
49 
50 
51 
52  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
53  {
54  if (true)
55  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
56  else myGroup = ""_sh;
57  if (true)
58  OP_Utils::evalOpParm(myAttribname, node, "attribname", time, 0);
59  else myAttribname = ""_sh;
60  if (true)
61  OP_Utils::evalOpParm(myTol, node, "tol", time, 0);
62  else myTol = 0.001;
63  if (true)
64  OP_Utils::evalOpParm(myPromote, node, "promote", time, 0);
65  else myPromote = false;
66 
67  }
68 
69 
70  virtual void loadFromOpSubclass(const LoadParms &loadparms)
71  {
72  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
73  }
74 
75 
76  virtual void copyFrom(const SOP_NodeParms *src)
77  {
78  *this = *((const SOP_VertexSplitParms *)src);
79  }
80 
81  template <typename T>
82  void
83  doGetParmValue(exint idx, T &value) const
84  {
85  switch (idx)
86  {
87  case 0:
88  coerceValue(value, myGroup);
89  break;
90  case 1:
91  coerceValue(value, myAttribname);
92  break;
93  case 2:
94  coerceValue(value, myTol);
95  break;
96  case 3:
97  coerceValue(value, myPromote);
98  break;
99 
100  }
101  }
102 
103  void getParmValue(exint idx, exint &value) const
104  { doGetParmValue(idx, value); }
105  void getParmValue(exint idx, fpreal &value) const
106  { doGetParmValue(idx, value); }
108  { doGetParmValue(idx, value); }
110  { doGetParmValue(idx, value); }
112  { doGetParmValue(idx, value); }
114  { doGetParmValue(idx, value); }
116  { doGetParmValue(idx, value); }
118  { doGetParmValue(idx, value); }
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
125 
126  template <typename T>
127  void
128  doSetParmValue(exint idx, const T &value)
129  {
130  switch (idx)
131  {
132  case 0:
133  coerceValue(myGroup, value);
134  break;
135  case 1:
136  coerceValue(myAttribname, value);
137  break;
138  case 2:
139  coerceValue(myTol, value);
140  break;
141  case 3:
142  coerceValue(myPromote, value);
143  break;
144 
145  }
146  }
147 
148  void setParmValue(exint idx, const exint &value)
149  { doSetParmValue(idx, value); }
150  void setParmValue(exint idx, const fpreal &value)
151  { doSetParmValue(idx, value); }
152  void setParmValue(exint idx, const UT_Vector2D &value)
153  { doSetParmValue(idx, value); }
154  void setParmValue(exint idx, const UT_Vector3D &value)
155  { doSetParmValue(idx, value); }
156  void setParmValue(exint idx, const UT_Vector4D &value)
157  { doSetParmValue(idx, value); }
158  void setParmValue(exint idx, const UT_Matrix2D &value)
159  { doSetParmValue(idx, value); }
160  void setParmValue(exint idx, const UT_Matrix3D &value)
161  { doSetParmValue(idx, value); }
162  void setParmValue(exint idx, const UT_Matrix4D &value)
163  { doSetParmValue(idx, value); }
165  { doSetParmValue(idx, value); }
167  { doSetParmValue(idx, value); }
169  { doSetParmValue(idx, value); }
170 
171  virtual exint getNumParms() const
172  {
173  return 4;
174  }
175 
176  virtual const char *getParmName(exint fieldnum) const
177  {
178  switch (fieldnum)
179  {
180  case 0:
181  return "group";
182  case 1:
183  return "attribname";
184  case 2:
185  return "tol";
186  case 3:
187  return "promote";
188 
189  }
190  return 0;
191  }
192 
193  virtual ParmType getParmType(exint fieldnum) const
194  {
195  switch (fieldnum)
196  {
197  case 0:
198  return PARM_STRING;
199  case 1:
200  return PARM_STRING;
201  case 2:
202  return PARM_FLOAT;
203  case 3:
204  return PARM_INTEGER;
205 
206  }
207  return PARM_UNSUPPORTED;
208  }
209 
210  // Boiler plate to load individual types.
211  static void loadData(UT_IStream &is, int64 &v)
212  { is.bread(&v, 1); }
213  static void loadData(UT_IStream &is, bool &v)
214  { int64 iv; is.bread(&iv, 1); v = iv; }
215  static void loadData(UT_IStream &is, fpreal64 &v)
216  { is.bread<fpreal64>(&v, 1); }
217  static void loadData(UT_IStream &is, UT_Vector2D &v)
218  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
219  static void loadData(UT_IStream &is, UT_Vector3D &v)
220  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
221  is.bread<fpreal64>(&v.z(), 1); }
222  static void loadData(UT_IStream &is, UT_Vector4D &v)
223  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
224  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
225  static void loadData(UT_IStream &is, UT_Matrix2D &v)
226  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
227  static void loadData(UT_IStream &is, UT_Matrix3D &v)
228  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
229  static void loadData(UT_IStream &is, UT_Matrix4D &v)
230  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
231  static void loadData(UT_IStream &is, UT_Vector2I &v)
232  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
233  static void loadData(UT_IStream &is, UT_Vector3I &v)
234  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
235  is.bread<int64>(&v.z(), 1); }
236  static void loadData(UT_IStream &is, UT_Vector4I &v)
237  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
238  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
240  { is.bread(v); }
242  { UT_StringHolder rampdata;
243  loadData(is, rampdata);
244  if (rampdata.isstring())
245  {
246  v.reset(new UT_Ramp());
247  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
248  v->load(istr);
249  }
250  else v.reset();
251  }
254  loadData(is, data);
255  if (data.isstring())
256  {
257  // Find the data type.
258  char *colon = UT_StringWrap(data).findChar(':');
259  if (colon)
260  {
261  int typelen = colon - data.buffer();
263  type.strncpy(data.buffer(), typelen);
264  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
265 
266  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
267  }
268  }
269  else v.reset();
270  }
271 
272  static void saveData(std::ostream &os, int64 v)
273  { UTwrite(os, &v); }
274  static void saveData(std::ostream &os, bool v)
275  { int64 iv = v; UTwrite(os, &iv); }
276  static void saveData(std::ostream &os, fpreal64 v)
277  { UTwrite<fpreal64>(os, &v); }
278  static void saveData(std::ostream &os, UT_Vector2D v)
279  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
280  static void saveData(std::ostream &os, UT_Vector3D v)
281  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
282  UTwrite<fpreal64>(os, &v.z()); }
283  static void saveData(std::ostream &os, UT_Vector4D v)
284  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
285  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
286  static void saveData(std::ostream &os, UT_Matrix2D v)
288  static void saveData(std::ostream &os, UT_Matrix3D v)
290  static void saveData(std::ostream &os, UT_Matrix4D v)
292  static void saveData(std::ostream &os, UT_StringHolder s)
293  { UT_StringWrap(s).saveBinary(os); }
294  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
295  { UT_StringHolder result;
296  UT_OStringStream ostr;
297  if (s) s->save(ostr);
298  result = ostr.str();
299  saveData(os, result);
300  }
301  static void saveData(std::ostream &os, PRM_DataItemHandle s)
302  { UT_StringHolder result;
303  UT_OStringStream ostr;
304  if (s)
305  {
306  ostr << s->getDataTypeToken();
307  ostr << ":";
308  s->saveBinary(ostr);
309  }
310  result = ostr.str();
311  saveData(os, result);
312  }
313 
314 
315  void save(std::ostream &os) const
316  {
317  int32 v = version();
318  UTwrite(os, &v);
319  saveData(os, myGroup);
320  saveData(os, myAttribname);
321  saveData(os, myTol);
322  saveData(os, myPromote);
323 
324  }
325 
326  bool load(UT_IStream &is)
327  {
328  int32 v;
329  is.bread(&v, 1);
330  if (version() != v)
331  {
332  // Fail incompatible versions
333  return false;
334  }
335  loadData(is, myGroup);
336  loadData(is, myAttribname);
337  loadData(is, myTol);
338  loadData(is, myPromote);
339 
340  return true;
341  }
342 
343  const UT_StringHolder & getGroup() const { return myGroup; }
344  void setGroup(const UT_StringHolder & val) { myGroup = val; }
346  {
347  SOP_Node *thissop = cookparms.getNode();
348  if (!thissop) return getGroup();
349  UT_StringHolder result;
350  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
351  return result;
352  }
353  const UT_StringHolder & getAttribname() const { return myAttribname; }
354  void setAttribname(const UT_StringHolder & val) { myAttribname = val; }
356  {
357  SOP_Node *thissop = cookparms.getNode();
358  if (!thissop) return getAttribname();
359  UT_StringHolder result;
360  OP_Utils::evalOpParm(result, thissop, "attribname", cookparms.getCookTime(), 0);
361  return result;
362  }
363  fpreal64 getTol() const { return myTol; }
364  void setTol(fpreal64 val) { myTol = val; }
365  fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
366  {
367  SOP_Node *thissop = cookparms.getNode();
368  if (!thissop) return getTol();
369  fpreal64 result;
370  OP_Utils::evalOpParm(result, thissop, "tol", cookparms.getCookTime(), 0);
371  return result;
372  }
373  bool getPromote() const { return myPromote; }
374  void setPromote(bool val) { myPromote = val; }
375  bool opPromote(const SOP_NodeVerb::CookParms &cookparms) const
376  {
377  SOP_Node *thissop = cookparms.getNode();
378  if (!thissop) return getPromote();
379  bool result;
380  OP_Utils::evalOpParm(result, thissop, "promote", cookparms.getCookTime(), 0);
381  return result;
382  }
383 
384 private:
385  UT_StringHolder myGroup;
386  UT_StringHolder myAttribname;
387  fpreal64 myTol;
388  bool myPromote;
389 
390 };
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setParmValue(exint idx, const UT_StringHolder &value)
void setTol(fpreal64 val)
void setParmValue(exint idx, const UT_Matrix2D &value)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
static void saveData(std::ostream &os, PRM_DataItemHandle s)
T & z(void)
Definition: UT_Vector4.h:372
void setParmValue(exint idx, const fpreal &value)
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void getParmValue(exint idx, UT_Vector4D &value) const
exint bread(int32 *buffer, exint asize=1)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void setParmValue(exint idx, const UT_Vector3D &value)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
const UT_StringHolder & getAttribname() const
T & x(void)
Definition: UT_Vector2.h:284
static void saveData(std::ostream &os, fpreal64 v)
void setParmValue(exint idx, const UT_Matrix4D &value)
static void saveData(std::ostream &os, UT_Vector3D v)
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getParmValue(exint idx, UT_Matrix2D &value) const
void setParmValue(exint idx, const UT_Matrix3D &value)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
static void loadData(UT_IStream &is, bool &v)
void save(std::ostream &os) const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
virtual ParmType getParmType(exint fieldnum) const
void getParmValue(exint idx, UT_Matrix4D &value) const
void doSetParmValue(exint idx, const T &value)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool operator==(const SOP_VertexSplitParms &src) const
long long int64
Definition: SYS_Types.h:100
virtual exint getNumParms() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:109
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:185
void setParmValue(exint idx, const UT_Vector4D &value)
static void saveData(std::ostream &os, UT_Vector2D v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setParmValue(exint idx, const exint &value)
virtual void copyFrom(const SOP_NodeParms *src)
static void saveData(std::ostream &os, UT_StringHolder s)
GLboolean * data
Definition: glcorearb.h:130
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_Vector2D &v)
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void getParmValue(exint idx, UT_StringHolder &value) const
void getParmValue(exint idx, UT_Vector2D &value) const
const UT_StringHolder & getGroup() const
bool opPromote(const SOP_NodeVerb::CookParms &cookparms) 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 doGetParmValue(exint idx, T &value) const
static void saveData(std::ostream &os, bool v)
static void saveData(std::ostream &os, UT_Matrix2D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
const char * buffer() const
void setAttribname(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Vector4D v)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
void getParmValue(exint idx, UT_Matrix3D &value) const
bool load(UT_IStream &is)
T & x(void)
Definition: UT_Vector4.h:368
static void saveData(std::ostream &os, UT_Matrix4D v)
void setParmValue(exint idx, const UT_Vector2D &value)
void getParmValue(exint idx, UT_Vector3D &value) const
T & y(void)
Definition: UT_Vector2.h:286
void setParmValue(exint idx, const PRM_DataItemHandle &value)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
GLboolean r
Definition: glcorearb.h:1221
static void loadData(UT_IStream &is, UT_StringHolder &v)
T & w(void)
Definition: UT_Vector4.h:374
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Matrix3D v)
void getParmValue(exint idx, exint &value) const
void getParmValue(exint idx, fpreal &value) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
virtual const char * getParmName(exint fieldnum) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
UT_StringHolder opAttribname(const SOP_NodeVerb::CookParms &cookparms) const
GLenum src
Definition: glcorearb.h:1792