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