HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
62  };
63 
65  {
67 
68  buf.strcat("[ ");
69  for (int i = 0; i < list.entries(); i++)
70  {
71  if (i)
72  buf.strcat(", ");
73  buf.strcat("( ");
74  buf.append("");
75  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
76  buf.append(", ");
77  buf.appendSprintf("%d", (int) list(i).grouptype);
78  buf.append(", ");
79  { UT_String tmp; tmp = UT_StringWrap(list(i).group).makeQuotedString('"'); buf.strcat(tmp); }
80 
81  buf.strcat(" )");
82  }
83  buf.strcat(" ]");
84 
85  UT_StringHolder result = buf;
86  return result;
87  }
88 
90  {
91 
92  }
93 
94  explicit SOP_GroupDeleteParms(const SOP_GroupDeleteParms &) = default;
95 
96  virtual ~SOP_GroupDeleteParms() {}
97 
98  bool operator==(const SOP_GroupDeleteParms &src) const
99  {
100  if (myDeletions != src.myDeletions) return false;
101 
102  return true;
103  }
105 
106 
107 
108  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
109  {
110  if (true)
111  {
112  int64 length;
113  OP_Utils::evalOpParm(length, node, "deletions", time, 0);
114  myDeletions.entries(length);
115  for (exint i = 0; i < length; i++)
116  {
117  int parmidx = i+1;
118  auto && _curentry = myDeletions(i);
119  (void) _curentry;
120  if (true)
121  OP_Utils::evalOpParmInst(myDeletions(i).enable, node, "enable#", &parmidx, time, 0);
122  else myDeletions(i).enable = false;
123  if (true && ( (!(((_curentry.enable==0)))) ) )
124  OP_Utils::evalOpParmInst(myDeletions(i).grouptype, node, "grouptype#", &parmidx, time, 0);
125  else myDeletions(i).grouptype = 0;
126  if (true && ( (!(((_curentry.enable==0)))) ) )
127  OP_Utils::evalOpParmInst(myDeletions(i).group, node, "group#", &parmidx, time, 0);
128  else myDeletions(i).group = ""_sh;
129 
130  }
131  }
132  else
133  myDeletions.clear();
134 
135  }
136 
137 
138  virtual void loadFromOpSubclass(const LoadParms &loadparms)
139  {
140  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
141  }
142 
143 
144  virtual void copyFrom(const SOP_NodeParms *src)
145  {
146  *this = *((const SOP_GroupDeleteParms *)src);
147  }
148 
149  template <typename T>
150  void
151  doGetParmValue(exint idx, T &value) const
152  {
153  switch (idx)
154  {
155 
156  }
157  }
158 
159  void getParmValue(exint idx, exint &value) const
160  { doGetParmValue(idx, value); }
161  void getParmValue(exint idx, fpreal &value) const
162  { doGetParmValue(idx, value); }
164  { doGetParmValue(idx, value); }
166  { doGetParmValue(idx, value); }
168  { doGetParmValue(idx, value); }
170  { doGetParmValue(idx, value); }
172  { doGetParmValue(idx, value); }
174  { doGetParmValue(idx, value); }
176  { doGetParmValue(idx, value); }
178  { doGetParmValue(idx, value); }
180  { doGetParmValue(idx, value); }
181 
182  template <typename T>
183  void
184  doSetParmValue(exint idx, const T &value)
185  {
186  switch (idx)
187  {
188 
189  }
190  }
191 
192  void setParmValue(exint idx, const exint &value)
193  { doSetParmValue(idx, value); }
194  void setParmValue(exint idx, const fpreal &value)
195  { doSetParmValue(idx, value); }
196  void setParmValue(exint idx, const UT_Vector2D &value)
197  { doSetParmValue(idx, value); }
198  void setParmValue(exint idx, const UT_Vector3D &value)
199  { doSetParmValue(idx, value); }
200  void setParmValue(exint idx, const UT_Vector4D &value)
201  { doSetParmValue(idx, value); }
202  void setParmValue(exint idx, const UT_Matrix2D &value)
203  { doSetParmValue(idx, value); }
204  void setParmValue(exint idx, const UT_Matrix3D &value)
205  { doSetParmValue(idx, value); }
206  void setParmValue(exint idx, const UT_Matrix4D &value)
207  { doSetParmValue(idx, value); }
209  { doSetParmValue(idx, value); }
211  { doSetParmValue(idx, value); }
213  { doSetParmValue(idx, value); }
214 
215  virtual exint getNumParms() const
216  {
217  return 1;
218  }
219 
220  virtual const char *getParmName(exint fieldnum) const
221  {
222  switch (fieldnum)
223  {
224  case 0:
225  return "deletions";
226 
227  }
228  return 0;
229  }
230 
231  virtual ParmType getParmType(exint fieldnum) const
232  {
233  switch (fieldnum)
234  {
235 
236  }
237  return PARM_UNSUPPORTED;
238  }
239 
240  // Boiler plate to load individual types.
241  static void loadData(UT_IStream &is, int64 &v)
242  { is.bread(&v, 1); }
243  static void loadData(UT_IStream &is, bool &v)
244  { int64 iv; is.bread(&iv, 1); v = iv; }
245  static void loadData(UT_IStream &is, fpreal64 &v)
246  { is.bread<fpreal64>(&v, 1); }
247  static void loadData(UT_IStream &is, UT_Vector2D &v)
248  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
249  static void loadData(UT_IStream &is, UT_Vector3D &v)
250  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
251  is.bread<fpreal64>(&v.z(), 1); }
252  static void loadData(UT_IStream &is, UT_Vector4D &v)
253  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
254  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
255  static void loadData(UT_IStream &is, UT_Matrix2D &v)
256  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
257  static void loadData(UT_IStream &is, UT_Matrix3D &v)
258  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
259  static void loadData(UT_IStream &is, UT_Matrix4D &v)
260  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
261  static void loadData(UT_IStream &is, UT_Vector2I &v)
262  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
263  static void loadData(UT_IStream &is, UT_Vector3I &v)
264  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
265  is.bread<int64>(&v.z(), 1); }
266  static void loadData(UT_IStream &is, UT_Vector4I &v)
267  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
268  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
270  { is.bread(v); }
272  { UT_StringHolder rampdata;
273  loadData(is, rampdata);
274  if (rampdata.isstring())
275  {
276  v.reset(new UT_Ramp());
277  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
278  v->load(istr);
279  }
280  else v.reset();
281  }
284  loadData(is, data);
285  if (data.isstring())
286  {
287  // Find the data type.
288  char *colon = UT_StringWrap(data).findChar(':');
289  if (colon)
290  {
291  int typelen = colon - data.buffer();
293  type.strncpy(data.buffer(), typelen);
294  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
295 
296  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
297  }
298  }
299  else v.reset();
300  }
301 
302  static void saveData(std::ostream &os, int64 v)
303  { UTwrite(os, &v); }
304  static void saveData(std::ostream &os, bool v)
305  { int64 iv = v; UTwrite(os, &iv); }
306  static void saveData(std::ostream &os, fpreal64 v)
307  { UTwrite<fpreal64>(os, &v); }
308  static void saveData(std::ostream &os, UT_Vector2D v)
309  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
310  static void saveData(std::ostream &os, UT_Vector3D v)
311  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
312  UTwrite<fpreal64>(os, &v.z()); }
313  static void saveData(std::ostream &os, UT_Vector4D v)
314  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
315  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
316  static void saveData(std::ostream &os, UT_Matrix2D v)
318  static void saveData(std::ostream &os, UT_Matrix3D v)
320  static void saveData(std::ostream &os, UT_Matrix4D v)
322  static void saveData(std::ostream &os, UT_StringHolder s)
323  { UT_StringWrap(s).saveBinary(os); }
324  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
325  { UT_StringHolder result;
326  UT_OStringStream ostr;
327  if (s) s->save(ostr);
328  result = ostr.str();
329  saveData(os, result);
330  }
331  static void saveData(std::ostream &os, PRM_DataItemHandle s)
332  { UT_StringHolder result;
333  UT_OStringStream ostr;
334  if (s)
335  {
336  ostr << s->getDataTypeToken();
337  ostr << ":";
338  s->saveBinary(ostr);
339  }
340  result = ostr.str();
341  saveData(os, result);
342  }
343 
344 
345  void save(std::ostream &os) const
346  {
347  int32 v = version();
348  UTwrite(os, &v);
349  {
350  int64 length = myDeletions.entries();
351  UTwrite(os, &length);
352  for (exint i = 0; i < length; i++)
353  {
354  saveData(os, myDeletions(i).enable);
355  saveData(os, myDeletions(i).grouptype);
356  saveData(os, myDeletions(i).group);
357 
358  }
359  }
360 
361  }
362 
363  bool load(UT_IStream &is)
364  {
365  int32 v;
366  is.bread(&v, 1);
367  if (version() != v)
368  {
369  // Fail incompatible versions
370  return false;
371  }
372  {
373  int64 length;
374  is.read(&length, 1);
375  myDeletions.entries(length);
376  for (exint i = 0; i < length; i++)
377  {
378  loadData(is, myDeletions(i).enable);
379  loadData(is, myDeletions(i).grouptype);
380  loadData(is, myDeletions(i).group);
381 
382  }
383  }
384 
385  return true;
386  }
387 
388  const UT_Array<Deletions> &getDeletions() const { return myDeletions; }
389  void setDeletions(const UT_Array<Deletions> &val) { myDeletions = val; }
390  exint opDeletions(const SOP_NodeVerb::CookParms &cookparms) const
391  {
392  SOP_Node *thissop = cookparms.getNode();
393  if (!thissop) return getDeletions().entries();
394  exint result;
395  OP_Utils::evalOpParm(result, thissop, "deletions", cookparms.getCookTime(), 0);
396  return result;
397  }
398  bool opDeletions_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
399  {
400  SOP_Node *thissop = cookparms.getNode();
401  if (!thissop) return (myDeletions(_idx).enable);
402  int _parmidx = _idx + 1;
403  bool result;
404  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
405  return (result);
406  }
408  {
409  SOP_Node *thissop = cookparms.getNode();
410  if (!thissop) return (myDeletions(_idx).grouptype);
411  int _parmidx = _idx + 1;
412  int64 result;
413  OP_Utils::evalOpParmInst(result, thissop, "grouptype#", &_parmidx, cookparms.getCookTime(), 0);
414  return (result);
415  }
417  {
418  SOP_Node *thissop = cookparms.getNode();
419  if (!thissop) return (myDeletions(_idx).group);
420  int _parmidx = _idx + 1;
421  UT_StringHolder result;
422  OP_Utils::evalOpParmInst(result, thissop, "group#", &_parmidx, cookparms.getCookTime(), 0);
423  return (result);
424  }
425 
426 
427 private:
428  UT_Array<Deletions> myDeletions;
429 
430 };
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:492
const UT_Array< Deletions > & getDeletions() const
T & z(void)
Definition: UT_Vector4.h:372
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)
fpreal getTime() const
Definition: OP_Context.h:34
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
T & x(void)
Definition: UT_Vector2.h:284
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:581
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:585
static void loadData(UT_IStream &is, UT_StringHolder &v)
long long int64
Definition: SYS_Types.h:100
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
void append(char character)
SYS_FORCE_INLINE const char * buffer() const
void setParmValue(exint idx, const UT_Matrix3D &value)
int64 exint
Definition: SYS_Types.h:109
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:185
static void loadData(UT_IStream &is, int64 &v)
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:280
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:28
T & y(void)
Definition: UT_Vector4.h:370
bool operator==(const SOP_GroupDeleteParms &src) const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
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:446
void getParmValue(exint idx, UT_Matrix4D &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:263
void strncpy(const char *src, exint maxlen)
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)
GLuint GLfloat * val
Definition: glcorearb.h:1607
static void loadData(UT_IStream &is, UT_Matrix4D &v)
#define SOP_API
Definition: SOP_API.h:10
const char * buffer() const
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 saveData(std::ostream &os, UT_Matrix4D v)
T & y(void)
Definition: UT_Vector2.h:286
GLboolean r
Definition: glcorearb.h:1221
void strcat(const char *src)
T & w(void)
Definition: UT_Vector4.h:374
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
SYS_FORCE_INLINE bool isstring() const
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
exint opDeletions(const SOP_NodeVerb::CookParms &cookparms) const
GLenum src
Definition: glcorearb.h:1792