HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Reverse.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_ReverseEnums
22 {
23  enum class Vtxsort
24  {
25  SAMEVERTEX = 0,
26  REVERSE,
27  REVERSEU,
28  REVERSEV,
29  SWAPUV,
30  SHIFT
31  };
32 }
33 
34 
36 {
37 public:
38  static int version() { return 1; }
39 
41  {
42  myGroup = ""_sh;
43  myVtxsort = 2;
44  myVtxuoff = 0;
45  myVtxvoff = 0;
46 
47  }
48 
49  explicit SOP_ReverseParms(const SOP_ReverseParms &) = default;
50 
51  virtual ~SOP_ReverseParms() {}
52 
53  bool operator==(const SOP_ReverseParms &src) const
54  {
55  if (myGroup != src.myGroup) return false;
56  if (myVtxsort != src.myVtxsort) return false;
57  if (myVtxuoff != src.myVtxuoff) return false;
58  if (myVtxvoff != src.myVtxvoff) return false;
59 
60  return true;
61  }
63 
64 
65 
66  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
67  {
68  if (true)
69  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
70  else myGroup = ""_sh;
71  if (true)
72  OP_Utils::evalOpParm(myVtxsort, node, "vtxsort", time, 0);
73  else myVtxsort = 2;
74  if (true && ( (!(((int64(getVtxsort())!=5)))) ) )
75  OP_Utils::evalOpParm(myVtxuoff, node, "vtxuoff", time, 0);
76  else myVtxuoff = 0;
77  if (true && ( (!(((int64(getVtxsort())!=5)))) ) )
78  OP_Utils::evalOpParm(myVtxvoff, node, "vtxvoff", time, 0);
79  else myVtxvoff = 0;
80 
81  }
82 
83 
84  virtual void loadFromOpSubclass(const LoadParms &loadparms)
85  {
86  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
87  }
88 
89 
90  virtual void copyFrom(const SOP_NodeParms *src)
91  {
92  *this = *((const SOP_ReverseParms *)src);
93  }
94 
95  template <typename T>
96  void
97  doGetParmValue(exint idx, T &value) const
98  {
99  switch (idx)
100  {
101  case 0:
102  coerceValue(value, myGroup);
103  break;
104  case 1:
105  coerceValue(value, myVtxsort);
106  break;
107  case 2:
108  coerceValue(value, myVtxuoff);
109  break;
110  case 3:
111  coerceValue(value, myVtxvoff);
112  break;
113 
114  }
115  }
116 
117  void getParmValue(exint idx, exint &value) const
118  { doGetParmValue(idx, value); }
119  void getParmValue(exint idx, fpreal &value) const
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
126  { doGetParmValue(idx, value); }
128  { doGetParmValue(idx, value); }
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
134  { doGetParmValue(idx, value); }
136  { doGetParmValue(idx, value); }
138  { doGetParmValue(idx, value); }
139 
140  template <typename T>
141  void
142  doSetParmValue(exint idx, const T &value)
143  {
144  switch (idx)
145  {
146  case 0:
147  coerceValue(myGroup, value);
148  break;
149  case 1:
150  coerceValue(myVtxsort, value);
151  break;
152  case 2:
153  coerceValue(myVtxuoff, value);
154  break;
155  case 3:
156  coerceValue(myVtxvoff, value);
157  break;
158 
159  }
160  }
161 
162  void setParmValue(exint idx, const exint &value)
163  { doSetParmValue(idx, value); }
164  void setParmValue(exint idx, const fpreal &value)
165  { doSetParmValue(idx, value); }
166  void setParmValue(exint idx, const UT_Vector2D &value)
167  { doSetParmValue(idx, value); }
168  void setParmValue(exint idx, const UT_Vector3D &value)
169  { doSetParmValue(idx, value); }
170  void setParmValue(exint idx, const UT_Vector4D &value)
171  { doSetParmValue(idx, value); }
172  void setParmValue(exint idx, const UT_Matrix2D &value)
173  { doSetParmValue(idx, value); }
174  void setParmValue(exint idx, const UT_Matrix3D &value)
175  { doSetParmValue(idx, value); }
176  void setParmValue(exint idx, const UT_Matrix4D &value)
177  { doSetParmValue(idx, value); }
179  { doSetParmValue(idx, value); }
181  { doSetParmValue(idx, value); }
183  { doSetParmValue(idx, value); }
184 
185  virtual exint getNumParms() const
186  {
187  return 4;
188  }
189 
190  virtual const char *getParmName(exint fieldnum) const
191  {
192  switch (fieldnum)
193  {
194  case 0:
195  return "group";
196  case 1:
197  return "vtxsort";
198  case 2:
199  return "vtxuoff";
200  case 3:
201  return "vtxvoff";
202 
203  }
204  return 0;
205  }
206 
207  virtual ParmType getParmType(exint fieldnum) const
208  {
209  switch (fieldnum)
210  {
211  case 0:
212  return PARM_STRING;
213  case 1:
214  return PARM_INTEGER;
215  case 2:
216  return PARM_INTEGER;
217  case 3:
218  return PARM_INTEGER;
219 
220  }
221  return PARM_UNSUPPORTED;
222  }
223 
224  // Boiler plate to load individual types.
225  static void loadData(UT_IStream &is, int64 &v)
226  { is.bread(&v, 1); }
227  static void loadData(UT_IStream &is, bool &v)
228  { int64 iv; is.bread(&iv, 1); v = iv; }
229  static void loadData(UT_IStream &is, fpreal64 &v)
230  { is.bread<fpreal64>(&v, 1); }
231  static void loadData(UT_IStream &is, UT_Vector2D &v)
232  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
233  static void loadData(UT_IStream &is, UT_Vector3D &v)
234  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
235  is.bread<fpreal64>(&v.z(), 1); }
236  static void loadData(UT_IStream &is, UT_Vector4D &v)
237  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
238  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
239  static void loadData(UT_IStream &is, UT_Matrix2D &v)
240  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
241  static void loadData(UT_IStream &is, UT_Matrix3D &v)
242  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
243  static void loadData(UT_IStream &is, UT_Matrix4D &v)
244  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
245  static void loadData(UT_IStream &is, UT_Vector2I &v)
246  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
247  static void loadData(UT_IStream &is, UT_Vector3I &v)
248  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
249  is.bread<int64>(&v.z(), 1); }
250  static void loadData(UT_IStream &is, UT_Vector4I &v)
251  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
252  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
254  { is.bread(v); }
256  { UT_StringHolder rampdata;
257  loadData(is, rampdata);
258  if (rampdata.isstring())
259  {
260  v.reset(new UT_Ramp());
261  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
262  v->load(istr);
263  }
264  else v.reset();
265  }
268  loadData(is, data);
269  if (data.isstring())
270  {
271  // Find the data type.
272  char *colon = UT_StringWrap(data).findChar(':');
273  if (colon)
274  {
275  int typelen = colon - data.buffer();
277  type.strncpy(data.buffer(), typelen);
278  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
279 
280  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
281  }
282  }
283  else v.reset();
284  }
285 
286  static void saveData(std::ostream &os, int64 v)
287  { UTwrite(os, &v); }
288  static void saveData(std::ostream &os, bool v)
289  { int64 iv = v; UTwrite(os, &iv); }
290  static void saveData(std::ostream &os, fpreal64 v)
291  { UTwrite<fpreal64>(os, &v); }
292  static void saveData(std::ostream &os, UT_Vector2D v)
293  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
294  static void saveData(std::ostream &os, UT_Vector3D v)
295  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
296  UTwrite<fpreal64>(os, &v.z()); }
297  static void saveData(std::ostream &os, UT_Vector4D v)
298  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
299  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
300  static void saveData(std::ostream &os, UT_Matrix2D v)
302  static void saveData(std::ostream &os, UT_Matrix3D v)
304  static void saveData(std::ostream &os, UT_Matrix4D v)
306  static void saveData(std::ostream &os, UT_StringHolder s)
307  { UT_StringWrap(s).saveBinary(os); }
308  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
309  { UT_StringHolder result;
310  UT_OStringStream ostr;
311  if (s) s->save(ostr);
312  result = ostr.str();
313  saveData(os, result);
314  }
315  static void saveData(std::ostream &os, PRM_DataItemHandle s)
316  { UT_StringHolder result;
317  UT_OStringStream ostr;
318  if (s)
319  {
320  ostr << s->getDataTypeToken();
321  ostr << ":";
322  s->saveBinary(ostr);
323  }
324  result = ostr.str();
325  saveData(os, result);
326  }
327 
328 
329  void save(std::ostream &os) const
330  {
331  int32 v = version();
332  UTwrite(os, &v);
333  saveData(os, myGroup);
334  saveData(os, myVtxsort);
335  saveData(os, myVtxuoff);
336  saveData(os, myVtxvoff);
337 
338  }
339 
340  bool load(UT_IStream &is)
341  {
342  int32 v;
343  is.bread(&v, 1);
344  if (version() != v)
345  {
346  // Fail incompatible versions
347  return false;
348  }
349  loadData(is, myGroup);
350  loadData(is, myVtxsort);
351  loadData(is, myVtxuoff);
352  loadData(is, myVtxvoff);
353 
354  return true;
355  }
356 
357  const UT_StringHolder & getGroup() const { return myGroup; }
358  void setGroup(const UT_StringHolder & val) { myGroup = val; }
360  {
361  SOP_Node *thissop = cookparms.getNode();
362  if (!thissop) return getGroup();
363  UT_StringHolder result;
364  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
365  return result;
366  }
367  Vtxsort getVtxsort() const { return Vtxsort(myVtxsort); }
368  void setVtxsort(Vtxsort val) { myVtxsort = int64(val); }
369  Vtxsort opVtxsort(const SOP_NodeVerb::CookParms &cookparms) const
370  {
371  SOP_Node *thissop = cookparms.getNode();
372  if (!thissop) return getVtxsort();
373  int64 result;
374  OP_Utils::evalOpParm(result, thissop, "vtxsort", cookparms.getCookTime(), 0);
375  return Vtxsort(result);
376  }
377  int64 getVtxuoff() const { return myVtxuoff; }
378  void setVtxuoff(int64 val) { myVtxuoff = val; }
379  int64 opVtxuoff(const SOP_NodeVerb::CookParms &cookparms) const
380  {
381  SOP_Node *thissop = cookparms.getNode();
382  if (!thissop) return getVtxuoff();
383  int64 result;
384  OP_Utils::evalOpParm(result, thissop, "vtxuoff", cookparms.getCookTime(), 0);
385  return result;
386  }
387  int64 getVtxvoff() const { return myVtxvoff; }
388  void setVtxvoff(int64 val) { myVtxvoff = val; }
389  int64 opVtxvoff(const SOP_NodeVerb::CookParms &cookparms) const
390  {
391  SOP_Node *thissop = cookparms.getNode();
392  if (!thissop) return getVtxvoff();
393  int64 result;
394  OP_Utils::evalOpParm(result, thissop, "vtxvoff", cookparms.getCookTime(), 0);
395  return result;
396  }
397 
398 private:
399  UT_StringHolder myGroup;
400  int64 myVtxsort;
401  int64 myVtxuoff;
402  int64 myVtxvoff;
403 
404 };
static void saveData(std::ostream &os, UT_Matrix3D v)
void getParmValue(exint idx, UT_Vector4D &value) const
void setVtxvoff(int64 val)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setParmValue(exint idx, const UT_Matrix2D &value)
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setParmValue(exint idx, const exint &value)
int64 opVtxuoff(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector4D v)
virtual void copyFrom(const SOP_NodeParms *src)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
void setParmValue(exint idx, const UT_Matrix4D &value)
T & z(void)
Definition: UT_Vector4.h:372
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
const UT_StringHolder & getGroup() const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void getParmValue(exint idx, exint &value) const
T & x(void)
Definition: UT_Vector2.h:284
virtual ParmType getParmType(exint fieldnum) const
static void saveData(std::ostream &os, UT_Vector3D v)
void setParmValue(exint idx, const UT_StringHolder &value)
An output stream object that owns its own string buffer storage.
int64 getVtxuoff() const
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, int64 &v)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setParmValue(exint idx, const fpreal &value)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
void setParmValue(exint idx, const UT_Vector3D &value)
void getParmValue(exint idx, fpreal &value) const
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:106
void save(std::ostream &os) const
Vtxsort opVtxsort(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_Vector2D &value)
exint length() const
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, bool v)
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, bool &v)
int64 exint
Definition: SYS_Types.h:115
Vtxsort getVtxsort() const
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void getParmValue(exint idx, UT_StringHolder &value) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const UT_Vector4D &value)
void getParmValue(exint idx, UT_Vector3D &value) const
static int version()
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void saveData(std::ostream &os, int64 v)
bool operator==(const SOP_ReverseParms &src) const
virtual exint getNumParms() const
static void loadData(UT_IStream &is, UT_Vector4I &v)
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
virtual const char * getParmName(exint fieldnum) const
static void saveData(std::ostream &os, UT_Matrix2D v)
virtual ~SOP_ReverseParms()
void setVtxsort(Vtxsort val)
int64 opVtxvoff(const SOP_NodeVerb::CookParms &cookparms) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
bool load(UT_IStream &is)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void setVtxuoff(int64 val)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
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 doGetParmValue(exint idx, T &value) const
void getParmValue(exint idx, UT_Vector2D &value) const
static void saveData(std::ostream &os, UT_Matrix4D v)
int64 getVtxvoff() const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setParmValue(exint idx, const UT_Matrix3D &value)
GLuint GLfloat * val
Definition: glcorearb.h:1607
void setGroup(const UT_StringHolder &val)
#define SOP_API
Definition: SOP_API.h:10
const char * buffer() const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
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_Vector3I &v)
T & y(void)
Definition: UT_Vector2.h:286
static void saveData(std::ostream &os, fpreal64 v)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
GLboolean r
Definition: glcorearb.h:1221
static void loadData(UT_IStream &is, UT_StringHolder &v)
T & w(void)
Definition: UT_Vector4.h:374
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, UT_Vector2D v)
void getParmValue(exint idx, UT_Matrix4D &value) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
void getParmValue(exint idx, UT_Matrix2D &value) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
void getParmValue(exint idx, UT_Matrix3D &value) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
GLenum src
Definition: glcorearb.h:1792