HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_DeltaMushParms.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  myIterations = 10;
31  myStepSize = 0.5;
32  myMethod = 0;
33  myPinBorder = false;
34  myRecomputeNormals = true;
35  myClampStepSize = true;
36 
37  }
38 
39  explicit SOP_DeltaMushParms(const SOP_DeltaMushParms &) = default;
40 
41  virtual ~SOP_DeltaMushParms() {}
42 
43  bool operator==(const SOP_DeltaMushParms &src) const
44  {
45  if (myGroup != src.myGroup) return false;
46  if (myIterations != src.myIterations) return false;
47  if (myStepSize != src.myStepSize) return false;
48  if (myMethod != src.myMethod) return false;
49  if (myPinBorder != src.myPinBorder) return false;
50  if (myRecomputeNormals != src.myRecomputeNormals) return false;
51  if (myClampStepSize != src.myClampStepSize) return false;
52 
53  return true;
54  }
55 
56 
57 
58  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
59  {
60  if (true)
61  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
62  else myGroup = ""_sh;
63  if (true)
64  OP_Utils::evalOpParm(myIterations, node, "iterations", time, 0);
65  else myIterations = 10;
66  if (true)
67  OP_Utils::evalOpParm(myStepSize, node, "stepsize", time, 0);
68  else myStepSize = 0.5;
69  if (true)
70  OP_Utils::evalOpParm(myMethod, node, "method", time, 0);
71  else myMethod = 0;
72  if (true)
73  OP_Utils::evalOpParm(myPinBorder, node, "pinborder", time, 0);
74  else myPinBorder = false;
75  if (true)
76  OP_Utils::evalOpParm(myRecomputeNormals, node, "updateaffectednmls", time, 0);
77  else myRecomputeNormals = true;
78  if (true)
79  OP_Utils::evalOpParm(myClampStepSize, node, "clampstepsize", time, 0);
80  else myClampStepSize = true;
81 
82  }
83 
84 
85  virtual void loadFromOpSubclass(const LoadParms &loadparms)
86  {
87  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
88  }
89 
90 
91  virtual void copyFrom(const SOP_NodeParms *src)
92  {
93  *this = *((const SOP_DeltaMushParms *)src);
94  }
95 
96  template <typename T>
97  void
98  doGetParmValue(exint idx, T &value) const
99  {
100  switch (idx)
101  {
102  case 0:
103  coerceValue(value, myGroup);
104  break;
105  case 1:
106  coerceValue(value, myIterations);
107  break;
108  case 2:
109  coerceValue(value, myStepSize);
110  break;
111  case 3:
112  coerceValue(value, myMethod);
113  break;
114  case 4:
115  coerceValue(value, myPinBorder);
116  break;
117  case 5:
118  coerceValue(value, myRecomputeNormals);
119  break;
120  case 6:
121  coerceValue(value, myClampStepSize);
122  break;
123 
124  }
125  }
126 
127  void getParmValue(exint idx, exint &value) const
128  { doGetParmValue(idx, value); }
129  void getParmValue(exint idx, fpreal &value) const
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
134  { doGetParmValue(idx, value); }
136  { doGetParmValue(idx, value); }
138  { doGetParmValue(idx, value); }
140  { doGetParmValue(idx, value); }
142  { doGetParmValue(idx, value); }
144  { doGetParmValue(idx, value); }
146  { doGetParmValue(idx, value); }
148  { doGetParmValue(idx, value); }
149 
150  template <typename T>
151  void
152  doSetParmValue(exint idx, const T &value)
153  {
154  switch (idx)
155  {
156  case 0:
157  coerceValue(myGroup, value);
158  break;
159  case 1:
160  coerceValue(myIterations, value);
161  break;
162  case 2:
163  coerceValue(myStepSize, value);
164  break;
165  case 3:
166  coerceValue(myMethod, value);
167  break;
168  case 4:
169  coerceValue(myPinBorder, value);
170  break;
171  case 5:
172  coerceValue(myRecomputeNormals, value);
173  break;
174  case 6:
175  coerceValue(myClampStepSize, value);
176  break;
177 
178  }
179  }
180 
181  void setParmValue(exint idx, const exint &value)
182  { doSetParmValue(idx, value); }
183  void setParmValue(exint idx, const fpreal &value)
184  { doSetParmValue(idx, value); }
185  void setParmValue(exint idx, const UT_Vector2D &value)
186  { doSetParmValue(idx, value); }
187  void setParmValue(exint idx, const UT_Vector3D &value)
188  { doSetParmValue(idx, value); }
189  void setParmValue(exint idx, const UT_Vector4D &value)
190  { doSetParmValue(idx, value); }
191  void setParmValue(exint idx, const UT_Matrix2D &value)
192  { doSetParmValue(idx, value); }
193  void setParmValue(exint idx, const UT_Matrix3D &value)
194  { doSetParmValue(idx, value); }
195  void setParmValue(exint idx, const UT_Matrix4D &value)
196  { doSetParmValue(idx, value); }
198  { doSetParmValue(idx, value); }
200  { doSetParmValue(idx, value); }
202  { doSetParmValue(idx, value); }
203 
204  virtual exint getNumParms() const
205  {
206  return 7;
207  }
208 
209  virtual const char *getParmName(exint fieldnum) const
210  {
211  switch (fieldnum)
212  {
213  case 0:
214  return "group";
215  case 1:
216  return "iterations";
217  case 2:
218  return "stepsize";
219  case 3:
220  return "method";
221  case 4:
222  return "pinborder";
223  case 5:
224  return "updateaffectednmls";
225  case 6:
226  return "clampstepsize";
227 
228  }
229  return 0;
230  }
231 
232  virtual ParmType getParmType(exint fieldnum) const
233  {
234  switch (fieldnum)
235  {
236  case 0:
237  return PARM_STRING;
238  case 1:
239  return PARM_INTEGER;
240  case 2:
241  return PARM_FLOAT;
242  case 3:
243  return PARM_INTEGER;
244  case 4:
245  return PARM_INTEGER;
246  case 5:
247  return PARM_INTEGER;
248  case 6:
249  return PARM_INTEGER;
250 
251  }
252  return PARM_UNSUPPORTED;
253  }
254 
255  // Boiler plate to load individual types.
256  static void loadData(UT_IStream &is, int64 &v)
257  { is.bread(&v, 1); }
258  static void loadData(UT_IStream &is, bool &v)
259  { int64 iv; is.bread(&iv, 1); v = iv; }
260  static void loadData(UT_IStream &is, fpreal64 &v)
261  { is.bread<fpreal64>(&v, 1); }
262  static void loadData(UT_IStream &is, UT_Vector2D &v)
263  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
264  static void loadData(UT_IStream &is, UT_Vector3D &v)
265  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
266  is.bread<fpreal64>(&v.z(), 1); }
267  static void loadData(UT_IStream &is, UT_Vector4D &v)
268  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
269  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
270  static void loadData(UT_IStream &is, UT_Matrix2D &v)
271  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
272  static void loadData(UT_IStream &is, UT_Matrix3D &v)
273  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
274  static void loadData(UT_IStream &is, UT_Matrix4D &v)
275  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
276  static void loadData(UT_IStream &is, UT_Vector2I &v)
277  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
278  static void loadData(UT_IStream &is, UT_Vector3I &v)
279  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
280  is.bread<int64>(&v.z(), 1); }
281  static void loadData(UT_IStream &is, UT_Vector4I &v)
282  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
283  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
285  { is.bread(v); }
287  { UT_StringHolder rampdata;
288  loadData(is, rampdata);
289  if (rampdata.isstring())
290  {
291  v.reset(new UT_Ramp());
292  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
293  v->load(istr);
294  }
295  else v.reset();
296  }
299  loadData(is, data);
300  if (data.isstring())
301  {
302  // Find the data type.
303  char *colon = UT_StringWrap(data).findChar(':');
304  if (colon)
305  {
306  int typelen = colon - data.buffer();
308  type.strncpy(data.buffer(), typelen);
309  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
310 
311  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
312  }
313  }
314  else v.reset();
315  }
316 
317  static void saveData(std::ostream &os, int64 v)
318  { UTwrite(os, &v); }
319  static void saveData(std::ostream &os, bool v)
320  { int64 iv = v; UTwrite(os, &iv); }
321  static void saveData(std::ostream &os, fpreal64 v)
322  { UTwrite<fpreal64>(os, &v); }
323  static void saveData(std::ostream &os, UT_Vector2D v)
324  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
325  static void saveData(std::ostream &os, UT_Vector3D v)
326  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
327  UTwrite<fpreal64>(os, &v.z()); }
328  static void saveData(std::ostream &os, UT_Vector4D v)
329  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
330  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
331  static void saveData(std::ostream &os, UT_Matrix2D v)
333  static void saveData(std::ostream &os, UT_Matrix3D v)
335  static void saveData(std::ostream &os, UT_Matrix4D v)
337  static void saveData(std::ostream &os, UT_StringHolder s)
338  { UT_StringWrap(s).saveBinary(os); }
339  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
340  { UT_StringHolder result;
341  UT_OStringStream ostr;
342  if (s) s->save(ostr);
343  result = ostr.str();
344  saveData(os, result);
345  }
346  static void saveData(std::ostream &os, PRM_DataItemHandle s)
347  { UT_StringHolder result;
348  UT_OStringStream ostr;
349  if (s)
350  {
351  ostr << s->getDataTypeToken();
352  ostr << ":";
353  s->saveBinary(ostr);
354  }
355  result = ostr.str();
356  saveData(os, result);
357  }
358 
359 
360  void save(std::ostream &os) const
361  {
362  int32 v = version();
363  UTwrite(os, &v);
364  saveData(os, myGroup);
365  saveData(os, myIterations);
366  saveData(os, myStepSize);
367  saveData(os, myMethod);
368  saveData(os, myPinBorder);
369  saveData(os, myRecomputeNormals);
370  saveData(os, myClampStepSize);
371 
372  }
373 
374  bool load(UT_IStream &is)
375  {
376  int32 v;
377  is.bread(&v, 1);
378  if (version() != v)
379  {
380  // Fail incompatible versions
381  return false;
382  }
383  loadData(is, myGroup);
384  loadData(is, myIterations);
385  loadData(is, myStepSize);
386  loadData(is, myMethod);
387  loadData(is, myPinBorder);
388  loadData(is, myRecomputeNormals);
389  loadData(is, myClampStepSize);
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  int64 getIterations() const { return myIterations; }
405  void setIterations(int64 val) { myIterations = val; }
407  {
408  SOP_Node *thissop = cookparms.getNode();
409  if (!thissop) return getIterations();
410  int64 result;
411  OP_Utils::evalOpParm(result, thissop, "iterations", cookparms.getCookTime(), 0);
412  return result;
413  }
414  fpreal64 getStepSize() const { return myStepSize; }
415  void setStepSize(fpreal64 val) { myStepSize = val; }
417  {
418  SOP_Node *thissop = cookparms.getNode();
419  if (!thissop) return getStepSize();
420  fpreal64 result;
421  OP_Utils::evalOpParm(result, thissop, "stepsize", cookparms.getCookTime(), 0);
422  return result;
423  }
424  int64 getMethod() const { return myMethod; }
425  void setMethod(int64 val) { myMethod = val; }
426  int64 opMethod(const SOP_NodeVerb::CookParms &cookparms) const
427  {
428  SOP_Node *thissop = cookparms.getNode();
429  if (!thissop) return getMethod();
430  int64 result;
431  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
432  return result;
433  }
434  bool getPinBorder() const { return myPinBorder; }
435  void setPinBorder(bool val) { myPinBorder = val; }
436  bool opPinBorder(const SOP_NodeVerb::CookParms &cookparms) const
437  {
438  SOP_Node *thissop = cookparms.getNode();
439  if (!thissop) return getPinBorder();
440  bool result;
441  OP_Utils::evalOpParm(result, thissop, "pinborder", cookparms.getCookTime(), 0);
442  return result;
443  }
444  bool getRecomputeNormals() const { return myRecomputeNormals; }
445  void setRecomputeNormals(bool val) { myRecomputeNormals = val; }
446  bool opRecomputeNormals(const SOP_NodeVerb::CookParms &cookparms) const
447  {
448  SOP_Node *thissop = cookparms.getNode();
449  if (!thissop) return getRecomputeNormals();
450  bool result;
451  OP_Utils::evalOpParm(result, thissop, "updateaffectednmls", cookparms.getCookTime(), 0);
452  return result;
453  }
454  bool getClampStepSize() const { return myClampStepSize; }
455  void setClampStepSize(bool val) { myClampStepSize = val; }
456  bool opClampStepSize(const SOP_NodeVerb::CookParms &cookparms) const
457  {
458  SOP_Node *thissop = cookparms.getNode();
459  if (!thissop) return getClampStepSize();
460  bool result;
461  OP_Utils::evalOpParm(result, thissop, "clampstepsize", cookparms.getCookTime(), 0);
462  return result;
463  }
464 
465 private:
466  UT_StringHolder myGroup;
467  int64 myIterations;
468  fpreal64 myStepSize;
469  int64 myMethod;
470  bool myPinBorder;
471  bool myRecomputeNormals;
472  bool myClampStepSize;
473 
474 };
virtual exint getNumParms() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
int64 opMethod(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
static void saveData(std::ostream &os, bool v)
void setParmValue(exint idx, const fpreal &value)
static void saveData(std::ostream &os, UT_Vector3D v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
bool load(UT_IStream &is)
virtual const char * getParmName(exint fieldnum) const
static void saveData(std::ostream &os, UT_Vector4D v)
void save(std::ostream &os) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
exint bread(int32 *buffer, exint asize=1)
void setParmValue(exint idx, const UT_Matrix2D &value)
static void loadData(UT_IStream &is, UT_StringHolder &v)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void setRecomputeNormals(bool val)
static void saveData(std::ostream &os, UT_Matrix4D v)
void doSetParmValue(exint idx, const T &value)
T & x(void)
Definition: UT_Vector2.h:284
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_Matrix3D &v)
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_Vector4D &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setParmValue(exint idx, const UT_Vector2D &value)
void getParmValue(exint idx, UT_Matrix3D &value) const
void setParmValue(exint idx, const exint &value)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
static void saveData(std::ostream &os, UT_Vector2D v)
bool opClampStepSize(const SOP_NodeVerb::CookParms &cookparms) const
long long int64
Definition: SYS_Types.h:106
static void loadData(UT_IStream &is, UT_Vector3I &v)
virtual void copyFrom(const SOP_NodeParms *src)
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setParmValue(exint idx, const UT_Matrix4D &value)
SYS_FORCE_INLINE const char * buffer() const
void setStepSize(fpreal64 val)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
int64 exint
Definition: SYS_Types.h:115
static void saveData(std::ostream &os, int64 v)
void getParmValue(exint idx, UT_Vector4D &value) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
void getParmValue(exint idx, UT_Matrix2D &value) const
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, bool &v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void setParmValue(exint idx, const UT_Vector3D &value)
GLboolean * data
Definition: glcorearb.h:130
static void loadData(UT_IStream &is, UT_Vector2D &v)
virtual ParmType getParmType(exint fieldnum) const
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
static void saveData(std::ostream &os, UT_StringHolder s)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void setParmValue(exint idx, const UT_Matrix3D &value)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void setGroup(const UT_StringHolder &val)
static void loadData(UT_IStream &is, fpreal64 &v)
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:269
void strncpy(const char *src, exint maxlen)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void setParmValue(exint idx, const UT_StringHolder &value)
void setParmValue(exint idx, const UT_Vector4D &value)
const UT_StringHolder & getGroup() const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
void getParmValue(exint idx, UT_Matrix4D &value) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
bool opPinBorder(const SOP_NodeVerb::CookParms &cookparms) const
bool opRecomputeNormals(const SOP_NodeVerb::CookParms &cookparms) const
int64 opIterations(const SOP_NodeVerb::CookParms &cookparms) const
void getParmValue(exint idx, UT_Vector2D &value) const
void getParmValue(exint idx, fpreal &value) const
GLuint GLfloat * val
Definition: glcorearb.h:1607
static void loadData(UT_IStream &is, UT_Vector3D &v)
#define SOP_API
Definition: SOP_API.h:10
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
T & x(void)
Definition: UT_Vector4.h:368
void doGetParmValue(exint idx, T &value) const
void getParmValue(exint idx, exint &value) const
T & y(void)
Definition: UT_Vector2.h:286
void getParmValue(exint idx, UT_Vector3D &value) const
GLboolean r
Definition: glcorearb.h:1221
fpreal64 opStepSize(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
T & w(void)
Definition: UT_Vector4.h:374
static void saveData(std::ostream &os, fpreal64 v)
fpreal64 getStepSize() const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, int64 &v)
bool operator==(const SOP_DeltaMushParms &src) const
void getParmValue(exint idx, UT_StringHolder &value) const
GLenum src
Definition: glcorearb.h:1792
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)