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