HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_VertexSplit.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 <SOP/SOP_GraphProxy.h>
8 
9 #include <OP/OP_Utils.h>
10 #include <PRM/PRM_Parm.h>
11 #include <UT/UT_IStream.h>
12 #include <UT/UT_NTStreamUtil.h>
13 #include <UT/UT_Ramp.h>
14 #include <UT/UT_SharedPtr.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringStream.h>
17 #include <UT/UT_VectorTypes.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 1; }
28 
30  {
31  myGroup = ""_sh;
32  myAttribname = ""_sh;
33  myTol = 0.001;
34  myPromote = false;
35 
36  }
37 
38  explicit SOP_VertexSplitParms(const SOP_VertexSplitParms &) = default;
39 
40  ~SOP_VertexSplitParms() override {}
41 
42  bool operator==(const SOP_VertexSplitParms &src) const
43  {
44  if (myGroup != src.myGroup) return false;
45  if (myAttribname != src.myAttribname) return false;
46  if (myTol != src.myTol) return false;
47  if (myPromote != src.myPromote) return false;
48 
49  return true;
50  }
51  bool operator!=(const SOP_VertexSplitParms &src) const
52  {
53  return !operator==(src);
54  }
55 
56 
57 
58  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
59  {
60  myGroup = ""_sh;
61  if (true)
62  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
63  myAttribname = ""_sh;
64  if (true)
65  graph->evalOpParm(myAttribname, nodeidx, "attribname", time, 0);
66  myTol = 0.001;
67  if (true)
68  graph->evalOpParm(myTol, nodeidx, "tol", time, 0);
69  myPromote = false;
70  if (true)
71  graph->evalOpParm(myPromote, nodeidx, "promote", time, 0);
72 
73  }
74 
75 
76  void loadFromOpSubclass(const LoadParms &loadparms) override
77  {
78  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
79  }
80 
81 
82  void copyFrom(const SOP_NodeParms *src) override
83  {
84  *this = *((const SOP_VertexSplitParms *)src);
85  }
86 
87  template <typename T>
88  void
89  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
90  {
91  if (idx.size() < 1)
92  return;
93  UT_ASSERT(idx.size() == instance.size()+1);
94  if (idx.size() != instance.size()+1)
95  return;
96  switch (idx[0])
97  {
98  case 0:
99  coerceValue(value, myGroup);
100  break;
101  case 1:
102  coerceValue(value, myAttribname);
103  break;
104  case 2:
105  coerceValue(value, myTol);
106  break;
107  case 3:
108  coerceValue(value, myPromote);
109  break;
110 
111  }
112  }
113 
114  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
115  { doGetParmValue(idx, instance, value); }
116  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
117  { doGetParmValue(idx, instance, value); }
118  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
119  { doGetParmValue(idx, instance, value); }
120  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
121  { doGetParmValue(idx, instance, value); }
122  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
123  { doGetParmValue(idx, instance, value); }
124  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
125  { doGetParmValue(idx, instance, value); }
126  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
127  { doGetParmValue(idx, instance, value); }
128  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
129  { doGetParmValue(idx, instance, value); }
130  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
131  { doGetParmValue(idx, instance, value); }
132  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
133  { doGetParmValue(idx, instance, value); }
134  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
135  { doGetParmValue(idx, instance, value); }
136 
137  template <typename T>
138  void
139  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
140  {
141  if (idx.size() < 1)
142  return;
143  UT_ASSERT(idx.size() == instance.size()+1);
144  if (idx.size() != instance.size()+1)
145  return;
146  switch (idx[0])
147  {
148  case 0:
149  coerceValue(myGroup, value);
150  break;
151  case 1:
152  coerceValue(myAttribname, value);
153  break;
154  case 2:
155  coerceValue(myTol, value);
156  break;
157  case 3:
158  coerceValue(myPromote, value);
159  break;
160 
161  }
162  }
163 
164  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
165  { doSetParmValue(idx, instance, value); }
166  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
167  { doSetParmValue(idx, instance, value); }
168  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
169  { doSetParmValue(idx, instance, value); }
170  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
171  { doSetParmValue(idx, instance, value); }
172  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
173  { doSetParmValue(idx, instance, value); }
174  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
175  { doSetParmValue(idx, instance, value); }
176  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
177  { doSetParmValue(idx, instance, value); }
178  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
179  { doSetParmValue(idx, instance, value); }
180  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
181  { doSetParmValue(idx, instance, value); }
182  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
183  { doSetParmValue(idx, instance, value); }
184  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
185  { doSetParmValue(idx, instance, value); }
186 
187  exint getNestNumParms(TempIndex idx) const override
188  {
189  if (idx.size() == 0)
190  return 4;
191  switch (idx[0])
192  {
193 
194  }
195  // Invalid
196  return 0;
197  }
198 
199  const char *getNestParmName(TempIndex fieldnum) const override
200  {
201  if (fieldnum.size() < 1)
202  return 0;
203  switch (fieldnum[0])
204  {
205  case 0:
206  return "group";
207  case 1:
208  return "attribname";
209  case 2:
210  return "tol";
211  case 3:
212  return "promote";
213 
214  }
215  return 0;
216  }
217 
218  ParmType getNestParmType(TempIndex fieldnum) const override
219  {
220  if (fieldnum.size() < 1)
221  return PARM_UNSUPPORTED;
222  switch (fieldnum[0])
223  {
224  case 0:
225  return PARM_STRING;
226  case 1:
227  return PARM_STRING;
228  case 2:
229  return PARM_FLOAT;
230  case 3:
231  return PARM_INTEGER;
232 
233  }
234  return PARM_UNSUPPORTED;
235  }
236 
237  // Boiler plate to load individual types.
238  static void loadData(UT_IStream &is, int64 &v)
239  { is.bread(&v, 1); }
240  static void loadData(UT_IStream &is, bool &v)
241  { int64 iv; is.bread(&iv, 1); v = iv; }
242  static void loadData(UT_IStream &is, fpreal64 &v)
243  { is.bread<fpreal64>(&v, 1); }
244  static void loadData(UT_IStream &is, UT_Vector2D &v)
245  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
246  static void loadData(UT_IStream &is, UT_Vector3D &v)
247  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
248  is.bread<fpreal64>(&v.z(), 1); }
249  static void loadData(UT_IStream &is, UT_Vector4D &v)
250  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
251  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
252  static void loadData(UT_IStream &is, UT_Matrix2D &v)
253  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
254  static void loadData(UT_IStream &is, UT_Matrix3D &v)
255  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
256  static void loadData(UT_IStream &is, UT_Matrix4D &v)
257  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
258  static void loadData(UT_IStream &is, UT_Vector2I &v)
259  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
260  static void loadData(UT_IStream &is, UT_Vector3I &v)
261  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
262  is.bread<int64>(&v.z(), 1); }
263  static void loadData(UT_IStream &is, UT_Vector4I &v)
264  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
265  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
267  { is.bread(v); }
269  { UT_StringHolder rampdata;
270  loadData(is, rampdata);
271  if (rampdata.isstring())
272  {
273  v.reset(new UT_Ramp());
274  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
275  v->load(istr);
276  }
277  else v.reset();
278  }
281  loadData(is, data);
282  if (data.isstring())
283  {
284  // Find the data type.
285  const char *colon = UT_StringWrap(data).findChar(':');
286  if (colon)
287  {
288  int typelen = colon - data.buffer();
290  type.strncpy(data.buffer(), typelen);
291  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
292 
293  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
294  }
295  }
296  else v.reset();
297  }
298 
299  static void saveData(std::ostream &os, int64 v)
300  { UTwrite(os, &v); }
301  static void saveData(std::ostream &os, bool v)
302  { int64 iv = v; UTwrite(os, &iv); }
303  static void saveData(std::ostream &os, fpreal64 v)
304  { UTwrite<fpreal64>(os, &v); }
305  static void saveData(std::ostream &os, UT_Vector2D v)
306  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
307  static void saveData(std::ostream &os, UT_Vector3D v)
308  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
309  UTwrite<fpreal64>(os, &v.z()); }
310  static void saveData(std::ostream &os, UT_Vector4D v)
311  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
312  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
313  static void saveData(std::ostream &os, UT_Matrix2D v)
315  static void saveData(std::ostream &os, UT_Matrix3D v)
317  static void saveData(std::ostream &os, UT_Matrix4D v)
319  static void saveData(std::ostream &os, UT_StringHolder s)
320  { UT_StringWrap(s).saveBinary(os); }
321  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
323  UT_OStringStream ostr;
324  if (s) s->save(ostr);
325  result = ostr.str();
326  saveData(os, result);
327  }
328  static void saveData(std::ostream &os, PRM_DataItemHandle s)
330  UT_OStringStream ostr;
331  if (s)
332  {
333  ostr << s->getDataTypeToken();
334  ostr << ":";
335  s->saveBinary(ostr);
336  }
337  result = ostr.str();
338  saveData(os, result);
339  }
340 
341 
342  void save(std::ostream &os) const
343  {
344  int32 v = version();
345  UTwrite(os, &v);
346  saveData(os, myGroup);
347  saveData(os, myAttribname);
348  saveData(os, myTol);
349  saveData(os, myPromote);
350 
351  }
352 
353  bool load(UT_IStream &is)
354  {
355  int32 v;
356  is.bread(&v, 1);
357  if (version() != v)
358  {
359  // Fail incompatible versions
360  return false;
361  }
362  loadData(is, myGroup);
363  loadData(is, myAttribname);
364  loadData(is, myTol);
365  loadData(is, myPromote);
366 
367  return true;
368  }
369 
370  const UT_StringHolder & getGroup() const { return myGroup; }
371  void setGroup(const UT_StringHolder & val) { myGroup = val; }
373  {
374  SOP_Node *thissop = cookparms.getNode();
375  if (!thissop) return getGroup();
377  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
378  return result;
379  }
380  const UT_StringHolder & getAttribname() const { return myAttribname; }
381  void setAttribname(const UT_StringHolder & val) { myAttribname = val; }
383  {
384  SOP_Node *thissop = cookparms.getNode();
385  if (!thissop) return getAttribname();
387  OP_Utils::evalOpParm(result, thissop, "attribname", cookparms.getCookTime(), 0);
388  return result;
389  }
390  fpreal64 getTol() const { return myTol; }
391  void setTol(fpreal64 val) { myTol = val; }
392  fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
393  {
394  SOP_Node *thissop = cookparms.getNode();
395  if (!thissop) return getTol();
397  OP_Utils::evalOpParm(result, thissop, "tol", cookparms.getCookTime(), 0);
398  return result;
399  }
400  bool getPromote() const { return myPromote; }
401  void setPromote(bool val) { myPromote = val; }
402  bool opPromote(const SOP_NodeVerb::CookParms &cookparms) const
403  {
404  SOP_Node *thissop = cookparms.getNode();
405  if (!thissop) return getPromote();
406  bool result;
407  OP_Utils::evalOpParm(result, thissop, "promote", cookparms.getCookTime(), 0);
408  return result;
409  }
410 
411 private:
412  UT_StringHolder myGroup;
413  UT_StringHolder myAttribname;
414  fpreal64 myTol;
415  bool myPromote;
416 
417 };
static void loadData(UT_IStream &is, UT_Matrix4D &v)
GLdouble s
Definition: glew.h:1390
void setTol(fpreal64 val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void copyFrom(const SOP_NodeParms *src) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
GLuint const GLfloat * val
Definition: glew.h:2794
const UT_StringHolder & getAttribname() const
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
static void saveData(std::ostream &os, fpreal64 v)
static void saveData(std::ostream &os, UT_Vector3D v)
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
bool operator!=(const SOP_VertexSplitParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
const GLdouble * v
Definition: glew.h:1391
static void loadData(UT_IStream &is, bool &v)
void save(std::ostream &os) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
double fpreal64
Definition: SYS_Types.h:201
const char * getNestParmName(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
bool operator==(const SOP_VertexSplitParms &src) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
exint length() const
void loadFromOpSubclass(const LoadParms &loadparms) override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
exint getNestNumParms(TempIndex idx) const override
const GLfloat * c
Definition: glew.h:16296
static void saveData(std::ostream &os, UT_Vector2D v)
fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, UT_StringHolder s)
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
ParmType getNestParmType(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
const UT_StringHolder & getGroup() const
bool opPromote(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, bool v)
static void saveData(std::ostream &os, UT_Matrix2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
fpreal64 fpreal
Definition: SYS_Types.h:277
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
#define SOP_API
Definition: SOP_API.h:10
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void setAttribname(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Vector4D v)
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
bool load(UT_IStream &is)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
GLuint64EXT * result
Definition: glew.h:14007
static void saveData(std::ostream &os, UT_Matrix4D v)
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Matrix3D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
GLsizei const GLfloat * value
Definition: glew.h:1849
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Vector4I &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
UT_StringHolder opAttribname(const SOP_NodeVerb::CookParms &cookparms) const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const