HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_VolumeSplice.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  myDeleteorig = false;
31 
32  }
33 
34  explicit SOP_VolumeSpliceParms(const SOP_VolumeSpliceParms &) = default;
35 
37 
39  {
40  if (myGroup != src.myGroup) return false;
41  if (myDeleteorig != src.myDeleteorig) return false;
42 
43  return true;
44  }
45 
46 
47 
48  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
49  {
50  if (true)
51  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
52  else myGroup = ""_sh;
53  if (true)
54  OP_Utils::evalOpParm(myDeleteorig, node, "deleteorig", time, 0);
55  else myDeleteorig = false;
56 
57  }
58 
59 
60  virtual void loadFromOpSubclass(const LoadParms &loadparms)
61  {
62  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
63  }
64 
65 
66  virtual void copyFrom(const SOP_NodeParms *src)
67  {
68  *this = *((const SOP_VolumeSpliceParms *)src);
69  }
70 
71  template <typename T>
72  void
73  doGetParmValue(exint idx, T &value) const
74  {
75  switch (idx)
76  {
77  case 0:
78  coerceValue(value, myGroup);
79  break;
80  case 1:
81  coerceValue(value, myDeleteorig);
82  break;
83 
84  }
85  }
86 
87  void getParmValue(exint idx, exint &value) const
88  { doGetParmValue(idx, value); }
89  void getParmValue(exint idx, fpreal &value) const
90  { doGetParmValue(idx, value); }
91  void getParmValue(exint idx, UT_Vector2D &value) const
92  { doGetParmValue(idx, value); }
93  void getParmValue(exint idx, UT_Vector3D &value) const
94  { doGetParmValue(idx, value); }
95  void getParmValue(exint idx, UT_Vector4D &value) const
96  { doGetParmValue(idx, value); }
97  void getParmValue(exint idx, UT_Matrix2D &value) const
98  { doGetParmValue(idx, value); }
99  void getParmValue(exint idx, UT_Matrix3D &value) const
100  { doGetParmValue(idx, value); }
102  { doGetParmValue(idx, value); }
104  { doGetParmValue(idx, value); }
106  { doGetParmValue(idx, value); }
108  { doGetParmValue(idx, value); }
109 
110  template <typename T>
111  void
112  doSetParmValue(exint idx, const T &value)
113  {
114  switch (idx)
115  {
116  case 0:
117  coerceValue(myGroup, value);
118  break;
119  case 1:
120  coerceValue(myDeleteorig, value);
121  break;
122 
123  }
124  }
125 
126  void setParmValue(exint idx, const exint &value)
127  { doSetParmValue(idx, value); }
128  void setParmValue(exint idx, const fpreal &value)
129  { doSetParmValue(idx, value); }
130  void setParmValue(exint idx, const UT_Vector2D &value)
131  { doSetParmValue(idx, value); }
132  void setParmValue(exint idx, const UT_Vector3D &value)
133  { doSetParmValue(idx, value); }
134  void setParmValue(exint idx, const UT_Vector4D &value)
135  { doSetParmValue(idx, value); }
136  void setParmValue(exint idx, const UT_Matrix2D &value)
137  { doSetParmValue(idx, value); }
138  void setParmValue(exint idx, const UT_Matrix3D &value)
139  { doSetParmValue(idx, value); }
140  void setParmValue(exint idx, const UT_Matrix4D &value)
141  { doSetParmValue(idx, value); }
143  { doSetParmValue(idx, value); }
145  { doSetParmValue(idx, value); }
147  { doSetParmValue(idx, value); }
148 
149  virtual exint getNumParms() const
150  {
151  return 2;
152  }
153 
154  virtual const char *getParmName(exint fieldnum) const
155  {
156  switch (fieldnum)
157  {
158  case 0:
159  return "group";
160  case 1:
161  return "deleteorig";
162 
163  }
164  return 0;
165  }
166 
167  virtual ParmType getParmType(exint fieldnum) const
168  {
169  switch (fieldnum)
170  {
171  case 0:
172  return PARM_STRING;
173  case 1:
174  return PARM_INTEGER;
175 
176  }
177  return PARM_UNSUPPORTED;
178  }
179 
180  // Boiler plate to load individual types.
181  static void loadData(UT_IStream &is, int64 &v)
182  { is.bread(&v, 1); }
183  static void loadData(UT_IStream &is, bool &v)
184  { int64 iv; is.bread(&iv, 1); v = iv; }
185  static void loadData(UT_IStream &is, fpreal64 &v)
186  { is.bread<fpreal64>(&v, 1); }
187  static void loadData(UT_IStream &is, UT_Vector2D &v)
188  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
189  static void loadData(UT_IStream &is, UT_Vector3D &v)
190  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
191  is.bread<fpreal64>(&v.z(), 1); }
192  static void loadData(UT_IStream &is, UT_Vector4D &v)
193  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
194  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
195  static void loadData(UT_IStream &is, UT_Matrix2D &v)
196  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
197  static void loadData(UT_IStream &is, UT_Matrix3D &v)
198  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
199  static void loadData(UT_IStream &is, UT_Matrix4D &v)
200  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
201  static void loadData(UT_IStream &is, UT_Vector2I &v)
202  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
203  static void loadData(UT_IStream &is, UT_Vector3I &v)
204  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
205  is.bread<int64>(&v.z(), 1); }
206  static void loadData(UT_IStream &is, UT_Vector4I &v)
207  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
208  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
210  { is.bread(v); }
212  { UT_StringHolder rampdata;
213  loadData(is, rampdata);
214  if (rampdata.isstring())
215  {
216  v.reset(new UT_Ramp());
217  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
218  v->load(istr);
219  }
220  else v.reset();
221  }
224  loadData(is, data);
225  if (data.isstring())
226  {
227  // Find the data type.
228  char *colon = UT_StringWrap(data).findChar(':');
229  if (colon)
230  {
231  int typelen = colon - data.buffer();
233  type.strncpy(data.buffer(), typelen);
234  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
235 
236  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
237  }
238  }
239  else v.reset();
240  }
241 
242  static void saveData(std::ostream &os, int64 v)
243  { UTwrite(os, &v); }
244  static void saveData(std::ostream &os, bool v)
245  { int64 iv = v; UTwrite(os, &iv); }
246  static void saveData(std::ostream &os, fpreal64 v)
247  { UTwrite<fpreal64>(os, &v); }
248  static void saveData(std::ostream &os, UT_Vector2D v)
249  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
250  static void saveData(std::ostream &os, UT_Vector3D v)
251  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
252  UTwrite<fpreal64>(os, &v.z()); }
253  static void saveData(std::ostream &os, UT_Vector4D v)
254  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
255  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
256  static void saveData(std::ostream &os, UT_Matrix2D v)
258  static void saveData(std::ostream &os, UT_Matrix3D v)
260  static void saveData(std::ostream &os, UT_Matrix4D v)
262  static void saveData(std::ostream &os, UT_StringHolder s)
263  { UT_StringWrap(s).saveBinary(os); }
264  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
265  { UT_StringHolder result;
266  UT_OStringStream ostr;
267  if (s) s->save(ostr);
268  result = ostr.str();
269  saveData(os, result);
270  }
271  static void saveData(std::ostream &os, PRM_DataItemHandle s)
272  { UT_StringHolder result;
273  UT_OStringStream ostr;
274  if (s)
275  {
276  ostr << s->getDataTypeToken();
277  ostr << ":";
278  s->saveBinary(ostr);
279  }
280  result = ostr.str();
281  saveData(os, result);
282  }
283 
284 
285  void save(std::ostream &os) const
286  {
287  int32 v = version();
288  UTwrite(os, &v);
289  saveData(os, myGroup);
290  saveData(os, myDeleteorig);
291 
292  }
293 
294  bool load(UT_IStream &is)
295  {
296  int32 v;
297  is.bread(&v, 1);
298  if (version() != v)
299  {
300  // Fail incompatible versions
301  return false;
302  }
303  loadData(is, myGroup);
304  loadData(is, myDeleteorig);
305 
306  return true;
307  }
308 
309  const UT_StringHolder & getGroup() const { return myGroup; }
310  void setGroup(const UT_StringHolder & val) { myGroup = val; }
312  {
313  SOP_Node *thissop = cookparms.getNode();
314  if (!thissop) return getGroup();
315  UT_StringHolder result;
316  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
317  return result;
318  }
319  bool getDeleteorig() const { return myDeleteorig; }
320  void setDeleteorig(bool val) { myDeleteorig = val; }
321  bool opDeleteorig(const SOP_NodeVerb::CookParms &cookparms) const
322  {
323  SOP_Node *thissop = cookparms.getNode();
324  if (!thissop) return getDeleteorig();
325  bool result;
326  OP_Utils::evalOpParm(result, thissop, "deleteorig", cookparms.getCookTime(), 0);
327  return result;
328  }
329 
330 private:
331  UT_StringHolder myGroup;
332  bool myDeleteorig;
333 
334 };
void setParmValue(exint idx, const UT_Vector2D &value)
static void loadData(UT_IStream &is, fpreal64 &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
bool operator==(const SOP_VolumeSpliceParms &src) const
exint bread(int32 *buffer, exint asize=1)
void setGroup(const UT_StringHolder &val)
void setParmValue(exint idx, const fpreal &value)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void saveData(std::ostream &os, int64 v)
void getParmValue(exint idx, UT_Matrix3D &value) const
T & x(void)
Definition: UT_Vector2.h:284
void getParmValue(exint idx, PRM_DataItemHandle &value) const
An output stream object that owns its own string buffer storage.
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
virtual exint getNumParms() const
void setParmValue(exint idx, const UT_Matrix4D &value)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void saveData(std::ostream &os, bool v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void doSetParmValue(exint idx, const T &value)
void setParmValue(exint idx, const UT_Matrix2D &value)
virtual const char * getParmName(exint fieldnum) const
static void loadData(UT_IStream &is, bool &v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void saveData(std::ostream &os, UT_StringHolder s)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:106
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setParmValue(exint idx, const UT_Matrix3D &value)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
bool opDeleteorig(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Vector4D v)
exint length() const
static void loadData(UT_IStream &is, UT_StringHolder &v)
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
static void saveData(std::ostream &os, UT_Matrix2D v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
int64 exint
Definition: SYS_Types.h:115
void getParmValue(exint idx, exint &value) const
void getParmValue(exint idx, UT_Matrix4D &value) const
void setParmValue(exint idx, const exint &value)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
static void saveData(std::ostream &os, UT_Vector3D v)
void save(std::ostream &os) const
static void saveData(std::ostream &os, UT_Matrix4D v)
GLboolean * data
Definition: glcorearb.h:130
const UT_StringHolder & getGroup() const
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
static void loadData(UT_IStream &is, UT_Vector3D &v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void doGetParmValue(exint idx, T &value) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
static void saveData(std::ostream &os, UT_Matrix3D v)
void getParmValue(exint idx, UT_Vector4D &value) const
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_Vector2D &value) const
virtual void copyFrom(const SOP_NodeParms *src)
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, UT_Matrix3D &v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
void getParmValue(exint idx, UT_StringHolder &value) const
const char * buffer() const
void getParmValue(exint idx, UT_Vector3D &value) const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
bool load(UT_IStream &is)
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
void setParmValue(exint idx, const UT_Vector3D &value)
void getParmValue(exint idx, fpreal &value) const
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:374
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
void getParmValue(exint idx, UT_Matrix2D &value) const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
virtual ParmType getParmType(exint fieldnum) const
void setParmValue(exint idx, const UT_StringHolder &value)
void setParmValue(exint idx, const UT_Vector4D &value)
GLenum src
Definition: glcorearb.h:1792