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