HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_VolumeBound.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 <SOP/SOP_GraphProxy.h>
8 
9 #include <OP/OP_Utils.h>
10 #include <PRM/PRM_Parm.h>
11 #include <UT/UT_IStream.h>
12 #include <UT/UT_NTStreamUtil.h>
13 #include <UT/UT_Ramp.h>
14 #include <UT/UT_SharedPtr.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringStream.h>
17 #include <UT/UT_VectorTypes.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 namespace SOP_VolumeBoundEnums
24 {
25  enum class Comp
26  {
27  GREATER = 0,
28  LESS,
31  };
32 }
33 
34 
36 {
37 public:
38  static int version() { return 1; }
39 
41  {
42  myGroup = ""_sh;
43  myComp = 0;
44  myValue = 0;
45  myVoxelpad = UT_Vector3D(0,0,0);
46 
47  }
48 
49  explicit SOP_VolumeBoundParms(const SOP_VolumeBoundParms &) = default;
50 
51  ~SOP_VolumeBoundParms() override {}
52 
53  bool operator==(const SOP_VolumeBoundParms &src) const
54  {
55  if (myGroup != src.myGroup) return false;
56  if (myComp != src.myComp) return false;
57  if (myValue != src.myValue) return false;
58  if (myVoxelpad != src.myVoxelpad) return false;
59 
60  return true;
61  }
62  bool operator!=(const SOP_VolumeBoundParms &src) const
63  {
64  return !operator==(src);
65  }
67 
68 
69 
70  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
71  {
72  myGroup = ""_sh;
73  if (true)
74  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
75  myComp = 0;
76  if (true)
77  graph->evalOpParm(myComp, nodeidx, "comp", time, 0);
78  myValue = 0;
79  if (true)
80  graph->evalOpParm(myValue, nodeidx, "value", time, 0);
81  myVoxelpad = UT_Vector3D(0,0,0);
82  if (true)
83  graph->evalOpParm(myVoxelpad, nodeidx, "voxelpad", time, 0);
84 
85  }
86 
87 
88  void loadFromOpSubclass(const LoadParms &loadparms) override
89  {
90  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
91  }
92 
93 
94  void copyFrom(const SOP_NodeParms *src) override
95  {
96  *this = *((const SOP_VolumeBoundParms *)src);
97  }
98 
99  template <typename T>
100  void
101  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
102  {
103  if (idx.size() < 1)
104  return;
105  UT_ASSERT(idx.size() == instance.size()+1);
106  if (idx.size() != instance.size()+1)
107  return;
108  switch (idx[0])
109  {
110  case 0:
111  coerceValue(value, myGroup);
112  break;
113  case 1:
114  coerceValue(value, myComp);
115  break;
116  case 2:
117  coerceValue(value, myValue);
118  break;
119  case 3:
120  coerceValue(value, myVoxelpad);
121  break;
122 
123  }
124  }
125 
126  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
127  { doGetParmValue(idx, instance, value); }
128  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
129  { doGetParmValue(idx, instance, value); }
130  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
131  { doGetParmValue(idx, instance, value); }
132  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
133  { doGetParmValue(idx, instance, value); }
134  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
135  { doGetParmValue(idx, instance, value); }
136  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
137  { doGetParmValue(idx, instance, value); }
138  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
139  { doGetParmValue(idx, instance, value); }
140  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
141  { doGetParmValue(idx, instance, value); }
142  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
143  { doGetParmValue(idx, instance, value); }
144  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
145  { doGetParmValue(idx, instance, value); }
146  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
147  { doGetParmValue(idx, instance, value); }
148 
149  template <typename T>
150  void
151  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
152  {
153  if (idx.size() < 1)
154  return;
155  UT_ASSERT(idx.size() == instance.size()+1);
156  if (idx.size() != instance.size()+1)
157  return;
158  switch (idx[0])
159  {
160  case 0:
161  coerceValue(myGroup, value);
162  break;
163  case 1:
164  coerceValue(myComp, value);
165  break;
166  case 2:
167  coerceValue(myValue, value);
168  break;
169  case 3:
170  coerceValue(myVoxelpad, value);
171  break;
172 
173  }
174  }
175 
176  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
177  { doSetParmValue(idx, instance, value); }
178  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
179  { doSetParmValue(idx, instance, value); }
180  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
181  { doSetParmValue(idx, instance, value); }
182  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
183  { doSetParmValue(idx, instance, value); }
184  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
185  { doSetParmValue(idx, instance, value); }
186  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
187  { doSetParmValue(idx, instance, value); }
188  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
189  { doSetParmValue(idx, instance, value); }
190  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
191  { doSetParmValue(idx, instance, value); }
192  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
193  { doSetParmValue(idx, instance, value); }
194  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
195  { doSetParmValue(idx, instance, value); }
196  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
197  { doSetParmValue(idx, instance, value); }
198 
199  exint getNestNumParms(TempIndex idx) const override
200  {
201  if (idx.size() == 0)
202  return 4;
203  switch (idx[0])
204  {
205 
206  }
207  // Invalid
208  return 0;
209  }
210 
211  const char *getNestParmName(TempIndex fieldnum) const override
212  {
213  if (fieldnum.size() < 1)
214  return 0;
215  switch (fieldnum[0])
216  {
217  case 0:
218  return "group";
219  case 1:
220  return "comp";
221  case 2:
222  return "value";
223  case 3:
224  return "voxelpad";
225 
226  }
227  return 0;
228  }
229 
230  ParmType getNestParmType(TempIndex fieldnum) const override
231  {
232  if (fieldnum.size() < 1)
233  return PARM_UNSUPPORTED;
234  switch (fieldnum[0])
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_VECTOR3;
244 
245  }
246  return PARM_UNSUPPORTED;
247  }
248 
249  // Boiler plate to load individual types.
250  static void loadData(UT_IStream &is, int64 &v)
251  { is.bread(&v, 1); }
252  static void loadData(UT_IStream &is, bool &v)
253  { int64 iv; is.bread(&iv, 1); v = iv; }
254  static void loadData(UT_IStream &is, fpreal64 &v)
255  { is.bread<fpreal64>(&v, 1); }
256  static void loadData(UT_IStream &is, UT_Vector2D &v)
257  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
258  static void loadData(UT_IStream &is, UT_Vector3D &v)
259  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
260  is.bread<fpreal64>(&v.z(), 1); }
261  static void loadData(UT_IStream &is, UT_Vector4D &v)
262  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
263  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
264  static void loadData(UT_IStream &is, UT_Matrix2D &v)
265  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
266  static void loadData(UT_IStream &is, UT_Matrix3D &v)
267  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
268  static void loadData(UT_IStream &is, UT_Matrix4D &v)
269  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
270  static void loadData(UT_IStream &is, UT_Vector2I &v)
271  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
272  static void loadData(UT_IStream &is, UT_Vector3I &v)
273  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
274  is.bread<int64>(&v.z(), 1); }
275  static void loadData(UT_IStream &is, UT_Vector4I &v)
276  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
277  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
279  { is.bread(v); }
281  { UT_StringHolder rampdata;
282  loadData(is, rampdata);
283  if (rampdata.isstring())
284  {
285  v.reset(new UT_Ramp());
286  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
287  v->load(istr);
288  }
289  else v.reset();
290  }
293  loadData(is, data);
294  if (data.isstring())
295  {
296  // Find the data type.
297  const char *colon = UT_StringWrap(data).findChar(':');
298  if (colon)
299  {
300  int typelen = colon - data.buffer();
302  type.strncpy(data.buffer(), typelen);
303  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
304 
305  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
306  }
307  }
308  else v.reset();
309  }
310 
311  static void saveData(std::ostream &os, int64 v)
312  { UTwrite(os, &v); }
313  static void saveData(std::ostream &os, bool v)
314  { int64 iv = v; UTwrite(os, &iv); }
315  static void saveData(std::ostream &os, fpreal64 v)
316  { UTwrite<fpreal64>(os, &v); }
317  static void saveData(std::ostream &os, UT_Vector2D v)
318  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
319  static void saveData(std::ostream &os, UT_Vector3D v)
320  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
321  UTwrite<fpreal64>(os, &v.z()); }
322  static void saveData(std::ostream &os, UT_Vector4D v)
323  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
324  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
325  static void saveData(std::ostream &os, UT_Matrix2D v)
327  static void saveData(std::ostream &os, UT_Matrix3D v)
329  static void saveData(std::ostream &os, UT_Matrix4D v)
331  static void saveData(std::ostream &os, UT_StringHolder s)
332  { UT_StringWrap(s).saveBinary(os); }
333  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
335  UT_OStringStream ostr;
336  if (s) s->save(ostr);
337  result = ostr.str();
338  saveData(os, result);
339  }
340  static void saveData(std::ostream &os, PRM_DataItemHandle s)
342  UT_OStringStream ostr;
343  if (s)
344  {
345  ostr << s->getDataTypeToken();
346  ostr << ":";
347  s->saveBinary(ostr);
348  }
349  result = ostr.str();
350  saveData(os, result);
351  }
352 
353 
354  void save(std::ostream &os) const
355  {
356  int32 v = version();
357  UTwrite(os, &v);
358  saveData(os, myGroup);
359  saveData(os, myComp);
360  saveData(os, myValue);
361  saveData(os, myVoxelpad);
362 
363  }
364 
365  bool load(UT_IStream &is)
366  {
367  int32 v;
368  is.bread(&v, 1);
369  if (version() != v)
370  {
371  // Fail incompatible versions
372  return false;
373  }
374  loadData(is, myGroup);
375  loadData(is, myComp);
376  loadData(is, myValue);
377  loadData(is, myVoxelpad);
378 
379  return true;
380  }
381 
382  const UT_StringHolder & getGroup() const { return myGroup; }
383  void setGroup(const UT_StringHolder & val) { myGroup = val; }
385  {
386  SOP_Node *thissop = cookparms.getNode();
387  if (!thissop) return getGroup();
389  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
390  return result;
391  }
392  Comp getComp() const { return Comp(myComp); }
393  void setComp(Comp val) { myComp = int64(val); }
394  Comp opComp(const SOP_NodeVerb::CookParms &cookparms) const
395  {
396  SOP_Node *thissop = cookparms.getNode();
397  if (!thissop) return getComp();
398  int64 result;
399  OP_Utils::evalOpParm(result, thissop, "comp", cookparms.getCookTime(), 0);
400  return Comp(result);
401  }
402  fpreal64 getValue() const { return myValue; }
403  void setValue(fpreal64 val) { myValue = val; }
404  fpreal64 opValue(const SOP_NodeVerb::CookParms &cookparms) const
405  {
406  SOP_Node *thissop = cookparms.getNode();
407  if (!thissop) return getValue();
409  OP_Utils::evalOpParm(result, thissop, "value", cookparms.getCookTime(), 0);
410  return result;
411  }
412  UT_Vector3D getVoxelpad() const { return myVoxelpad; }
413  void setVoxelpad(UT_Vector3D val) { myVoxelpad = val; }
415  {
416  SOP_Node *thissop = cookparms.getNode();
417  if (!thissop) return getVoxelpad();
419  OP_Utils::evalOpParm(result, thissop, "voxelpad", cookparms.getCookTime(), 0);
420  return result;
421  }
422 
423 private:
424  UT_StringHolder myGroup;
425  int64 myComp;
426  fpreal64 myValue;
427  UT_Vector3D myVoxelpad;
428 
429 };
GLdouble s
Definition: glew.h:1390
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
Comp opComp(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, fpreal64 &v)
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
bool operator!=(const SOP_VolumeBoundParms &src) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
GLuint const GLfloat * val
Definition: glew.h:2794
void setValue(fpreal64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
fpreal64 getValue() const
An output stream object that owns its own string buffer storage.
const GLdouble * v
Definition: glew.h:1391
bool operator==(const SOP_VolumeBoundParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
double fpreal64
Definition: SYS_Types.h:201
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
UT_Vector3D opVoxelpad(const SOP_NodeVerb::CookParms &cookparms) const
void save(std::ostream &os) const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void loadFromOpSubclass(const LoadParms &loadparms) override
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
exint length() const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
static void saveData(std::ostream &os, UT_Vector4D v)
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, bool v)
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
bool load(UT_IStream &is)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
const GLfloat * c
Definition: glew.h:16296
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void saveData(std::ostream &os, UT_Matrix3D v)
fpreal64 opValue(const SOP_NodeVerb::CookParms &cookparms) const
long long int64
Definition: SYS_Types.h:116
const UT_StringHolder & getGroup() const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
UT_Vector3T< fpreal64 > UT_Vector3D
void copyFrom(const SOP_NodeParms *src) override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void setVoxelpad(UT_Vector3D val)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
static void saveData(std::ostream &os, fpreal64 v)
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
static void saveData(std::ostream &os, UT_StringHolder s)
const char * getNestParmName(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, UT_Vector3D v)
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
fpreal64 fpreal
Definition: SYS_Types.h:277
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void saveData(std::ostream &os, UT_Vector2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
#define SOP_API
Definition: SOP_API.h:10
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
ParmType getNestParmType(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
exint getNestNumParms(TempIndex idx) const override
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
static void saveData(std::ostream &os, int64 v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
GLuint64EXT * result
Definition: glew.h:14007
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, int64 &v)
UT_Vector3D getVoxelpad() const
GLsizei const GLfloat * value
Definition: glew.h:1849
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override