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