HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  return !operator==(src);
68  }
70 
71 
72 
73  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
74  {
75  if (true)
76  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
77  else myGroup = ""_sh;
78  if (true)
79  OP_Utils::evalOpParm(myConvolveZM, node, "convolvezm", time, 0);
80  else myConvolveZM = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
81  if (true)
82  OP_Utils::evalOpParm(myConvolveZZ, node, "convolvezz", time, 0);
83  else myConvolveZZ = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
84  if (true)
85  OP_Utils::evalOpParm(myConvolveZP, node, "convolvezp", time, 0);
86  else myConvolveZP = UT_Matrix3D(0,0,0,0,0,0,0,0,0);
87  if (true)
88  OP_Utils::evalOpParm(myNormalize, node, "normalize", time, 0);
89  else myNormalize = false;
90  if (true)
91  OP_Utils::evalOpParm(myOperation, node, "operation", time, 0);
92  else myOperation = 0;
93 
94  }
95 
96 
97  virtual void loadFromOpSubclass(const LoadParms &loadparms)
98  {
99  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
100  }
101 
102 
103  virtual void copyFrom(const SOP_NodeParms *src)
104  {
105  *this = *((const SOP_VolumeConvolve3Parms *)src);
106  }
107 
108  template <typename T>
109  void
110  doGetParmValue(exint idx, T &value) const
111  {
112  switch (idx)
113  {
114  case 0:
115  coerceValue(value, myGroup);
116  break;
117  case 1:
118  coerceValue(value, myConvolveZM);
119  break;
120  case 2:
121  coerceValue(value, myConvolveZZ);
122  break;
123  case 3:
124  coerceValue(value, myConvolveZP);
125  break;
126  case 4:
127  coerceValue(value, myNormalize);
128  break;
129  case 5:
130  coerceValue(value, myOperation);
131  break;
132 
133  }
134  }
135 
136  void getParmValue(exint idx, exint &value) const
137  { doGetParmValue(idx, value); }
138  void getParmValue(exint idx, fpreal &value) const
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); }
155  { doGetParmValue(idx, value); }
157  { doGetParmValue(idx, value); }
158 
159  template <typename T>
160  void
161  doSetParmValue(exint idx, const T &value)
162  {
163  switch (idx)
164  {
165  case 0:
166  coerceValue(myGroup, value);
167  break;
168  case 1:
169  coerceValue(myConvolveZM, value);
170  break;
171  case 2:
172  coerceValue(myConvolveZZ, value);
173  break;
174  case 3:
175  coerceValue(myConvolveZP, value);
176  break;
177  case 4:
178  coerceValue(myNormalize, value);
179  break;
180  case 5:
181  coerceValue(myOperation, value);
182  break;
183 
184  }
185  }
186 
187  void setParmValue(exint idx, const exint &value)
188  { doSetParmValue(idx, value); }
189  void setParmValue(exint idx, const fpreal &value)
190  { doSetParmValue(idx, value); }
191  void setParmValue(exint idx, const UT_Vector2D &value)
192  { doSetParmValue(idx, value); }
193  void setParmValue(exint idx, const UT_Vector3D &value)
194  { doSetParmValue(idx, value); }
195  void setParmValue(exint idx, const UT_Vector4D &value)
196  { doSetParmValue(idx, value); }
197  void setParmValue(exint idx, const UT_Matrix2D &value)
198  { doSetParmValue(idx, value); }
199  void setParmValue(exint idx, const UT_Matrix3D &value)
200  { doSetParmValue(idx, value); }
201  void setParmValue(exint idx, const UT_Matrix4D &value)
202  { doSetParmValue(idx, value); }
204  { doSetParmValue(idx, value); }
206  { doSetParmValue(idx, value); }
208  { doSetParmValue(idx, value); }
209 
210  virtual exint getNumParms() const
211  {
212  return 6;
213  }
214 
215  virtual const char *getParmName(exint fieldnum) const
216  {
217  switch (fieldnum)
218  {
219  case 0:
220  return "group";
221  case 1:
222  return "convolvezm";
223  case 2:
224  return "convolvezz";
225  case 3:
226  return "convolvezp";
227  case 4:
228  return "normalize";
229  case 5:
230  return "operation";
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_MATRIX3;
244  case 2:
245  return PARM_MATRIX3;
246  case 3:
247  return PARM_MATRIX3;
248  case 4:
249  return PARM_INTEGER;
250  case 5:
251  return PARM_INTEGER;
252 
253  }
254  return PARM_UNSUPPORTED;
255  }
256 
257  // Boiler plate to load individual types.
258  static void loadData(UT_IStream &is, int64 &v)
259  { is.bread(&v, 1); }
260  static void loadData(UT_IStream &is, bool &v)
261  { int64 iv; is.bread(&iv, 1); v = iv; }
262  static void loadData(UT_IStream &is, fpreal64 &v)
263  { is.bread<fpreal64>(&v, 1); }
264  static void loadData(UT_IStream &is, UT_Vector2D &v)
265  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
266  static void loadData(UT_IStream &is, UT_Vector3D &v)
267  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
268  is.bread<fpreal64>(&v.z(), 1); }
269  static void loadData(UT_IStream &is, UT_Vector4D &v)
270  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
271  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
272  static void loadData(UT_IStream &is, UT_Matrix2D &v)
273  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
274  static void loadData(UT_IStream &is, UT_Matrix3D &v)
275  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
276  static void loadData(UT_IStream &is, UT_Matrix4D &v)
277  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
278  static void loadData(UT_IStream &is, UT_Vector2I &v)
279  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
280  static void loadData(UT_IStream &is, UT_Vector3I &v)
281  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
282  is.bread<int64>(&v.z(), 1); }
283  static void loadData(UT_IStream &is, UT_Vector4I &v)
284  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
285  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
287  { is.bread(v); }
289  { UT_StringHolder rampdata;
290  loadData(is, rampdata);
291  if (rampdata.isstring())
292  {
293  v.reset(new UT_Ramp());
294  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
295  v->load(istr);
296  }
297  else v.reset();
298  }
301  loadData(is, data);
302  if (data.isstring())
303  {
304  // Find the data type.
305  char *colon = UT_StringWrap(data).findChar(':');
306  if (colon)
307  {
308  int typelen = colon - data.buffer();
310  type.strncpy(data.buffer(), typelen);
311  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
312 
313  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
314  }
315  }
316  else v.reset();
317  }
318 
319  static void saveData(std::ostream &os, int64 v)
320  { UTwrite(os, &v); }
321  static void saveData(std::ostream &os, bool v)
322  { int64 iv = v; UTwrite(os, &iv); }
323  static void saveData(std::ostream &os, fpreal64 v)
324  { UTwrite<fpreal64>(os, &v); }
325  static void saveData(std::ostream &os, UT_Vector2D v)
326  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
327  static void saveData(std::ostream &os, UT_Vector3D v)
328  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
329  UTwrite<fpreal64>(os, &v.z()); }
330  static void saveData(std::ostream &os, UT_Vector4D v)
331  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
332  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
333  static void saveData(std::ostream &os, UT_Matrix2D v)
335  static void saveData(std::ostream &os, UT_Matrix3D v)
337  static void saveData(std::ostream &os, UT_Matrix4D v)
339  static void saveData(std::ostream &os, UT_StringHolder s)
340  { UT_StringWrap(s).saveBinary(os); }
341  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
342  { UT_StringHolder result;
343  UT_OStringStream ostr;
344  if (s) s->save(ostr);
345  result = ostr.str();
346  saveData(os, result);
347  }
348  static void saveData(std::ostream &os, PRM_DataItemHandle s)
349  { UT_StringHolder result;
350  UT_OStringStream ostr;
351  if (s)
352  {
353  ostr << s->getDataTypeToken();
354  ostr << ":";
355  s->saveBinary(ostr);
356  }
357  result = ostr.str();
358  saveData(os, result);
359  }
360 
361 
362  void save(std::ostream &os) const
363  {
364  int32 v = version();
365  UTwrite(os, &v);
366  saveData(os, myGroup);
367  saveData(os, myConvolveZM);
368  saveData(os, myConvolveZZ);
369  saveData(os, myConvolveZP);
370  saveData(os, myNormalize);
371  saveData(os, myOperation);
372 
373  }
374 
375  bool load(UT_IStream &is)
376  {
377  int32 v;
378  is.bread(&v, 1);
379  if (version() != v)
380  {
381  // Fail incompatible versions
382  return false;
383  }
384  loadData(is, myGroup);
385  loadData(is, myConvolveZM);
386  loadData(is, myConvolveZZ);
387  loadData(is, myConvolveZP);
388  loadData(is, myNormalize);
389  loadData(is, myOperation);
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  UT_Matrix3D getConvolveZM() const { return myConvolveZM; }
405  void setConvolveZM(UT_Matrix3D val) { myConvolveZM = val; }
407  {
408  SOP_Node *thissop = cookparms.getNode();
409  if (!thissop) return getConvolveZM();
410  UT_Matrix3D result;
411  OP_Utils::evalOpParm(result, thissop, "convolvezm", cookparms.getCookTime(), 0);
412  return result;
413  }
414  UT_Matrix3D getConvolveZZ() const { return myConvolveZZ; }
415  void setConvolveZZ(UT_Matrix3D val) { myConvolveZZ = val; }
417  {
418  SOP_Node *thissop = cookparms.getNode();
419  if (!thissop) return getConvolveZZ();
420  UT_Matrix3D result;
421  OP_Utils::evalOpParm(result, thissop, "convolvezz", cookparms.getCookTime(), 0);
422  return result;
423  }
424  UT_Matrix3D getConvolveZP() const { return myConvolveZP; }
425  void setConvolveZP(UT_Matrix3D val) { myConvolveZP = val; }
427  {
428  SOP_Node *thissop = cookparms.getNode();
429  if (!thissop) return getConvolveZP();
430  UT_Matrix3D result;
431  OP_Utils::evalOpParm(result, thissop, "convolvezp", cookparms.getCookTime(), 0);
432  return result;
433  }
434  bool getNormalize() const { return myNormalize; }
435  void setNormalize(bool val) { myNormalize = val; }
436  bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
437  {
438  SOP_Node *thissop = cookparms.getNode();
439  if (!thissop) return getNormalize();
440  bool result;
441  OP_Utils::evalOpParm(result, thissop, "normalize", cookparms.getCookTime(), 0);
442  return result;
443  }
444  Operation getOperation() const { return Operation(myOperation); }
445  void setOperation(Operation val) { myOperation = int64(val); }
447  {
448  SOP_Node *thissop = cookparms.getNode();
449  if (!thissop) return getOperation();
450  int64 result;
451  OP_Utils::evalOpParm(result, thissop, "operation", cookparms.getCookTime(), 0);
452  return Operation(result);
453  }
454 
455 private:
456  UT_StringHolder myGroup;
457  UT_Matrix3D myConvolveZM;
458  UT_Matrix3D myConvolveZZ;
459  UT_Matrix3D myConvolveZP;
460  bool myNormalize;
461  int64 myOperation;
462 
463 };
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:494
T & z(void)
Definition: UT_Vector4.h:379
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
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
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)
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
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:498
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)
bool operator!=(const SOP_VolumeConvolve3Parms &src) const
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:502
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_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
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
int64 exint
Definition: SYS_Types.h:116
void getParmValue(exint idx, UT_Vector4D &value) const
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:192
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:35
T & y(void)
Definition: UT_Vector4.h:377
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)
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
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, 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)
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
static void loadData(UT_IStream &is, UT_Vector4I &v)
T & y(void)
Definition: UT_Vector2.h:287
GLboolean r
Definition: glcorearb.h:1221
UT_Matrix3D opConvolveZZ(const SOP_NodeVerb::CookParms &cookparms) const
T & w(void)
Definition: UT_Vector4.h:381
void getParmValue(exint idx, UT_Vector2D &value) 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
void getParmValue(exint idx, UT_Matrix3D &value) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
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