HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Smooth-2.0.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_Smooth_2_0Enums
22 {
24  {
25  NONE = 0,
28  };
29  enum class Method
30  {
31  UNIFORM = 0,
34  };
35 }
36 
37 
39 {
40 public:
41  static int version() { return 1; }
42 
44  {
45  myGroup = ""_sh;
46  myConstrainedBoundary = 2;
47  myConstrainedPoints = ""_sh;
48  myAttributes = "P"_sh;
49  myMethod = 0;
50  myStrength = 10;
51  myFilterQuality = 2;
52 
53  }
54 
55  explicit SOP_Smooth_2_0Parms(const SOP_Smooth_2_0Parms &) = default;
56 
57  virtual ~SOP_Smooth_2_0Parms() {}
58 
59  bool operator==(const SOP_Smooth_2_0Parms &src) const
60  {
61  if (myGroup != src.myGroup) return false;
62  if (myConstrainedBoundary != src.myConstrainedBoundary) return false;
63  if (myConstrainedPoints != src.myConstrainedPoints) return false;
64  if (myAttributes != src.myAttributes) return false;
65  if (myMethod != src.myMethod) return false;
66  if (myStrength != src.myStrength) return false;
67  if (myFilterQuality != src.myFilterQuality) return false;
68 
69  return true;
70  }
73 
74 
75 
76  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
77  {
78  if (true)
79  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
80  else myGroup = ""_sh;
81  if (true)
82  OP_Utils::evalOpParm(myConstrainedBoundary, node, "contrainedboundary", time, 0);
83  else myConstrainedBoundary = 2;
84  if (true)
85  OP_Utils::evalOpParm(myConstrainedPoints, node, "constrainedpoints", time, 0);
86  else myConstrainedPoints = ""_sh;
87  if (true)
88  OP_Utils::evalOpParm(myAttributes, node, "attributes", time, 0);
89  else myAttributes = "P"_sh;
90  if (true)
91  OP_Utils::evalOpParm(myMethod, node, "method", time, 0);
92  else myMethod = 0;
93  if (true)
94  OP_Utils::evalOpParm(myStrength, node, "strength", time, 0);
95  else myStrength = 10;
96  if (true)
97  OP_Utils::evalOpParm(myFilterQuality, node, "filterquality", time, 0);
98  else myFilterQuality = 2;
99 
100  }
101 
102 
103  virtual void loadFromOpSubclass(const LoadParms &loadparms)
104  {
105  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
106  }
107 
108 
109  virtual void copyFrom(const SOP_NodeParms *src)
110  {
111  *this = *((const SOP_Smooth_2_0Parms *)src);
112  }
113 
114  template <typename T>
115  void
116  doGetParmValue(exint idx, T &value) const
117  {
118  switch (idx)
119  {
120  case 0:
121  coerceValue(value, myGroup);
122  break;
123  case 1:
124  coerceValue(value, myConstrainedBoundary);
125  break;
126  case 2:
127  coerceValue(value, myConstrainedPoints);
128  break;
129  case 3:
130  coerceValue(value, myAttributes);
131  break;
132  case 4:
133  coerceValue(value, myMethod);
134  break;
135  case 5:
136  coerceValue(value, myStrength);
137  break;
138  case 6:
139  coerceValue(value, myFilterQuality);
140  break;
141 
142  }
143  }
144 
145  void getParmValue(exint idx, exint &value) const
146  { doGetParmValue(idx, value); }
147  void getParmValue(exint idx, fpreal &value) const
148  { doGetParmValue(idx, value); }
150  { doGetParmValue(idx, value); }
152  { doGetParmValue(idx, value); }
154  { doGetParmValue(idx, value); }
156  { doGetParmValue(idx, value); }
158  { doGetParmValue(idx, value); }
160  { doGetParmValue(idx, value); }
162  { doGetParmValue(idx, value); }
164  { doGetParmValue(idx, value); }
166  { doGetParmValue(idx, value); }
167 
168  template <typename T>
169  void
170  doSetParmValue(exint idx, const T &value)
171  {
172  switch (idx)
173  {
174  case 0:
175  coerceValue(myGroup, value);
176  break;
177  case 1:
178  coerceValue(myConstrainedBoundary, value);
179  break;
180  case 2:
181  coerceValue(myConstrainedPoints, value);
182  break;
183  case 3:
184  coerceValue(myAttributes, value);
185  break;
186  case 4:
187  coerceValue(myMethod, value);
188  break;
189  case 5:
190  coerceValue(myStrength, value);
191  break;
192  case 6:
193  coerceValue(myFilterQuality, value);
194  break;
195 
196  }
197  }
198 
199  void setParmValue(exint idx, const exint &value)
200  { doSetParmValue(idx, value); }
201  void setParmValue(exint idx, const fpreal &value)
202  { doSetParmValue(idx, value); }
203  void setParmValue(exint idx, const UT_Vector2D &value)
204  { doSetParmValue(idx, value); }
205  void setParmValue(exint idx, const UT_Vector3D &value)
206  { doSetParmValue(idx, value); }
207  void setParmValue(exint idx, const UT_Vector4D &value)
208  { doSetParmValue(idx, value); }
209  void setParmValue(exint idx, const UT_Matrix2D &value)
210  { doSetParmValue(idx, value); }
211  void setParmValue(exint idx, const UT_Matrix3D &value)
212  { doSetParmValue(idx, value); }
213  void setParmValue(exint idx, const UT_Matrix4D &value)
214  { doSetParmValue(idx, value); }
216  { doSetParmValue(idx, value); }
218  { doSetParmValue(idx, value); }
220  { doSetParmValue(idx, value); }
221 
222  virtual exint getNumParms() const
223  {
224  return 7;
225  }
226 
227  virtual const char *getParmName(exint fieldnum) const
228  {
229  switch (fieldnum)
230  {
231  case 0:
232  return "group";
233  case 1:
234  return "contrainedboundary";
235  case 2:
236  return "constrainedpoints";
237  case 3:
238  return "attributes";
239  case 4:
240  return "method";
241  case 5:
242  return "strength";
243  case 6:
244  return "filterquality";
245 
246  }
247  return 0;
248  }
249 
250  virtual ParmType getParmType(exint fieldnum) const
251  {
252  switch (fieldnum)
253  {
254  case 0:
255  return PARM_STRING;
256  case 1:
257  return PARM_INTEGER;
258  case 2:
259  return PARM_STRING;
260  case 3:
261  return PARM_STRING;
262  case 4:
263  return PARM_INTEGER;
264  case 5:
265  return PARM_FLOAT;
266  case 6:
267  return PARM_INTEGER;
268 
269  }
270  return PARM_UNSUPPORTED;
271  }
272 
273  // Boiler plate to load individual types.
274  static void loadData(UT_IStream &is, int64 &v)
275  { is.bread(&v, 1); }
276  static void loadData(UT_IStream &is, bool &v)
277  { int64 iv; is.bread(&iv, 1); v = iv; }
278  static void loadData(UT_IStream &is, fpreal64 &v)
279  { is.bread<fpreal64>(&v, 1); }
280  static void loadData(UT_IStream &is, UT_Vector2D &v)
281  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
282  static void loadData(UT_IStream &is, UT_Vector3D &v)
283  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
284  is.bread<fpreal64>(&v.z(), 1); }
285  static void loadData(UT_IStream &is, UT_Vector4D &v)
286  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
287  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
288  static void loadData(UT_IStream &is, UT_Matrix2D &v)
289  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
290  static void loadData(UT_IStream &is, UT_Matrix3D &v)
291  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
292  static void loadData(UT_IStream &is, UT_Matrix4D &v)
293  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
294  static void loadData(UT_IStream &is, UT_Vector2I &v)
295  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
296  static void loadData(UT_IStream &is, UT_Vector3I &v)
297  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
298  is.bread<int64>(&v.z(), 1); }
299  static void loadData(UT_IStream &is, UT_Vector4I &v)
300  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
301  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
303  { is.bread(v); }
305  { UT_StringHolder rampdata;
306  loadData(is, rampdata);
307  if (rampdata.isstring())
308  {
309  v.reset(new UT_Ramp());
310  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
311  v->load(istr);
312  }
313  else v.reset();
314  }
317  loadData(is, data);
318  if (data.isstring())
319  {
320  // Find the data type.
321  char *colon = UT_StringWrap(data).findChar(':');
322  if (colon)
323  {
324  int typelen = colon - data.buffer();
326  type.strncpy(data.buffer(), typelen);
327  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
328 
329  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
330  }
331  }
332  else v.reset();
333  }
334 
335  static void saveData(std::ostream &os, int64 v)
336  { UTwrite(os, &v); }
337  static void saveData(std::ostream &os, bool v)
338  { int64 iv = v; UTwrite(os, &iv); }
339  static void saveData(std::ostream &os, fpreal64 v)
340  { UTwrite<fpreal64>(os, &v); }
341  static void saveData(std::ostream &os, UT_Vector2D v)
342  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
343  static void saveData(std::ostream &os, UT_Vector3D v)
344  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
345  UTwrite<fpreal64>(os, &v.z()); }
346  static void saveData(std::ostream &os, UT_Vector4D v)
347  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
348  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
349  static void saveData(std::ostream &os, UT_Matrix2D v)
351  static void saveData(std::ostream &os, UT_Matrix3D v)
353  static void saveData(std::ostream &os, UT_Matrix4D v)
355  static void saveData(std::ostream &os, UT_StringHolder s)
356  { UT_StringWrap(s).saveBinary(os); }
357  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
358  { UT_StringHolder result;
359  UT_OStringStream ostr;
360  if (s) s->save(ostr);
361  result = ostr.str();
362  saveData(os, result);
363  }
364  static void saveData(std::ostream &os, PRM_DataItemHandle s)
365  { UT_StringHolder result;
366  UT_OStringStream ostr;
367  if (s)
368  {
369  ostr << s->getDataTypeToken();
370  ostr << ":";
371  s->saveBinary(ostr);
372  }
373  result = ostr.str();
374  saveData(os, result);
375  }
376 
377 
378  void save(std::ostream &os) const
379  {
380  int32 v = version();
381  UTwrite(os, &v);
382  saveData(os, myGroup);
383  saveData(os, myConstrainedBoundary);
384  saveData(os, myConstrainedPoints);
385  saveData(os, myAttributes);
386  saveData(os, myMethod);
387  saveData(os, myStrength);
388  saveData(os, myFilterQuality);
389 
390  }
391 
392  bool load(UT_IStream &is)
393  {
394  int32 v;
395  is.bread(&v, 1);
396  if (version() != v)
397  {
398  // Fail incompatible versions
399  return false;
400  }
401  loadData(is, myGroup);
402  loadData(is, myConstrainedBoundary);
403  loadData(is, myConstrainedPoints);
404  loadData(is, myAttributes);
405  loadData(is, myMethod);
406  loadData(is, myStrength);
407  loadData(is, myFilterQuality);
408 
409  return true;
410  }
411 
412  const UT_StringHolder & getGroup() const { return myGroup; }
413  void setGroup(const UT_StringHolder & val) { myGroup = val; }
415  {
416  SOP_Node *thissop = cookparms.getNode();
417  if (!thissop) return getGroup();
418  UT_StringHolder result;
419  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
420  return result;
421  }
422  ConstrainedBoundary getConstrainedBoundary() const { return ConstrainedBoundary(myConstrainedBoundary); }
423  void setConstrainedBoundary(ConstrainedBoundary val) { myConstrainedBoundary = int64(val); }
425  {
426  SOP_Node *thissop = cookparms.getNode();
427  if (!thissop) return getConstrainedBoundary();
428  int64 result;
429  OP_Utils::evalOpParm(result, thissop, "contrainedboundary", cookparms.getCookTime(), 0);
430  return ConstrainedBoundary(result);
431  }
432  const UT_StringHolder & getConstrainedPoints() const { return myConstrainedPoints; }
433  void setConstrainedPoints(const UT_StringHolder & val) { myConstrainedPoints = val; }
435  {
436  SOP_Node *thissop = cookparms.getNode();
437  if (!thissop) return getConstrainedPoints();
438  UT_StringHolder result;
439  OP_Utils::evalOpParm(result, thissop, "constrainedpoints", cookparms.getCookTime(), 0);
440  return result;
441  }
442  const UT_StringHolder & getAttributes() const { return myAttributes; }
443  void setAttributes(const UT_StringHolder & val) { myAttributes = val; }
445  {
446  SOP_Node *thissop = cookparms.getNode();
447  if (!thissop) return getAttributes();
448  UT_StringHolder result;
449  OP_Utils::evalOpParm(result, thissop, "attributes", cookparms.getCookTime(), 0);
450  return result;
451  }
452  Method getMethod() const { return Method(myMethod); }
453  void setMethod(Method val) { myMethod = int64(val); }
454  Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
455  {
456  SOP_Node *thissop = cookparms.getNode();
457  if (!thissop) return getMethod();
458  int64 result;
459  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
460  return Method(result);
461  }
462  fpreal64 getStrength() const { return myStrength; }
463  void setStrength(fpreal64 val) { myStrength = val; }
465  {
466  SOP_Node *thissop = cookparms.getNode();
467  if (!thissop) return getStrength();
468  fpreal64 result;
469  OP_Utils::evalOpParm(result, thissop, "strength", cookparms.getCookTime(), 0);
470  return result;
471  }
472  int64 getFilterQuality() const { return myFilterQuality; }
473  void setFilterQuality(int64 val) { myFilterQuality = val; }
475  {
476  SOP_Node *thissop = cookparms.getNode();
477  if (!thissop) return getFilterQuality();
478  int64 result;
479  OP_Utils::evalOpParm(result, thissop, "filterquality", cookparms.getCookTime(), 0);
480  return result;
481  }
482 
483 private:
484  UT_StringHolder myGroup;
485  int64 myConstrainedBoundary;
486  UT_StringHolder myConstrainedPoints;
487  UT_StringHolder myAttributes;
488  int64 myMethod;
489  fpreal64 myStrength;
490  int64 myFilterQuality;
491 
492 };
void setStrength(fpreal64 val)
void doGetParmValue(exint idx, T &value) const
const UT_StringHolder & getConstrainedPoints() const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
virtual void loadFromOpSubclass(const LoadParms &loadparms)
void getParmValue(exint idx, UT_Vector3D &value) const
void doSetParmValue(exint idx, const T &value)
fpreal64 opStrength(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
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_Matrix2D &value)
static void saveData(std::ostream &os, UT_Matrix2D v)
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void getParmValue(exint idx, UT_Matrix2D &value) const
void setMethod(Method val)
void getParmValue(exint idx, exint &value) const
const UT_StringHolder & getAttributes() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void loadData(UT_IStream &is, bool &v)
void getParmValue(exint idx, UT_Matrix4D &value) const
static void saveData(std::ostream &os, UT_Vector3D v)
T & x(void)
Definition: UT_Vector2.h:284
fpreal64 getStrength() const
An output stream object that owns its own string buffer storage.
void getParmValue(exint idx, fpreal &value) const
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
void save(std::ostream &os) const
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setFilterQuality(int64 val)
void getParmValue(exint idx, UT_Matrix3D &value) const
bool operator==(const SOP_Smooth_2_0Parms &src) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void saveData(std::ostream &os, int64 v)
ConstrainedBoundary getConstrainedBoundary() const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
bool load(UT_IStream &is)
void setParmValue(exint idx, const UT_Vector2D &value)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
exint length() const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
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
static void loadData(UT_IStream &is, UT_Matrix4D &v)
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 getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void saveData(std::ostream &os, UT_Vector2D v)
virtual void copyFrom(const SOP_NodeParms *src)
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
virtual ParmType getParmType(exint fieldnum) const
void setParmValue(exint idx, const UT_Matrix4D &value)
void setParmValue(exint idx, const UT_Matrix3D &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
void setParmValue(exint idx, const UT_Vector3D &value)
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setGroup(const UT_StringHolder &val)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
static void saveData(std::ostream &os, UT_Matrix4D v)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
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 getParmValue(exint idx, UT_Vector2D &value) const
void setConstrainedBoundary(ConstrainedBoundary val)
void setParmValue(exint idx, const exint &value)
virtual exint getNumParms() const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void setConstrainedPoints(const UT_StringHolder &val)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
int64 getFilterQuality() const
static void saveData(std::ostream &os, UT_Vector4D v)
void setParmValue(exint idx, const UT_Vector4D &value)
GLuint GLfloat * val
Definition: glcorearb.h:1607
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setParmValue(exint idx, const fpreal &value)
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_StringHolder s)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
void getParmValue(exint idx, UT_StringHolder &value) const
virtual const char * getParmName(exint fieldnum) const
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
UT_StringHolder opAttributes(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void saveData(std::ostream &os, fpreal64 v)
void getParmValue(exint idx, UT_Vector4D &value) const
GLboolean r
Definition: glcorearb.h:1221
static void loadData(UT_IStream &is, fpreal64 &v)
int64 opFilterQuality(const SOP_NodeVerb::CookParms &cookparms) const
void setAttributes(const UT_StringHolder &val)
T & w(void)
Definition: UT_Vector4.h:374
static void saveData(std::ostream &os, bool v)
UT_StringHolder opConstrainedPoints(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_StringHolder &value)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
ConstrainedBoundary opConstrainedBoundary(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE bool isstring() const
GLenum src
Definition: glcorearb.h:1792
const UT_StringHolder & getGroup() const