HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_VolumeConvolve3.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_VolumeConvolve3Enums
22 {
23  enum class Operation
24  {
25  ADD = 0,
26  ADDABS,
27  MUL,
28  MAX,
29  MIN
30  };
31 }
32 
33 
35 {
36 public:
37  static int version() { return 1; }
38 
40  {
41  myGroup = ""_sh;
42  myConvolveZM = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
43  myConvolveZZ = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
44  myConvolveZP = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
45  myNormalize = false;
46  myOperation = 0;
47 
48  }
49 
50  explicit SOP_VolumeConvolve3Parms(const SOP_VolumeConvolve3Parms &) = default;
51 
53 
55  {
56  if (myGroup != src.myGroup) return false;
57  if (myConvolveZM != src.myConvolveZM) return false;
58  if (myConvolveZZ != src.myConvolveZZ) return false;
59  if (myConvolveZP != src.myConvolveZP) return false;
60  if (myNormalize != src.myNormalize) return false;
61  if (myOperation != src.myOperation) return false;
62 
63  return true;
64  }
66 
67 
68 
69  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
70  {
71  if (true)
72  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
73  else myGroup = ""_sh;
74  if (true)
75  OP_Utils::evalOpParm(myConvolveZM, node, "convolvezm", time, 0);
76  else myConvolveZM = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
77  if (true)
78  OP_Utils::evalOpParm(myConvolveZZ, node, "convolvezz", time, 0);
79  else myConvolveZZ = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
80  if (true)
81  OP_Utils::evalOpParm(myConvolveZP, node, "convolvezp", time, 0);
82  else myConvolveZP = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
83  if (true)
84  OP_Utils::evalOpParm(myNormalize, node, "normalize", time, 0);
85  else myNormalize = false;
86  if (true)
87  OP_Utils::evalOpParm(myOperation, node, "operation", time, 0);
88  else myOperation = 0;
89 
90  }
91 
92 
93  virtual void loadFromOpSubclass(const LoadParms &loadparms)
94  {
95  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
96  }
97 
98 
99  virtual void copyFrom(const SOP_NodeParms *src)
100  {
101  *this = *((const SOP_VolumeConvolve3Parms *)src);
102  }
103 
104  template <typename T>
105  void
106  doGetParmValue(exint idx, T &value) const
107  {
108  switch (idx)
109  {
110  case 0:
111  coerceValue(value, myGroup);
112  break;
113  case 1:
114  coerceValue(value, myConvolveZM);
115  break;
116  case 2:
117  coerceValue(value, myConvolveZZ);
118  break;
119  case 3:
120  coerceValue(value, myConvolveZP);
121  break;
122  case 4:
123  coerceValue(value, myNormalize);
124  break;
125  case 5:
126  coerceValue(value, myOperation);
127  break;
128 
129  }
130  }
131 
132  void getParmValue(exint idx, exint &value) const
133  { doGetParmValue(idx, value); }
134  void getParmValue(exint idx, fpreal &value) const
135  { doGetParmValue(idx, value); }
137  { doGetParmValue(idx, value); }
139  { doGetParmValue(idx, value); }
141  { doGetParmValue(idx, value); }
143  { doGetParmValue(idx, value); }
145  { doGetParmValue(idx, value); }
147  { doGetParmValue(idx, value); }
149  { doGetParmValue(idx, value); }
151  { doGetParmValue(idx, value); }
153  { doGetParmValue(idx, value); }
154 
155  template <typename T>
156  void
157  doSetParmValue(exint idx, const T &value)
158  {
159  switch (idx)
160  {
161  case 0:
162  coerceValue(myGroup, value);
163  break;
164  case 1:
165  coerceValue(myConvolveZM, value);
166  break;
167  case 2:
168  coerceValue(myConvolveZZ, value);
169  break;
170  case 3:
171  coerceValue(myConvolveZP, value);
172  break;
173  case 4:
174  coerceValue(myNormalize, value);
175  break;
176  case 5:
177  coerceValue(myOperation, value);
178  break;
179 
180  }
181  }
182 
183  void setParmValue(exint idx, const exint &value)
184  { doSetParmValue(idx, value); }
185  void setParmValue(exint idx, const fpreal &value)
186  { doSetParmValue(idx, value); }
187  void setParmValue(exint idx, const UT_Vector2D &value)
188  { doSetParmValue(idx, value); }
189  void setParmValue(exint idx, const UT_Vector3D &value)
190  { doSetParmValue(idx, value); }
191  void setParmValue(exint idx, const UT_Vector4D &value)
192  { doSetParmValue(idx, value); }
193  void setParmValue(exint idx, const UT_Matrix2D &value)
194  { doSetParmValue(idx, value); }
195  void setParmValue(exint idx, const UT_Matrix3D &value)
196  { doSetParmValue(idx, value); }
197  void setParmValue(exint idx, const UT_Matrix4D &value)
198  { doSetParmValue(idx, value); }
200  { doSetParmValue(idx, value); }
202  { doSetParmValue(idx, value); }
204  { doSetParmValue(idx, value); }
205 
206  virtual exint getNumParms() const
207  {
208  return 6;
209  }
210 
211  virtual const char *getParmName(exint fieldnum) const
212  {
213  switch (fieldnum)
214  {
215  case 0:
216  return "group";
217  case 1:
218  return "convolvezm";
219  case 2:
220  return "convolvezz";
221  case 3:
222  return "convolvezp";
223  case 4:
224  return "normalize";
225  case 5:
226  return "operation";
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_MATRIX3;
240  case 2:
241  return PARM_MATRIX3;
242  case 3:
243  return PARM_MATRIX3;
244  case 4:
245  return PARM_INTEGER;
246  case 5:
247  return PARM_INTEGER;
248 
249  }
250  return PARM_UNSUPPORTED;
251  }
252 
253  // Boiler plate to load individual types.
254  static void loadData(UT_IStream &is, int64 &v)
255  { is.bread(&v, 1); }
256  static void loadData(UT_IStream &is, bool &v)
257  { int64 iv; is.bread(&iv, 1); v = iv; }
258  static void loadData(UT_IStream &is, fpreal64 &v)
259  { is.bread<fpreal64>(&v, 1); }
260  static void loadData(UT_IStream &is, UT_Vector2D &v)
261  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
262  static void loadData(UT_IStream &is, UT_Vector3D &v)
263  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
264  is.bread<fpreal64>(&v.z(), 1); }
265  static void loadData(UT_IStream &is, UT_Vector4D &v)
266  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
267  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
268  static void loadData(UT_IStream &is, UT_Matrix2D &v)
269  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
270  static void loadData(UT_IStream &is, UT_Matrix3D &v)
271  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
272  static void loadData(UT_IStream &is, UT_Matrix4D &v)
273  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
274  static void loadData(UT_IStream &is, UT_Vector2I &v)
275  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
276  static void loadData(UT_IStream &is, UT_Vector3I &v)
277  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
278  is.bread<int64>(&v.z(), 1); }
279  static void loadData(UT_IStream &is, UT_Vector4I &v)
280  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
281  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
283  { is.bread(v); }
285  { UT_StringHolder rampdata;
286  loadData(is, rampdata);
287  if (rampdata.isstring())
288  {
289  v.reset(new UT_Ramp());
290  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
291  v->load(istr);
292  }
293  else v.reset();
294  }
297  loadData(is, data);
298  if (data.isstring())
299  {
300  // Find the data type.
301  char *colon = UT_StringWrap(data).findChar(':');
302  if (colon)
303  {
304  int typelen = colon - data.buffer();
306  type.strncpy(data.buffer(), typelen);
307  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
308 
309  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
310  }
311  }
312  else v.reset();
313  }
314 
315  static void saveData(std::ostream &os, int64 v)
316  { UTwrite(os, &v); }
317  static void saveData(std::ostream &os, bool v)
318  { int64 iv = v; UTwrite(os, &iv); }
319  static void saveData(std::ostream &os, fpreal64 v)
320  { UTwrite<fpreal64>(os, &v); }
321  static void saveData(std::ostream &os, UT_Vector2D v)
322  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
323  static void saveData(std::ostream &os, UT_Vector3D v)
324  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
325  UTwrite<fpreal64>(os, &v.z()); }
326  static void saveData(std::ostream &os, UT_Vector4D v)
327  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
328  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
329  static void saveData(std::ostream &os, UT_Matrix2D v)
331  static void saveData(std::ostream &os, UT_Matrix3D v)
333  static void saveData(std::ostream &os, UT_Matrix4D v)
335  static void saveData(std::ostream &os, UT_StringHolder s)
336  { UT_StringWrap(s).saveBinary(os); }
337  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
338  { UT_StringHolder result;
339  UT_OStringStream ostr;
340  if (s) s->save(ostr);
341  result = ostr.str();
342  saveData(os, result);
343  }
344  static void saveData(std::ostream &os, PRM_DataItemHandle s)
345  { UT_StringHolder result;
346  UT_OStringStream ostr;
347  if (s)
348  {
349  ostr << s->getDataTypeToken();
350  ostr << ":";
351  s->saveBinary(ostr);
352  }
353  result = ostr.str();
354  saveData(os, result);
355  }
356 
357 
358  void save(std::ostream &os) const
359  {
360  int32 v = version();
361  UTwrite(os, &v);
362  saveData(os, myGroup);
363  saveData(os, myConvolveZM);
364  saveData(os, myConvolveZZ);
365  saveData(os, myConvolveZP);
366  saveData(os, myNormalize);
367  saveData(os, myOperation);
368 
369  }
370 
371  bool load(UT_IStream &is)
372  {
373  int32 v;
374  is.bread(&v, 1);
375  if (version() != v)
376  {
377  // Fail incompatible versions
378  return false;
379  }
380  loadData(is, myGroup);
381  loadData(is, myConvolveZM);
382  loadData(is, myConvolveZZ);
383  loadData(is, myConvolveZP);
384  loadData(is, myNormalize);
385  loadData(is, myOperation);
386 
387  return true;
388  }
389 
390  const UT_StringHolder & getGroup() const { return myGroup; }
391  void setGroup(const UT_StringHolder & val) { myGroup = val; }
393  {
394  SOP_Node *thissop = cookparms.getNode();
395  if (!thissop) return getGroup();
396  UT_StringHolder result;
397  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
398  return result;
399  }
400  UT_Matrix3D getConvolveZM() const { return myConvolveZM; }
401  void setConvolveZM(UT_Matrix3D val) { myConvolveZM = val; }
403  {
404  SOP_Node *thissop = cookparms.getNode();
405  if (!thissop) return getConvolveZM();
406  UT_Matrix3D result;
407  OP_Utils::evalOpParm(result, thissop, "convolvezm", cookparms.getCookTime(), 0);
408  return result;
409  }
410  UT_Matrix3D getConvolveZZ() const { return myConvolveZZ; }
411  void setConvolveZZ(UT_Matrix3D val) { myConvolveZZ = val; }
413  {
414  SOP_Node *thissop = cookparms.getNode();
415  if (!thissop) return getConvolveZZ();
416  UT_Matrix3D result;
417  OP_Utils::evalOpParm(result, thissop, "convolvezz", cookparms.getCookTime(), 0);
418  return result;
419  }
420  UT_Matrix3D getConvolveZP() const { return myConvolveZP; }
421  void setConvolveZP(UT_Matrix3D val) { myConvolveZP = val; }
423  {
424  SOP_Node *thissop = cookparms.getNode();
425  if (!thissop) return getConvolveZP();
426  UT_Matrix3D result;
427  OP_Utils::evalOpParm(result, thissop, "convolvezp", cookparms.getCookTime(), 0);
428  return result;
429  }
430  bool getNormalize() const { return myNormalize; }
431  void setNormalize(bool val) { myNormalize = val; }
432  bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
433  {
434  SOP_Node *thissop = cookparms.getNode();
435  if (!thissop) return getNormalize();
436  bool result;
437  OP_Utils::evalOpParm(result, thissop, "normalize", cookparms.getCookTime(), 0);
438  return result;
439  }
440  Operation getOperation() const { return Operation(myOperation); }
441  void setOperation(Operation val) { myOperation = int64(val); }
443  {
444  SOP_Node *thissop = cookparms.getNode();
445  if (!thissop) return getOperation();
446  int64 result;
447  OP_Utils::evalOpParm(result, thissop, "operation", cookparms.getCookTime(), 0);
448  return Operation(result);
449  }
450 
451 private:
452  UT_StringHolder myGroup;
453  UT_Matrix3D myConvolveZM;
454  UT_Matrix3D myConvolveZZ;
455  UT_Matrix3D myConvolveZP;
456  bool myNormalize;
457  int64 myOperation;
458 
459 };
void getParmValue(exint idx, UT_Vector3D &value) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setParmValue(exint idx, const UT_Vector2D &value)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void save(std::ostream &os) const
virtual void copyFrom(const SOP_NodeParms *src)
static void loadData(UT_IStream &is, int64 &v)
void getParmValue(exint idx, exint &value) const
void setConvolveZZ(UT_Matrix3D val)
void doSetParmValue(exint idx, const T &value)
exint bread(int32 *buffer, exint asize=1)
void getParmValue(exint idx, UT_Matrix2D &value) const
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void getParmValue(exint idx, UT_Matrix4D &value) const
static void loadData(UT_IStream &is, bool &v)
void setParmValue(exint idx, const exint &value)
T & x(void)
Definition: UT_Vector2.h:284
UT_Matrix3D opConvolveZP(const SOP_NodeVerb::CookParms &cookparms) const
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, fpreal64 &v)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
void setParmValue(exint idx, const UT_Vector3D &value)
bool operator==(const SOP_VolumeConvolve3Parms &src) const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
UT_Matrix3D opConvolveZM(const SOP_NodeVerb::CookParms &cookparms) const
const UT_StringHolder & getGroup() const
void getParmValue(exint idx, fpreal &value) const
static void saveData(std::ostream &os, UT_Vector4D v)
static void saveData(std::ostream &os, fpreal64 v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
void setParmValue(exint idx, const fpreal &value)
virtual ParmType getParmType(exint fieldnum) const
void setParmValue(exint idx, const UT_Matrix4D &value)
virtual const char * getParmName(exint fieldnum) const
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_Vector3D v)
virtual exint getNumParms() const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_StringHolder &value)
static void saveData(std::ostream &os, UT_Matrix2D v)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
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
int64 exint
Definition: SYS_Types.h:109
void getParmValue(exint idx, UT_Vector4D &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:185
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, int64 v)
Operation opOperation(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix3D v)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void doGetParmValue(exint idx, T &value) const
void getParmValue(exint idx, UT_StringHolder &value) const
void setParmValue(exint idx, const UT_Matrix2D &value)
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_Matrix3D &value)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
static void loadData(UT_IStream &is, UT_Vector3D &v)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
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, PRM_DataItemHandle &value) const
void setConvolveZM(UT_Matrix3D val)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setGroup(const UT_StringHolder &val)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
void setParmValue(exint idx, const UT_Vector4D &value)
#define SOP_API
Definition: SOP_API.h:10
static void saveData(std::ostream &os, bool v)
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
static void loadData(UT_IStream &is, UT_Vector4I &v)
T & y(void)
Definition: UT_Vector2.h:286
GLboolean r
Definition: glcorearb.h:1221
UT_Matrix3D opConvolveZZ(const SOP_NodeVerb::CookParms &cookparms) const
T & w(void)
Definition: UT_Vector4.h:374
void getParmValue(exint idx, UT_Vector2D &value) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
void getParmValue(exint idx, UT_Matrix3D &value) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
void setConvolveZP(UT_Matrix3D val)
static void loadData(UT_IStream &is, UT_Vector3I &v)
UT_Matrix3T< fpreal64 > UT_Matrix3D
static void loadData(UT_IStream &is, UT_Matrix4D &v)
GLenum src
Definition: glcorearb.h:1792