HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_EdgeStraighten.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_EdgeStraightenEnums
24 {
25  enum class Grouptype
26  {
27  EDGES = 0,
28  POINTS,
29  VERTICES
30  };
31 }
32 
33 
35 {
36 public:
37  static int version() { return 1; }
38 
40  {
41  myGroup = ""_sh;
42  myGrouptype = 0;
43  myOutputedgegroup = ""_sh;
44 
45  }
46 
47  explicit SOP_EdgeStraightenParms(const SOP_EdgeStraightenParms &) = default;
48 
50 
52  {
53  if (myGroup != src.myGroup) return false;
54  if (myGrouptype != src.myGrouptype) return false;
55  if (myOutputedgegroup != src.myOutputedgegroup) return false;
56 
57  return true;
58  }
60  {
61  return !operator==(src);
62  }
64 
65 
66 
67  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
68  {
69  myGroup = ""_sh;
70  if (true)
71  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
72  myGrouptype = 0;
73  if (true)
74  graph->evalOpParm(myGrouptype, nodeidx, "grouptype", time, 0);
75  myOutputedgegroup = ""_sh;
76  if (true)
77  graph->evalOpParm(myOutputedgegroup, nodeidx, "outputedgegroup", time, 0);
78 
79  }
80 
81 
82  void loadFromOpSubclass(const LoadParms &loadparms) override
83  {
84  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
85  }
86 
87 
88  void copyFrom(const SOP_NodeParms *src) override
89  {
90  *this = *((const SOP_EdgeStraightenParms *)src);
91  }
92 
93  template <typename T>
94  void
95  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
96  {
97  if (idx.size() < 1)
98  return;
99  UT_ASSERT(idx.size() == instance.size()+1);
100  if (idx.size() != instance.size()+1)
101  return;
102  switch (idx[0])
103  {
104  case 0:
105  coerceValue(value, myGroup);
106  break;
107  case 1:
108  coerceValue(value, myGrouptype);
109  break;
110  case 2:
111  coerceValue(value, myOutputedgegroup);
112  break;
113 
114  }
115  }
116 
117  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
118  { doGetParmValue(idx, instance, value); }
119  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
120  { doGetParmValue(idx, instance, value); }
121  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
122  { doGetParmValue(idx, instance, value); }
123  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
124  { doGetParmValue(idx, instance, value); }
125  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
126  { doGetParmValue(idx, instance, value); }
127  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
128  { doGetParmValue(idx, instance, value); }
129  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
130  { doGetParmValue(idx, instance, value); }
131  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
132  { doGetParmValue(idx, instance, value); }
133  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
134  { doGetParmValue(idx, instance, value); }
135  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
136  { doGetParmValue(idx, instance, value); }
137  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
138  { doGetParmValue(idx, instance, value); }
139 
140  template <typename T>
141  void
142  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
143  {
144  if (idx.size() < 1)
145  return;
146  UT_ASSERT(idx.size() == instance.size()+1);
147  if (idx.size() != instance.size()+1)
148  return;
149  switch (idx[0])
150  {
151  case 0:
152  coerceValue(myGroup, value);
153  break;
154  case 1:
155  coerceValue(myGrouptype, value);
156  break;
157  case 2:
158  coerceValue(myOutputedgegroup, 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 3;
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 "grouptype";
209  case 2:
210  return "outputedgegroup";
211 
212  }
213  return 0;
214  }
215 
216  ParmType getNestParmType(TempIndex fieldnum) const override
217  {
218  if (fieldnum.size() < 1)
219  return PARM_UNSUPPORTED;
220  switch (fieldnum[0])
221  {
222  case 0:
223  return PARM_STRING;
224  case 1:
225  return PARM_INTEGER;
226  case 2:
227  return PARM_STRING;
228 
229  }
230  return PARM_UNSUPPORTED;
231  }
232 
233  // Boiler plate to load individual types.
234  static void loadData(UT_IStream &is, int64 &v)
235  { is.bread(&v, 1); }
236  static void loadData(UT_IStream &is, bool &v)
237  { int64 iv; is.bread(&iv, 1); v = iv; }
238  static void loadData(UT_IStream &is, fpreal64 &v)
239  { is.bread<fpreal64>(&v, 1); }
240  static void loadData(UT_IStream &is, UT_Vector2D &v)
241  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
242  static void loadData(UT_IStream &is, UT_Vector3D &v)
243  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
244  is.bread<fpreal64>(&v.z(), 1); }
245  static void loadData(UT_IStream &is, UT_Vector4D &v)
246  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
247  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
248  static void loadData(UT_IStream &is, UT_Matrix2D &v)
249  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
250  static void loadData(UT_IStream &is, UT_Matrix3D &v)
251  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
252  static void loadData(UT_IStream &is, UT_Matrix4D &v)
253  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
254  static void loadData(UT_IStream &is, UT_Vector2I &v)
255  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
256  static void loadData(UT_IStream &is, UT_Vector3I &v)
257  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
258  is.bread<int64>(&v.z(), 1); }
259  static void loadData(UT_IStream &is, UT_Vector4I &v)
260  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
261  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
263  { is.bread(v); }
265  { UT_StringHolder rampdata;
266  loadData(is, rampdata);
267  if (rampdata.isstring())
268  {
269  v.reset(new UT_Ramp());
270  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
271  v->load(istr);
272  }
273  else v.reset();
274  }
277  loadData(is, data);
278  if (data.isstring())
279  {
280  // Find the data type.
281  const char *colon = UT_StringWrap(data).findChar(':');
282  if (colon)
283  {
284  int typelen = colon - data.buffer();
286  type.strncpy(data.buffer(), typelen);
287  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
288 
289  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
290  }
291  }
292  else v.reset();
293  }
294 
295  static void saveData(std::ostream &os, int64 v)
296  { UTwrite(os, &v); }
297  static void saveData(std::ostream &os, bool v)
298  { int64 iv = v; UTwrite(os, &iv); }
299  static void saveData(std::ostream &os, fpreal64 v)
300  { UTwrite<fpreal64>(os, &v); }
301  static void saveData(std::ostream &os, UT_Vector2D v)
302  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
303  static void saveData(std::ostream &os, UT_Vector3D v)
304  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
305  UTwrite<fpreal64>(os, &v.z()); }
306  static void saveData(std::ostream &os, UT_Vector4D v)
307  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
308  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
309  static void saveData(std::ostream &os, UT_Matrix2D v)
311  static void saveData(std::ostream &os, UT_Matrix3D v)
313  static void saveData(std::ostream &os, UT_Matrix4D v)
315  static void saveData(std::ostream &os, UT_StringHolder s)
316  { UT_StringWrap(s).saveBinary(os); }
317  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
319  UT_OStringStream ostr;
320  if (s) s->save(ostr);
321  result = ostr.str();
322  saveData(os, result);
323  }
324  static void saveData(std::ostream &os, PRM_DataItemHandle s)
326  UT_OStringStream ostr;
327  if (s)
328  {
329  ostr << s->getDataTypeToken();
330  ostr << ":";
331  s->saveBinary(ostr);
332  }
333  result = ostr.str();
334  saveData(os, result);
335  }
336 
337 
338  void save(std::ostream &os) const
339  {
340  int32 v = version();
341  UTwrite(os, &v);
342  saveData(os, myGroup);
343  saveData(os, myGrouptype);
344  saveData(os, myOutputedgegroup);
345 
346  }
347 
348  bool load(UT_IStream &is)
349  {
350  int32 v;
351  is.bread(&v, 1);
352  if (version() != v)
353  {
354  // Fail incompatible versions
355  return false;
356  }
357  loadData(is, myGroup);
358  loadData(is, myGrouptype);
359  loadData(is, myOutputedgegroup);
360 
361  return true;
362  }
363 
364  const UT_StringHolder & getGroup() const { return myGroup; }
365  void setGroup(const UT_StringHolder & val) { myGroup = val; }
367  {
368  SOP_Node *thissop = cookparms.getNode();
369  if (!thissop) return getGroup();
371  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
372  return result;
373  }
374  Grouptype getGrouptype() const { return Grouptype(myGrouptype); }
375  void setGrouptype(Grouptype val) { myGrouptype = int64(val); }
377  {
378  SOP_Node *thissop = cookparms.getNode();
379  if (!thissop) return getGrouptype();
380  int64 result;
381  OP_Utils::evalOpParm(result, thissop, "grouptype", cookparms.getCookTime(), 0);
382  return Grouptype(result);
383  }
384  const UT_StringHolder & getOutputedgegroup() const { return myOutputedgegroup; }
385  void setOutputedgegroup(const UT_StringHolder & val) { myOutputedgegroup = val; }
387  {
388  SOP_Node *thissop = cookparms.getNode();
389  if (!thissop) return getOutputedgegroup();
391  OP_Utils::evalOpParm(result, thissop, "outputedgegroup", cookparms.getCookTime(), 0);
392  return result;
393  }
394 
395 private:
396  UT_StringHolder myGroup;
397  int64 myGrouptype;
398  UT_StringHolder myOutputedgegroup;
399 
400 };
GLdouble s
Definition: glew.h:1390
void copyFrom(const SOP_NodeParms *src) override
static void saveData(std::ostream &os, UT_Matrix2D v)
void save(std::ostream &os) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
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 UT_SharedPtr< UT_Ramp > &value) override
GLuint const GLfloat * val
Definition: glew.h:2794
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, bool v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
static void loadData(UT_IStream &is, UT_StringHolder &v)
int64 exint
Definition: SYS_Types.h:125
static void loadData(UT_IStream &is, int64 &v)
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void saveData(std::ostream &os, UT_Vector4D v)
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
An output stream object that owns its own string buffer storage.
const UT_StringHolder & getGroup() const
const GLdouble * v
Definition: glew.h:1391
static void loadData(UT_IStream &is, UT_Vector2D &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_StringHolder & getOutputedgegroup() const
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void loadFromOpSubclass(const LoadParms &loadparms) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, fpreal64 &v)
bool operator==(const SOP_EdgeStraightenParms &src) const
double fpreal64
Definition: SYS_Types.h:201
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, bool &v)
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
static void loadData(UT_IStream &is, UT_Matrix4D &v)
ParmType getNestParmType(TempIndex fieldnum) const override
exint length() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
static void saveData(std::ostream &os, UT_Vector2D v)
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
static void loadData(UT_IStream &is, UT_Matrix3D &v)
const GLfloat * c
Definition: glew.h:16296
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
GT_API const UT_StringHolder version
const char * getNestParmName(TempIndex fieldnum) const override
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
Grouptype opGrouptype(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void saveData(std::ostream &os, UT_StringHolder s)
UT_StringHolder opOutputedgegroup(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
fpreal64 fpreal
Definition: SYS_Types.h:277
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static void saveData(std::ostream &os, int64 v)
void setOutputedgegroup(const UT_StringHolder &val)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
exint getNestNumParms(TempIndex idx) const override
#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 setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
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, fpreal64 v)
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
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
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
bool operator!=(const SOP_EdgeStraightenParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override