HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Connectivity.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_ConnectivityEnums
22 {
23  enum class Connecttype
24  {
25  POINT = 0,
26  PRIM
27  };
28 }
29 
30 
32 {
33 public:
34  static int version() { return 1; }
35 
37  {
38  myConnecttype = 0;
39  myAttribname = "class"_sh;
40  myCreatevarmap = false;
41  myVarname = ""_sh;
42  mySeamgroup = ""_sh;
43  myByuv = false;
44  myUVAttrib = "uv"_sh;
45 
46  }
47 
48  explicit SOP_ConnectivityParms(const SOP_ConnectivityParms &) = default;
49 
51 
53  {
54  if (myConnecttype != src.myConnecttype) return false;
55  if (myAttribname != src.myAttribname) return false;
56  if (myCreatevarmap != src.myCreatevarmap) return false;
57  if (myVarname != src.myVarname) return false;
58  if (mySeamgroup != src.mySeamgroup) return false;
59  if (myByuv != src.myByuv) return false;
60  if (myUVAttrib != src.myUVAttrib) return false;
61 
62  return true;
63  }
65 
66 
67 
68  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
69  {
70  if (true)
71  OP_Utils::evalOpParm(myConnecttype, node, "connecttype", time, 0);
72  else myConnecttype = 0;
73  if (true)
74  OP_Utils::evalOpParm(myAttribname, node, "attribname", time, 0);
75  else myAttribname = "class"_sh;
76  if (true)
77  OP_Utils::evalOpParm(myCreatevarmap, node, "createvarmap", time, 0);
78  else myCreatevarmap = false;
79  if (true && ( (!(((getCreatevarmap()==0)))) ) )
80  OP_Utils::evalOpParm(myVarname, node, "varname", time, 0);
81  else myVarname = ""_sh;
82  if (true && ( (!(((int64(getConnecttype())==0)))) ) )
83  OP_Utils::evalOpParm(mySeamgroup, node, "seamgroup", time, 0);
84  else mySeamgroup = ""_sh;
85  if (true && ( (!(((int64(getConnecttype())==0))||((getSeamgroup()!="")))) ) )
86  OP_Utils::evalOpParm(myByuv, node, "byuv", time, 0);
87  else myByuv = false;
88  if (true && ( (!(((int64(getConnecttype())==0))||((getSeamgroup()!=""))||((getByuv()==0)))) ) )
89  OP_Utils::evalOpParm(myUVAttrib, node, "uvattrib", time, 0);
90  else myUVAttrib = "uv"_sh;
91 
92  }
93 
94 
95  virtual void loadFromOpSubclass(const LoadParms &loadparms)
96  {
97  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
98  }
99 
100 
101  virtual void copyFrom(const SOP_NodeParms *src)
102  {
103  *this = *((const SOP_ConnectivityParms *)src);
104  }
105 
106  template <typename T>
107  void
108  doGetParmValue(exint idx, T &value) const
109  {
110  switch (idx)
111  {
112  case 0:
113  coerceValue(value, myConnecttype);
114  break;
115  case 1:
116  coerceValue(value, myAttribname);
117  break;
118  case 2:
119  coerceValue(value, myCreatevarmap);
120  break;
121  case 3:
122  coerceValue(value, myVarname);
123  break;
124  case 4:
125  coerceValue(value, mySeamgroup);
126  break;
127  case 5:
128  coerceValue(value, myByuv);
129  break;
130  case 6:
131  coerceValue(value, myUVAttrib);
132  break;
133 
134  }
135  }
136 
137  void getParmValue(exint idx, exint &value) const
138  { doGetParmValue(idx, value); }
139  void getParmValue(exint idx, fpreal &value) const
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); }
158  { doGetParmValue(idx, value); }
159 
160  template <typename T>
161  void
162  doSetParmValue(exint idx, const T &value)
163  {
164  switch (idx)
165  {
166  case 0:
167  coerceValue(myConnecttype, value);
168  break;
169  case 1:
170  coerceValue(myAttribname, value);
171  break;
172  case 2:
173  coerceValue(myCreatevarmap, value);
174  break;
175  case 3:
176  coerceValue(myVarname, value);
177  break;
178  case 4:
179  coerceValue(mySeamgroup, value);
180  break;
181  case 5:
182  coerceValue(myByuv, value);
183  break;
184  case 6:
185  coerceValue(myUVAttrib, value);
186  break;
187 
188  }
189  }
190 
191  void setParmValue(exint idx, const exint &value)
192  { doSetParmValue(idx, value); }
193  void setParmValue(exint idx, const fpreal &value)
194  { doSetParmValue(idx, value); }
195  void setParmValue(exint idx, const UT_Vector2D &value)
196  { doSetParmValue(idx, value); }
197  void setParmValue(exint idx, const UT_Vector3D &value)
198  { doSetParmValue(idx, value); }
199  void setParmValue(exint idx, const UT_Vector4D &value)
200  { doSetParmValue(idx, value); }
201  void setParmValue(exint idx, const UT_Matrix2D &value)
202  { doSetParmValue(idx, value); }
203  void setParmValue(exint idx, const UT_Matrix3D &value)
204  { doSetParmValue(idx, value); }
205  void setParmValue(exint idx, const UT_Matrix4D &value)
206  { doSetParmValue(idx, value); }
208  { doSetParmValue(idx, value); }
210  { doSetParmValue(idx, value); }
212  { doSetParmValue(idx, value); }
213 
214  virtual exint getNumParms() const
215  {
216  return 7;
217  }
218 
219  virtual const char *getParmName(exint fieldnum) const
220  {
221  switch (fieldnum)
222  {
223  case 0:
224  return "connecttype";
225  case 1:
226  return "attribname";
227  case 2:
228  return "createvarmap";
229  case 3:
230  return "varname";
231  case 4:
232  return "seamgroup";
233  case 5:
234  return "byuv";
235  case 6:
236  return "uvattrib";
237 
238  }
239  return 0;
240  }
241 
242  virtual ParmType getParmType(exint fieldnum) const
243  {
244  switch (fieldnum)
245  {
246  case 0:
247  return PARM_INTEGER;
248  case 1:
249  return PARM_STRING;
250  case 2:
251  return PARM_INTEGER;
252  case 3:
253  return PARM_STRING;
254  case 4:
255  return PARM_STRING;
256  case 5:
257  return PARM_INTEGER;
258  case 6:
259  return PARM_STRING;
260 
261  }
262  return PARM_UNSUPPORTED;
263  }
264 
265  // Boiler plate to load individual types.
266  static void loadData(UT_IStream &is, int64 &v)
267  { is.bread(&v, 1); }
268  static void loadData(UT_IStream &is, bool &v)
269  { int64 iv; is.bread(&iv, 1); v = iv; }
270  static void loadData(UT_IStream &is, fpreal64 &v)
271  { is.bread<fpreal64>(&v, 1); }
272  static void loadData(UT_IStream &is, UT_Vector2D &v)
273  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
274  static void loadData(UT_IStream &is, UT_Vector3D &v)
275  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
276  is.bread<fpreal64>(&v.z(), 1); }
277  static void loadData(UT_IStream &is, UT_Vector4D &v)
278  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
279  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
280  static void loadData(UT_IStream &is, UT_Matrix2D &v)
281  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
282  static void loadData(UT_IStream &is, UT_Matrix3D &v)
283  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
284  static void loadData(UT_IStream &is, UT_Matrix4D &v)
285  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
286  static void loadData(UT_IStream &is, UT_Vector2I &v)
287  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
288  static void loadData(UT_IStream &is, UT_Vector3I &v)
289  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
290  is.bread<int64>(&v.z(), 1); }
291  static void loadData(UT_IStream &is, UT_Vector4I &v)
292  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
293  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
295  { is.bread(v); }
297  { UT_StringHolder rampdata;
298  loadData(is, rampdata);
299  if (rampdata.isstring())
300  {
301  v.reset(new UT_Ramp());
302  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
303  v->load(istr);
304  }
305  else v.reset();
306  }
309  loadData(is, data);
310  if (data.isstring())
311  {
312  // Find the data type.
313  char *colon = UT_StringWrap(data).findChar(':');
314  if (colon)
315  {
316  int typelen = colon - data.buffer();
318  type.strncpy(data.buffer(), typelen);
319  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
320 
321  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
322  }
323  }
324  else v.reset();
325  }
326 
327  static void saveData(std::ostream &os, int64 v)
328  { UTwrite(os, &v); }
329  static void saveData(std::ostream &os, bool v)
330  { int64 iv = v; UTwrite(os, &iv); }
331  static void saveData(std::ostream &os, fpreal64 v)
332  { UTwrite<fpreal64>(os, &v); }
333  static void saveData(std::ostream &os, UT_Vector2D v)
334  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
335  static void saveData(std::ostream &os, UT_Vector3D v)
336  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
337  UTwrite<fpreal64>(os, &v.z()); }
338  static void saveData(std::ostream &os, UT_Vector4D v)
339  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
340  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
341  static void saveData(std::ostream &os, UT_Matrix2D v)
343  static void saveData(std::ostream &os, UT_Matrix3D v)
345  static void saveData(std::ostream &os, UT_Matrix4D v)
347  static void saveData(std::ostream &os, UT_StringHolder s)
348  { UT_StringWrap(s).saveBinary(os); }
349  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
350  { UT_StringHolder result;
351  UT_OStringStream ostr;
352  if (s) s->save(ostr);
353  result = ostr.str();
354  saveData(os, result);
355  }
356  static void saveData(std::ostream &os, PRM_DataItemHandle s)
357  { UT_StringHolder result;
358  UT_OStringStream ostr;
359  if (s)
360  {
361  ostr << s->getDataTypeToken();
362  ostr << ":";
363  s->saveBinary(ostr);
364  }
365  result = ostr.str();
366  saveData(os, result);
367  }
368 
369 
370  void save(std::ostream &os) const
371  {
372  int32 v = version();
373  UTwrite(os, &v);
374  saveData(os, myConnecttype);
375  saveData(os, myAttribname);
376  saveData(os, myCreatevarmap);
377  saveData(os, myVarname);
378  saveData(os, mySeamgroup);
379  saveData(os, myByuv);
380  saveData(os, myUVAttrib);
381 
382  }
383 
384  bool load(UT_IStream &is)
385  {
386  int32 v;
387  is.bread(&v, 1);
388  if (version() != v)
389  {
390  // Fail incompatible versions
391  return false;
392  }
393  loadData(is, myConnecttype);
394  loadData(is, myAttribname);
395  loadData(is, myCreatevarmap);
396  loadData(is, myVarname);
397  loadData(is, mySeamgroup);
398  loadData(is, myByuv);
399  loadData(is, myUVAttrib);
400 
401  return true;
402  }
403 
404  Connecttype getConnecttype() const { return Connecttype(myConnecttype); }
405  void setConnecttype(Connecttype val) { myConnecttype = int64(val); }
407  {
408  SOP_Node *thissop = cookparms.getNode();
409  if (!thissop) return getConnecttype();
410  int64 result;
411  OP_Utils::evalOpParm(result, thissop, "connecttype", cookparms.getCookTime(), 0);
412  return Connecttype(result);
413  }
414  const UT_StringHolder & getAttribname() const { return myAttribname; }
415  void setAttribname(const UT_StringHolder & val) { myAttribname = val; }
417  {
418  SOP_Node *thissop = cookparms.getNode();
419  if (!thissop) return getAttribname();
420  UT_StringHolder result;
421  OP_Utils::evalOpParm(result, thissop, "attribname", cookparms.getCookTime(), 0);
422  return result;
423  }
424  bool getCreatevarmap() const { return myCreatevarmap; }
425  void setCreatevarmap(bool val) { myCreatevarmap = val; }
426  bool opCreatevarmap(const SOP_NodeVerb::CookParms &cookparms) const
427  {
428  SOP_Node *thissop = cookparms.getNode();
429  if (!thissop) return getCreatevarmap();
430  bool result;
431  OP_Utils::evalOpParm(result, thissop, "createvarmap", cookparms.getCookTime(), 0);
432  return result;
433  }
434  const UT_StringHolder & getVarname() const { return myVarname; }
435  void setVarname(const UT_StringHolder & val) { myVarname = val; }
437  {
438  SOP_Node *thissop = cookparms.getNode();
439  if (!thissop) return getVarname();
440  UT_StringHolder result;
441  OP_Utils::evalOpParm(result, thissop, "varname", cookparms.getCookTime(), 0);
442  return result;
443  }
444  const UT_StringHolder & getSeamgroup() const { return mySeamgroup; }
445  void setSeamgroup(const UT_StringHolder & val) { mySeamgroup = val; }
447  {
448  SOP_Node *thissop = cookparms.getNode();
449  if (!thissop) return getSeamgroup();
450  UT_StringHolder result;
451  OP_Utils::evalOpParm(result, thissop, "seamgroup", cookparms.getCookTime(), 0);
452  return result;
453  }
454  bool getByuv() const { return myByuv; }
455  void setByuv(bool val) { myByuv = val; }
456  bool opByuv(const SOP_NodeVerb::CookParms &cookparms) const
457  {
458  SOP_Node *thissop = cookparms.getNode();
459  if (!thissop) return getByuv();
460  bool result;
461  OP_Utils::evalOpParm(result, thissop, "byuv", cookparms.getCookTime(), 0);
462  return result;
463  }
464  const UT_StringHolder & getUVAttrib() const { return myUVAttrib; }
465  void setUVAttrib(const UT_StringHolder & val) { myUVAttrib = val; }
467  {
468  SOP_Node *thissop = cookparms.getNode();
469  if (!thissop) return getUVAttrib();
470  UT_StringHolder result;
471  OP_Utils::evalOpParm(result, thissop, "uvattrib", cookparms.getCookTime(), 0);
472  return result;
473  }
474 
475 private:
476  int64 myConnecttype;
477  UT_StringHolder myAttribname;
478  bool myCreatevarmap;
479  UT_StringHolder myVarname;
480  UT_StringHolder mySeamgroup;
481  bool myByuv;
482  UT_StringHolder myUVAttrib;
483 
484 };
void getParmValue(exint idx, UT_Matrix3D &value) const
void getParmValue(exint idx, UT_Matrix2D &value) const
const UT_StringHolder & getAttribname() const
void setParmValue(exint idx, const UT_Vector3D &value)
void doSetParmValue(exint idx, const T &value)
void save(std::ostream &os) const
static void saveData(std::ostream &os, UT_Vector2D v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
static void saveData(std::ostream &os, int64 v)
T & z(void)
Definition: UT_Vector4.h:372
bool opCreatevarmap(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const fpreal &value)
static void loadData(UT_IStream &is, UT_Vector3I &v)
virtual const char * getParmName(exint fieldnum) const
virtual exint getNumParms() const
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
exint bread(int32 *buffer, exint asize=1)
void setConnecttype(Connecttype val)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void getParmValue(exint idx, UT_Vector3D &value) const
bool load(UT_IStream &is)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
virtual ParmType getParmType(exint fieldnum) const
T & x(void)
Definition: UT_Vector2.h:284
static void saveData(std::ostream &os, fpreal64 v)
An output stream object that owns its own string buffer storage.
void setParmValue(exint idx, const PRM_DataItemHandle &value)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Vector2D &v)
Connecttype opConnecttype(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_StringHolder &value)
void doGetParmValue(exint idx, T &value) const
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
void setParmValue(exint idx, const UT_Matrix3D &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
bool operator==(const SOP_ConnectivityParms &src) const
void setSeamgroup(const UT_StringHolder &val)
void getParmValue(exint idx, UT_StringHolder &value) const
void setUVAttrib(const UT_StringHolder &val)
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_Matrix3D v)
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
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, UT_StringHolder s)
void setParmValue(exint idx, const UT_Matrix2D &value)
static void saveData(std::ostream &os, bool v)
void getParmValue(exint idx, UT_Matrix4D &value) const
void getParmValue(exint idx, exint &value) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
void getParmValue(exint idx, UT_Vector2D &value) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
const UT_StringHolder & getSeamgroup() const
UT_StringHolder opUVAttrib(const SOP_NodeVerb::CookParms &cookparms) const
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
UT_StringHolder opAttribname(const SOP_NodeVerb::CookParms &cookparms) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
const UT_StringHolder & getVarname() const
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
UT_StringHolder opVarname(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_Vector2D &value)
bool opByuv(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)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
const UT_StringHolder & getUVAttrib() const
void setParmValue(exint idx, const UT_Vector4D &value)
void setParmValue(exint idx, const exint &value)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void saveData(std::ostream &os, UT_Vector4D v)
virtual void copyFrom(const SOP_NodeParms *src)
GLuint GLfloat * val
Definition: glcorearb.h:1607
static void saveData(std::ostream &os, UT_Vector3D v)
#define SOP_API
Definition: SOP_API.h:10
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
void setParmValue(exint idx, const UT_Matrix4D &value)
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
static void loadData(UT_IStream &is, int64 &v)
void getParmValue(exint idx, fpreal &value) const
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:374
Connecttype getConnecttype() const
void setAttribname(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setVarname(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
SYS_FORCE_INLINE bool isstring() const
void getParmValue(exint idx, UT_Vector4D &value) const
static void loadData(UT_IStream &is, fpreal64 &v)
UT_StringHolder opSeamgroup(const SOP_NodeVerb::CookParms &cookparms) const
GLenum src
Definition: glcorearb.h:1792