HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  }
62  bool operator!=(const SOP_ReverseParms &src) const
63  {
64  return !operator==(src);
65  }
67 
68 
69 
70  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
71  {
72  if (true)
73  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
74  else myGroup = ""_sh;
75  if (true)
76  OP_Utils::evalOpParm(myVtxsort, node, "vtxsort", time, 0);
77  else myVtxsort = 2;
78  if (true && ( (!(((int64(getVtxsort())!=5)))) ) )
79  OP_Utils::evalOpParm(myVtxuoff, node, "vtxuoff", time, 0);
80  else myVtxuoff = 0;
81  if (true && ( (!(((int64(getVtxsort())!=5)))) ) )
82  OP_Utils::evalOpParm(myVtxvoff, node, "vtxvoff", time, 0);
83  else myVtxvoff = 0;
84 
85  }
86 
87 
88  virtual void loadFromOpSubclass(const LoadParms &loadparms)
89  {
90  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
91  }
92 
93 
94  virtual void copyFrom(const SOP_NodeParms *src)
95  {
96  *this = *((const SOP_ReverseParms *)src);
97  }
98 
99  template <typename T>
100  void
101  doGetParmValue(exint idx, T &value) const
102  {
103  switch (idx)
104  {
105  case 0:
106  coerceValue(value, myGroup);
107  break;
108  case 1:
109  coerceValue(value, myVtxsort);
110  break;
111  case 2:
112  coerceValue(value, myVtxuoff);
113  break;
114  case 3:
115  coerceValue(value, myVtxvoff);
116  break;
117 
118  }
119  }
120 
121  void getParmValue(exint idx, exint &value) const
122  { doGetParmValue(idx, value); }
123  void getParmValue(exint idx, fpreal &value) const
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); }
140  { doGetParmValue(idx, value); }
142  { doGetParmValue(idx, value); }
143 
144  template <typename T>
145  void
146  doSetParmValue(exint idx, const T &value)
147  {
148  switch (idx)
149  {
150  case 0:
151  coerceValue(myGroup, value);
152  break;
153  case 1:
154  coerceValue(myVtxsort, value);
155  break;
156  case 2:
157  coerceValue(myVtxuoff, value);
158  break;
159  case 3:
160  coerceValue(myVtxvoff, value);
161  break;
162 
163  }
164  }
165 
166  void setParmValue(exint idx, const exint &value)
167  { doSetParmValue(idx, value); }
168  void setParmValue(exint idx, const fpreal &value)
169  { doSetParmValue(idx, value); }
170  void setParmValue(exint idx, const UT_Vector2D &value)
171  { doSetParmValue(idx, value); }
172  void setParmValue(exint idx, const UT_Vector3D &value)
173  { doSetParmValue(idx, value); }
174  void setParmValue(exint idx, const UT_Vector4D &value)
175  { doSetParmValue(idx, value); }
176  void setParmValue(exint idx, const UT_Matrix2D &value)
177  { doSetParmValue(idx, value); }
178  void setParmValue(exint idx, const UT_Matrix3D &value)
179  { doSetParmValue(idx, value); }
180  void setParmValue(exint idx, const UT_Matrix4D &value)
181  { doSetParmValue(idx, value); }
183  { doSetParmValue(idx, value); }
185  { doSetParmValue(idx, value); }
187  { doSetParmValue(idx, value); }
188 
189  virtual exint getNumParms() const
190  {
191  return 4;
192  }
193 
194  virtual const char *getParmName(exint fieldnum) const
195  {
196  switch (fieldnum)
197  {
198  case 0:
199  return "group";
200  case 1:
201  return "vtxsort";
202  case 2:
203  return "vtxuoff";
204  case 3:
205  return "vtxvoff";
206 
207  }
208  return 0;
209  }
210 
211  virtual ParmType getParmType(exint fieldnum) const
212  {
213  switch (fieldnum)
214  {
215  case 0:
216  return PARM_STRING;
217  case 1:
218  return PARM_INTEGER;
219  case 2:
220  return PARM_INTEGER;
221  case 3:
222  return PARM_INTEGER;
223 
224  }
225  return PARM_UNSUPPORTED;
226  }
227 
228  // Boiler plate to load individual types.
229  static void loadData(UT_IStream &is, int64 &v)
230  { is.bread(&v, 1); }
231  static void loadData(UT_IStream &is, bool &v)
232  { int64 iv; is.bread(&iv, 1); v = iv; }
233  static void loadData(UT_IStream &is, fpreal64 &v)
234  { is.bread<fpreal64>(&v, 1); }
235  static void loadData(UT_IStream &is, UT_Vector2D &v)
236  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
237  static void loadData(UT_IStream &is, UT_Vector3D &v)
238  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
239  is.bread<fpreal64>(&v.z(), 1); }
240  static void loadData(UT_IStream &is, UT_Vector4D &v)
241  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
242  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
243  static void loadData(UT_IStream &is, UT_Matrix2D &v)
244  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
245  static void loadData(UT_IStream &is, UT_Matrix3D &v)
246  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
247  static void loadData(UT_IStream &is, UT_Matrix4D &v)
248  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
249  static void loadData(UT_IStream &is, UT_Vector2I &v)
250  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
251  static void loadData(UT_IStream &is, UT_Vector3I &v)
252  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
253  is.bread<int64>(&v.z(), 1); }
254  static void loadData(UT_IStream &is, UT_Vector4I &v)
255  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
256  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
258  { is.bread(v); }
260  { UT_StringHolder rampdata;
261  loadData(is, rampdata);
262  if (rampdata.isstring())
263  {
264  v.reset(new UT_Ramp());
265  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
266  v->load(istr);
267  }
268  else v.reset();
269  }
272  loadData(is, data);
273  if (data.isstring())
274  {
275  // Find the data type.
276  char *colon = UT_StringWrap(data).findChar(':');
277  if (colon)
278  {
279  int typelen = colon - data.buffer();
281  type.strncpy(data.buffer(), typelen);
282  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
283 
284  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
285  }
286  }
287  else v.reset();
288  }
289 
290  static void saveData(std::ostream &os, int64 v)
291  { UTwrite(os, &v); }
292  static void saveData(std::ostream &os, bool v)
293  { int64 iv = v; UTwrite(os, &iv); }
294  static void saveData(std::ostream &os, fpreal64 v)
295  { UTwrite<fpreal64>(os, &v); }
296  static void saveData(std::ostream &os, UT_Vector2D v)
297  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
298  static void saveData(std::ostream &os, UT_Vector3D v)
299  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
300  UTwrite<fpreal64>(os, &v.z()); }
301  static void saveData(std::ostream &os, UT_Vector4D v)
302  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
303  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
304  static void saveData(std::ostream &os, UT_Matrix2D v)
306  static void saveData(std::ostream &os, UT_Matrix3D v)
308  static void saveData(std::ostream &os, UT_Matrix4D v)
310  static void saveData(std::ostream &os, UT_StringHolder s)
311  { UT_StringWrap(s).saveBinary(os); }
312  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
313  { UT_StringHolder result;
314  UT_OStringStream ostr;
315  if (s) s->save(ostr);
316  result = ostr.str();
317  saveData(os, result);
318  }
319  static void saveData(std::ostream &os, PRM_DataItemHandle s)
320  { UT_StringHolder result;
321  UT_OStringStream ostr;
322  if (s)
323  {
324  ostr << s->getDataTypeToken();
325  ostr << ":";
326  s->saveBinary(ostr);
327  }
328  result = ostr.str();
329  saveData(os, result);
330  }
331 
332 
333  void save(std::ostream &os) const
334  {
335  int32 v = version();
336  UTwrite(os, &v);
337  saveData(os, myGroup);
338  saveData(os, myVtxsort);
339  saveData(os, myVtxuoff);
340  saveData(os, myVtxvoff);
341 
342  }
343 
344  bool load(UT_IStream &is)
345  {
346  int32 v;
347  is.bread(&v, 1);
348  if (version() != v)
349  {
350  // Fail incompatible versions
351  return false;
352  }
353  loadData(is, myGroup);
354  loadData(is, myVtxsort);
355  loadData(is, myVtxuoff);
356  loadData(is, myVtxvoff);
357 
358  return true;
359  }
360 
361  const UT_StringHolder & getGroup() const { return myGroup; }
362  void setGroup(const UT_StringHolder & val) { myGroup = val; }
364  {
365  SOP_Node *thissop = cookparms.getNode();
366  if (!thissop) return getGroup();
367  UT_StringHolder result;
368  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
369  return result;
370  }
371  Vtxsort getVtxsort() const { return Vtxsort(myVtxsort); }
372  void setVtxsort(Vtxsort val) { myVtxsort = int64(val); }
373  Vtxsort opVtxsort(const SOP_NodeVerb::CookParms &cookparms) const
374  {
375  SOP_Node *thissop = cookparms.getNode();
376  if (!thissop) return getVtxsort();
377  int64 result;
378  OP_Utils::evalOpParm(result, thissop, "vtxsort", cookparms.getCookTime(), 0);
379  return Vtxsort(result);
380  }
381  int64 getVtxuoff() const { return myVtxuoff; }
382  void setVtxuoff(int64 val) { myVtxuoff = val; }
383  int64 opVtxuoff(const SOP_NodeVerb::CookParms &cookparms) const
384  {
385  SOP_Node *thissop = cookparms.getNode();
386  if (!thissop) return getVtxuoff();
387  int64 result;
388  OP_Utils::evalOpParm(result, thissop, "vtxuoff", cookparms.getCookTime(), 0);
389  return result;
390  }
391  int64 getVtxvoff() const { return myVtxvoff; }
392  void setVtxvoff(int64 val) { myVtxvoff = val; }
393  int64 opVtxvoff(const SOP_NodeVerb::CookParms &cookparms) const
394  {
395  SOP_Node *thissop = cookparms.getNode();
396  if (!thissop) return getVtxvoff();
397  int64 result;
398  OP_Utils::evalOpParm(result, thissop, "vtxvoff", cookparms.getCookTime(), 0);
399  return result;
400  }
401 
402 private:
403  UT_StringHolder myGroup;
404  int64 myVtxsort;
405  int64 myVtxuoff;
406  int64 myVtxvoff;
407 
408 };
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:494
void setParmValue(exint idx, const UT_Matrix4D &value)
T & z(void)
Definition: UT_Vector4.h:379
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
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
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
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:498
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:502
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:107
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
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
static void loadData(UT_IStream &is, bool &v)
int64 exint
Definition: SYS_Types.h:116
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:192
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:35
T & y(void)
Definition: UT_Vector4.h:377
virtual const char * getParmName(exint fieldnum) const
bool operator!=(const SOP_ReverseParms &src) 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
GT_API const UT_StringHolder version
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:500
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
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
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:501
T & x(void)
Definition: UT_Vector4.h:375
static void loadData(UT_IStream &is, UT_Vector3I &v)
T & y(void)
Definition: UT_Vector2.h:287
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:381
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
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)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1792