HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_GroupDelete.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_GroupDeleteEnums
22 {
23  enum class Grouptype
24  {
25  ANY = 0,
26  POINTS,
27  PRIMS,
28  EDGES,
29  VERTICES
30  };
31 }
32 
33 
35 {
36 public:
37  static int version() { return 1; }
38  struct Deletions
39  {
40  bool enable;
43 
44 
46  {
47  enable = false;
48  grouptype = 0;
49  group = ""_sh;
50 
51  }
52 
53  bool operator==(const Deletions &src) const
54  {
55  if (enable != src.enable) return false;
56  if (grouptype != src.grouptype) return false;
57  if (group != src.group) return false;
58 
59  return true;
60  }
61  bool operator!=(const Deletions &src) const
62  {
63  return !operator==(src);
64  }
65 
66  };
67 
69  {
71 
72  buf.strcat("[ ");
73  for (int i = 0; i < list.entries(); i++)
74  {
75  if (i)
76  buf.strcat(", ");
77  buf.strcat("( ");
78  buf.append("");
79  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
80  buf.append(", ");
81  buf.appendSprintf("%d", (int) list(i).grouptype);
82  buf.append(", ");
83  { UT_String tmp; tmp = UT_StringWrap(list(i).group).makeQuotedString('"'); buf.strcat(tmp); }
84 
85  buf.strcat(" )");
86  }
87  buf.strcat(" ]");
88 
89  UT_StringHolder result = buf;
90  return result;
91  }
92 
94  {
95 
96  }
97 
98  explicit SOP_GroupDeleteParms(const SOP_GroupDeleteParms &) = default;
99 
101 
103  {
104  if (myDeletions != src.myDeletions) return false;
105 
106  return true;
107  }
109  {
110  return !operator==(src);
111  }
113 
114 
115 
116  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
117  {
118  if (true)
119  {
120  int64 length;
121  OP_Utils::evalOpParm(length, node, "deletions", time, 0);
122  myDeletions.entries(length);
123  for (exint i = 0; i < length; i++)
124  {
125  int parmidx = i+1;
126  auto && _curentry = myDeletions(i);
127  (void) _curentry;
128  if (true)
129  OP_Utils::evalOpParmInst(myDeletions(i).enable, node, "enable#", &parmidx, time, 0);
130  else myDeletions(i).enable = false;
131  if (true && ( (!(((_curentry.enable==0)))) ) )
132  OP_Utils::evalOpParmInst(myDeletions(i).grouptype, node, "grouptype#", &parmidx, time, 0);
133  else myDeletions(i).grouptype = 0;
134  if (true && ( (!(((_curentry.enable==0)))) ) )
135  OP_Utils::evalOpParmInst(myDeletions(i).group, node, "group#", &parmidx, time, 0);
136  else myDeletions(i).group = ""_sh;
137 
138  }
139  }
140  else
141  myDeletions.clear();
142 
143  }
144 
145 
146  virtual void loadFromOpSubclass(const LoadParms &loadparms)
147  {
148  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
149  }
150 
151 
152  virtual void copyFrom(const SOP_NodeParms *src)
153  {
154  *this = *((const SOP_GroupDeleteParms *)src);
155  }
156 
157  template <typename T>
158  void
159  doGetParmValue(exint idx, T &value) const
160  {
161  switch (idx)
162  {
163 
164  }
165  }
166 
167  void getParmValue(exint idx, exint &value) const
168  { doGetParmValue(idx, value); }
169  void getParmValue(exint idx, fpreal &value) const
170  { doGetParmValue(idx, value); }
172  { doGetParmValue(idx, value); }
174  { doGetParmValue(idx, value); }
176  { doGetParmValue(idx, value); }
178  { doGetParmValue(idx, value); }
180  { doGetParmValue(idx, value); }
182  { doGetParmValue(idx, value); }
184  { doGetParmValue(idx, value); }
186  { doGetParmValue(idx, value); }
188  { doGetParmValue(idx, value); }
189 
190  template <typename T>
191  void
192  doSetParmValue(exint idx, const T &value)
193  {
194  switch (idx)
195  {
196 
197  }
198  }
199 
200  void setParmValue(exint idx, const exint &value)
201  { doSetParmValue(idx, value); }
202  void setParmValue(exint idx, const fpreal &value)
203  { doSetParmValue(idx, value); }
204  void setParmValue(exint idx, const UT_Vector2D &value)
205  { doSetParmValue(idx, value); }
206  void setParmValue(exint idx, const UT_Vector3D &value)
207  { doSetParmValue(idx, value); }
208  void setParmValue(exint idx, const UT_Vector4D &value)
209  { doSetParmValue(idx, value); }
210  void setParmValue(exint idx, const UT_Matrix2D &value)
211  { doSetParmValue(idx, value); }
212  void setParmValue(exint idx, const UT_Matrix3D &value)
213  { doSetParmValue(idx, value); }
214  void setParmValue(exint idx, const UT_Matrix4D &value)
215  { doSetParmValue(idx, value); }
217  { doSetParmValue(idx, value); }
219  { doSetParmValue(idx, value); }
221  { doSetParmValue(idx, value); }
222 
223  virtual exint getNumParms() const
224  {
225  return 1;
226  }
227 
228  virtual const char *getParmName(exint fieldnum) const
229  {
230  switch (fieldnum)
231  {
232  case 0:
233  return "deletions";
234 
235  }
236  return 0;
237  }
238 
239  virtual ParmType getParmType(exint fieldnum) const
240  {
241  switch (fieldnum)
242  {
243 
244  }
245  return PARM_UNSUPPORTED;
246  }
247 
248  // Boiler plate to load individual types.
249  static void loadData(UT_IStream &is, int64 &v)
250  { is.bread(&v, 1); }
251  static void loadData(UT_IStream &is, bool &v)
252  { int64 iv; is.bread(&iv, 1); v = iv; }
253  static void loadData(UT_IStream &is, fpreal64 &v)
254  { is.bread<fpreal64>(&v, 1); }
255  static void loadData(UT_IStream &is, UT_Vector2D &v)
256  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
257  static void loadData(UT_IStream &is, UT_Vector3D &v)
258  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
259  is.bread<fpreal64>(&v.z(), 1); }
260  static void loadData(UT_IStream &is, UT_Vector4D &v)
261  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
262  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
263  static void loadData(UT_IStream &is, UT_Matrix2D &v)
264  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
265  static void loadData(UT_IStream &is, UT_Matrix3D &v)
266  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
267  static void loadData(UT_IStream &is, UT_Matrix4D &v)
268  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
269  static void loadData(UT_IStream &is, UT_Vector2I &v)
270  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
271  static void loadData(UT_IStream &is, UT_Vector3I &v)
272  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
273  is.bread<int64>(&v.z(), 1); }
274  static void loadData(UT_IStream &is, UT_Vector4I &v)
275  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
276  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
278  { is.bread(v); }
280  { UT_StringHolder rampdata;
281  loadData(is, rampdata);
282  if (rampdata.isstring())
283  {
284  v.reset(new UT_Ramp());
285  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
286  v->load(istr);
287  }
288  else v.reset();
289  }
292  loadData(is, data);
293  if (data.isstring())
294  {
295  // Find the data type.
296  char *colon = UT_StringWrap(data).findChar(':');
297  if (colon)
298  {
299  int typelen = colon - data.buffer();
301  type.strncpy(data.buffer(), typelen);
302  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
303 
304  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
305  }
306  }
307  else v.reset();
308  }
309 
310  static void saveData(std::ostream &os, int64 v)
311  { UTwrite(os, &v); }
312  static void saveData(std::ostream &os, bool v)
313  { int64 iv = v; UTwrite(os, &iv); }
314  static void saveData(std::ostream &os, fpreal64 v)
315  { UTwrite<fpreal64>(os, &v); }
316  static void saveData(std::ostream &os, UT_Vector2D v)
317  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
318  static void saveData(std::ostream &os, UT_Vector3D v)
319  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
320  UTwrite<fpreal64>(os, &v.z()); }
321  static void saveData(std::ostream &os, UT_Vector4D v)
322  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
323  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
324  static void saveData(std::ostream &os, UT_Matrix2D v)
326  static void saveData(std::ostream &os, UT_Matrix3D v)
328  static void saveData(std::ostream &os, UT_Matrix4D v)
330  static void saveData(std::ostream &os, UT_StringHolder s)
331  { UT_StringWrap(s).saveBinary(os); }
332  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
333  { UT_StringHolder result;
334  UT_OStringStream ostr;
335  if (s) s->save(ostr);
336  result = ostr.str();
337  saveData(os, result);
338  }
339  static void saveData(std::ostream &os, PRM_DataItemHandle s)
340  { UT_StringHolder result;
341  UT_OStringStream ostr;
342  if (s)
343  {
344  ostr << s->getDataTypeToken();
345  ostr << ":";
346  s->saveBinary(ostr);
347  }
348  result = ostr.str();
349  saveData(os, result);
350  }
351 
352 
353  void save(std::ostream &os) const
354  {
355  int32 v = version();
356  UTwrite(os, &v);
357  {
358  int64 length = myDeletions.entries();
359  UTwrite(os, &length);
360  for (exint i = 0; i < length; i++)
361  {
362  saveData(os, myDeletions(i).enable);
363  saveData(os, myDeletions(i).grouptype);
364  saveData(os, myDeletions(i).group);
365 
366  }
367  }
368 
369  }
370 
371  bool load(UT_IStream &is)
372  {
373  int32 v;
374  is.bread(&v, 1);
375  if (version() != v)
376  {
377  // Fail incompatible versions
378  return false;
379  }
380  {
381  int64 length;
382  is.read(&length, 1);
383  myDeletions.entries(length);
384  for (exint i = 0; i < length; i++)
385  {
386  loadData(is, myDeletions(i).enable);
387  loadData(is, myDeletions(i).grouptype);
388  loadData(is, myDeletions(i).group);
389 
390  }
391  }
392 
393  return true;
394  }
395 
396  const UT_Array<Deletions> &getDeletions() const { return myDeletions; }
397  void setDeletions(const UT_Array<Deletions> &val) { myDeletions = val; }
398  exint opDeletions(const SOP_NodeVerb::CookParms &cookparms) const
399  {
400  SOP_Node *thissop = cookparms.getNode();
401  if (!thissop) return getDeletions().entries();
402  exint result;
403  OP_Utils::evalOpParm(result, thissop, "deletions", cookparms.getCookTime(), 0);
404  return result;
405  }
406  bool opDeletions_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
407  {
408  SOP_Node *thissop = cookparms.getNode();
409  if (!thissop) return (myDeletions(_idx).enable);
410  int _parmidx = _idx + 1;
411  bool result;
412  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
413  return (result);
414  }
416  {
417  SOP_Node *thissop = cookparms.getNode();
418  if (!thissop) return (myDeletions(_idx).grouptype);
419  int _parmidx = _idx + 1;
420  int64 result;
421  OP_Utils::evalOpParmInst(result, thissop, "grouptype#", &_parmidx, cookparms.getCookTime(), 0);
422  return (result);
423  }
425  {
426  SOP_Node *thissop = cookparms.getNode();
427  if (!thissop) return (myDeletions(_idx).group);
428  int _parmidx = _idx + 1;
429  UT_StringHolder result;
430  OP_Utils::evalOpParmInst(result, thissop, "group#", &_parmidx, cookparms.getCookTime(), 0);
431  return (result);
432  }
433 
434 
435 private:
436  UT_Array<Deletions> myDeletions;
437 
438 };
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void getParmValue(exint idx, UT_StringHolder &value) const
void getParmValue(exint idx, fpreal &value) const
static void saveData(std::ostream &os, UT_Matrix2D v)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:494
const UT_Array< Deletions > & getDeletions() const
T & z(void)
Definition: UT_Vector4.h:379
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void setParmValue(exint idx, const fpreal &value)
bool operator==(const Deletions &src) const
void save(std::ostream &os) const
UT_StringHolder opDeletions_group(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
const GLdouble * v
Definition: glcorearb.h:836
virtual ParmType getParmType(exint fieldnum) const
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
static void saveData(std::ostream &os, UT_Vector2D v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
void getParmValue(exint idx, UT_Vector3D &value) const
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
void getParmValue(exint idx, UT_Vector2D &value) const
void doSetParmValue(exint idx, const T &value)
An output stream object that owns its own string buffer storage.
void setParmValue(exint idx, const UT_Matrix4D &value)
virtual void copyFrom(const SOP_NodeParms *src)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
png_uint_32 i
Definition: png.h:2877
void getParmValue(exint idx, UT_Matrix2D &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
static void loadData(UT_IStream &is, UT_StringHolder &v)
long long int64
Definition: SYS_Types.h:107
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void getParmValue(exint idx, UT_Matrix3D &value) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setParmValue(exint idx, const UT_Vector3D &value)
void doGetParmValue(exint idx, T &value) const
bool opDeletions_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void saveData(std::ostream &os, UT_Matrix3D v)
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
void setParmValue(exint idx, const UT_Matrix3D &value)
int64 exint
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, bool v)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
static void loadData(UT_IStream &is, UT_Vector4I &v)
double fpreal64
Definition: SYS_Types.h:192
static void loadData(UT_IStream &is, int64 &v)
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
void setParmValue(exint idx, const UT_Matrix2D &value)
static void saveData(std::ostream &os, UT_Vector4D v)
void setParmValue(exint idx, const exint &value)
static void saveData(std::ostream &os, UT_Vector3D v)
void setParmValue(exint idx, const UT_Vector2D &value)
void setParmValue(exint idx, const UT_Vector4D &value)
int64 opDeletions_grouptype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
void setDeletions(const UT_Array< Deletions > &val)
void setParmValue(exint idx, const UT_StringHolder &value)
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLboolean * data
Definition: glcorearb.h:130
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_Vector3D &v)
bool load(UT_IStream &is)
int int32
Definition: SYS_Types.h:35
T & y(void)
Definition: UT_Vector4.h:377
bool operator==(const SOP_GroupDeleteParms &src) const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
virtual exint getNumParms() const
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:453
void getParmValue(exint idx, UT_Matrix4D &value) const
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
virtual const char * getParmName(exint fieldnum) const
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, bool &v)
void getParmValue(exint idx, UT_Vector4D &value) const
UT_StringHolder createString(const UT_Array< Deletions > &list) const
void getParmValue(exint idx, exint &value) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, fpreal64 v)
bool operator!=(const SOP_GroupDeleteParms &src) const
SYS_FORCE_INLINE void append(char character)
GLuint GLfloat * val
Definition: glcorearb.h:1607
static void loadData(UT_IStream &is, UT_Matrix4D &v)
#define SOP_API
Definition: SOP_API.h:10
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 saveData(std::ostream &os, UT_Matrix4D v)
T & y(void)
Definition: UT_Vector2.h:287
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:381
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
static void saveData(std::ostream &os, UT_StringHolder s)
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
bool operator!=(const Deletions &src) const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
exint opDeletions(const SOP_NodeVerb::CookParms &cookparms) const
GLenum src
Definition: glcorearb.h:1792