HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Torus.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_API.h>
7 #include <SOP/SOP_NodeVerb.h>
8 #include <OP/OP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 namespace SOP_TorusEnums
24 {
25  enum class Type
26  {
27  POLY = 0,
28  MESH,
29  NURBS,
30  BEZIER,
31  POLYSOUP
32  };
33 
35  getToken(Type enum_value)
36  {
37  using namespace UT::Literal;
38  switch (enum_value) {
39  case Type::POLY: return "poly"_sh;
40  case Type::MESH: return "mesh"_sh;
41  case Type::NURBS: return "nurbs"_sh;
42  case Type::BEZIER: return "bezier"_sh;
43  case Type::POLYSOUP: return "polysoup"_sh;
44  default: UT_ASSERT(false); return ""_sh;
45  }
46  }
47 
48  enum class Surftype
49  {
50  ROWS = 0,
51  COLS,
52  ROWCOL,
53  TRIANGLES,
54  QUADS,
57  };
58 
60  getToken(Surftype enum_value)
61  {
62  using namespace UT::Literal;
63  switch (enum_value) {
64  case Surftype::ROWS: return "rows"_sh;
65  case Surftype::COLS: return "cols"_sh;
66  case Surftype::ROWCOL: return "rowcol"_sh;
67  case Surftype::TRIANGLES: return "triangles"_sh;
68  case Surftype::QUADS: return "quads"_sh;
69  case Surftype::ALTTRIANGLES: return "alttriangles"_sh;
70  case Surftype::REVTRIANGLES: return "revtriangles"_sh;
71  default: UT_ASSERT(false); return ""_sh;
72  }
73  }
74 
75  enum class Orient
76  {
77  X = 0,
78  Y,
79  Z
80  };
81 
83  getToken(Orient enum_value)
84  {
85  using namespace UT::Literal;
86  switch (enum_value) {
87  case Orient::X: return "x"_sh;
88  case Orient::Y: return "y"_sh;
89  case Orient::Z: return "z"_sh;
90  default: UT_ASSERT(false); return ""_sh;
91  }
92  }
93 
94 }
95 
96 
98 {
99 public:
100  static int version() { return 1; }
101 
103  {
104  myType = 0;
105  mySurftype = 4;
106  myOrient = 1;
107  myRad = UT_Vector2D(1,0.5);
108  myT = UT_Vector3D(0,0,0);
109  myR = UT_Vector3D(0,0,0);
110  myScale = 1;
111  myImperfect = true;
112  myOrderu = 4;
113  myOrderv = 4;
114  myCloseu = true;
115  myClosev = true;
116  myCapu = false;
117  myCapv = false;
118  myRows = 12;
119  myCols = 24;
120  myAngleu = UT_Vector2D(0,360);
121  myAnglev = UT_Vector2D(0,360);
122 
123  }
124 
125  explicit SOP_TorusParms(const SOP_TorusParms &) = default;
126  SOP_TorusParms &operator=(const SOP_TorusParms &) = default;
127  SOP_TorusParms(SOP_TorusParms &&) noexcept = default;
128  SOP_TorusParms &operator=(SOP_TorusParms &&) noexcept = default;
129 
130  ~SOP_TorusParms() override {}
131 
132  bool operator==(const SOP_TorusParms &src) const
133  {
134  if (myType != src.myType) return false;
135  if (mySurftype != src.mySurftype) return false;
136  if (myOrient != src.myOrient) return false;
137  if (myRad != src.myRad) return false;
138  if (myT != src.myT) return false;
139  if (myR != src.myR) return false;
140  if (myScale != src.myScale) return false;
141  if (myImperfect != src.myImperfect) return false;
142  if (myOrderu != src.myOrderu) return false;
143  if (myOrderv != src.myOrderv) return false;
144  if (myCloseu != src.myCloseu) return false;
145  if (myClosev != src.myClosev) return false;
146  if (myCapu != src.myCapu) return false;
147  if (myCapv != src.myCapv) return false;
148  if (myRows != src.myRows) return false;
149  if (myCols != src.myCols) return false;
150  if (myAngleu != src.myAngleu) return false;
151  if (myAnglev != src.myAnglev) return false;
152 
153 
154  if (baseGetSignature() != src.baseGetSignature()) return false;
155 
156  return true;
157  }
158  bool operator!=(const SOP_TorusParms &src) const
159  {
160  return !operator==(src);
161  }
165 
166 
167 
168  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
169  {
170  myType = 0;
171  if (true)
172  graph->evalOpParm(myType, nodeidx, "type", time, graph->isDirect()?nullptr:depnode);
173  mySurftype = 4;
174  if (true)
175  graph->evalOpParm(mySurftype, nodeidx, "surftype", time, graph->isDirect()?nullptr:depnode);
176  myOrient = 1;
177  if (true)
178  graph->evalOpParm(myOrient, nodeidx, "orient", time, graph->isDirect()?nullptr:depnode);
179  myRad = UT_Vector2D(1,0.5);
180  if (true)
181  graph->evalOpParm(myRad, nodeidx, "rad", time, graph->isDirect()?nullptr:depnode);
182  myT = UT_Vector3D(0,0,0);
183  if (true)
184  graph->evalOpParm(myT, nodeidx, "t", time, graph->isDirect()?nullptr:depnode);
185  myR = UT_Vector3D(0,0,0);
186  if (true)
187  graph->evalOpParm(myR, nodeidx, "r", time, graph->isDirect()?nullptr:depnode);
188  myScale = 1;
189  if (true)
190  graph->evalOpParm(myScale, nodeidx, "scale", time, graph->isDirect()?nullptr:depnode);
191  myImperfect = true;
192  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
193  graph->evalOpParm(myImperfect, nodeidx, "imperfect", time, graph->isDirect()?nullptr:depnode);
194  myOrderu = 4;
195  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
196  graph->evalOpParm(myOrderu, nodeidx, "orderu", time, graph->isDirect()?nullptr:depnode);
197  myOrderv = 4;
198  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
199  graph->evalOpParm(myOrderv, nodeidx, "orderv", time, graph->isDirect()?nullptr:depnode);
200  myCloseu = true;
201  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
202  graph->evalOpParm(myCloseu, nodeidx, "closeu", time, graph->isDirect()?nullptr:depnode);
203  myClosev = true;
204  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
205  graph->evalOpParm(myClosev, nodeidx, "closev", time, graph->isDirect()?nullptr:depnode);
206  myCapu = false;
207  if (true && ( (true&&!(((getCloseu()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
208  graph->evalOpParm(myCapu, nodeidx, "capu", time, graph->isDirect()?nullptr:depnode);
209  myCapv = false;
210  if (true && ( (true&&!(((getClosev()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
211  graph->evalOpParm(myCapv, nodeidx, "capv", time, graph->isDirect()?nullptr:depnode);
212  myRows = 12;
213  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
214  graph->evalOpParm(myRows, nodeidx, "rows", time, graph->isDirect()?nullptr:depnode);
215  myCols = 24;
216  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
217  graph->evalOpParm(myCols, nodeidx, "cols", time, graph->isDirect()?nullptr:depnode);
218  myAngleu = UT_Vector2D(0,360);
219  if (true && ( (true&&!(((getCloseu()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
220  graph->evalOpParm(myAngleu, nodeidx, "angleu", time, graph->isDirect()?nullptr:depnode);
221  myAnglev = UT_Vector2D(0,360);
222  if (true && ( (true&&!(((getClosev()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
223  graph->evalOpParm(myAnglev, nodeidx, "anglev", time, graph->isDirect()?nullptr:depnode);
224 
225  }
226 
227 
228  void loadFromOpSubclass(const LoadParms &loadparms) override
229  {
230  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
231  }
232 
233 
234  void copyFrom(const OP_NodeParms *src) override
235  {
236  *this = *((const SOP_TorusParms *)src);
237  }
238 
239  template <typename T>
240  void
241  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
242  {
243  if (idx.size() < 1)
244  return;
245  UT_ASSERT(idx.size() == instance.size()+1);
246  if (idx.size() != instance.size()+1)
247  return;
248  switch (idx[0])
249  {
250  case 0:
251  coerceValue(value, myType);
252  break;
253  case 1:
254  coerceValue(value, mySurftype);
255  break;
256  case 2:
257  coerceValue(value, myOrient);
258  break;
259  case 3:
260  coerceValue(value, myRad);
261  break;
262  case 4:
263  coerceValue(value, myT);
264  break;
265  case 5:
266  coerceValue(value, myR);
267  break;
268  case 6:
269  coerceValue(value, myScale);
270  break;
271  case 7:
272  coerceValue(value, myImperfect);
273  break;
274  case 8:
275  coerceValue(value, myOrderu);
276  break;
277  case 9:
278  coerceValue(value, myOrderv);
279  break;
280  case 10:
281  coerceValue(value, myCloseu);
282  break;
283  case 11:
284  coerceValue(value, myClosev);
285  break;
286  case 12:
287  coerceValue(value, myCapu);
288  break;
289  case 13:
290  coerceValue(value, myCapv);
291  break;
292  case 14:
293  coerceValue(value, myRows);
294  break;
295  case 15:
296  coerceValue(value, myCols);
297  break;
298  case 16:
299  coerceValue(value, myAngleu);
300  break;
301  case 17:
302  coerceValue(value, myAnglev);
303  break;
304 
305  }
306  }
307 
308  bool isParmColorRamp(exint idx) const override
309  {
310  switch (idx)
311  {
312 
313  }
314  return false;
315  }
316 
317  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
318  { doGetParmValue(idx, instance, value); }
319  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
320  { doGetParmValue(idx, instance, value); }
321  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
322  { doGetParmValue(idx, instance, value); }
323  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
324  { doGetParmValue(idx, instance, value); }
325  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
326  { doGetParmValue(idx, instance, value); }
327  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
328  { doGetParmValue(idx, instance, value); }
329  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
330  { doGetParmValue(idx, instance, value); }
331  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
332  { doGetParmValue(idx, instance, value); }
333  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
334  { doGetParmValue(idx, instance, value); }
335  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
336  { doGetParmValue(idx, instance, value); }
337  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
338  { doGetParmValue(idx, instance, value); }
339 
340  template <typename T>
341  void
342  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
343  {
344  if (idx.size() < 1)
345  return;
346  UT_ASSERT(idx.size() == instance.size()+1);
347  if (idx.size() != instance.size()+1)
348  return;
349  switch (idx[0])
350  {
351  case 0:
352  coerceValue(myType, clampMinValue(0, clampMaxValue(4, value ) ));
353  break;
354  case 1:
355  coerceValue(mySurftype, clampMinValue(0, clampMaxValue(6, value ) ));
356  break;
357  case 2:
358  coerceValue(myOrient, clampMinValue(0, clampMaxValue(2, value ) ));
359  break;
360  case 3:
361  coerceValue(myRad, ( ( value ) ));
362  break;
363  case 4:
364  coerceValue(myT, ( ( value ) ));
365  break;
366  case 5:
367  coerceValue(myR, ( ( value ) ));
368  break;
369  case 6:
370  coerceValue(myScale, ( ( value ) ));
371  break;
372  case 7:
373  coerceValue(myImperfect, ( ( value ) ));
374  break;
375  case 8:
376  coerceValue(myOrderu, clampMinValue(2, clampMaxValue(11, value ) ));
377  break;
378  case 9:
379  coerceValue(myOrderv, clampMinValue(2, clampMaxValue(11, value ) ));
380  break;
381  case 10:
382  coerceValue(myCloseu, ( ( value ) ));
383  break;
384  case 11:
385  coerceValue(myClosev, ( ( value ) ));
386  break;
387  case 12:
388  coerceValue(myCapu, ( ( value ) ));
389  break;
390  case 13:
391  coerceValue(myCapv, ( ( value ) ));
392  break;
393  case 14:
394  coerceValue(myRows, clampMinValue(3, ( value ) ));
395  break;
396  case 15:
397  coerceValue(myCols, clampMinValue(3, ( value ) ));
398  break;
399  case 16:
400  coerceValue(myAngleu, ( ( value ) ));
401  break;
402  case 17:
403  coerceValue(myAnglev, ( ( value ) ));
404  break;
405 
406  }
407  }
408 
409  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
410  { doSetParmValue(idx, instance, value); }
411  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
412  { doSetParmValue(idx, instance, value); }
413  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
414  { doSetParmValue(idx, instance, value); }
415  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
416  { doSetParmValue(idx, instance, value); }
417  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
418  { doSetParmValue(idx, instance, value); }
419  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
420  { doSetParmValue(idx, instance, value); }
421  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
422  { doSetParmValue(idx, instance, value); }
423  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
424  { doSetParmValue(idx, instance, value); }
425  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
426  { doSetParmValue(idx, instance, value); }
427  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
428  { doSetParmValue(idx, instance, value); }
429  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
430  { doSetParmValue(idx, instance, value); }
431 
432  exint getNestNumParms(TempIndex idx) const override
433  {
434  if (idx.size() == 0)
435  return 18;
436  switch (idx[0])
437  {
438 
439  }
440  // Invalid
441  return 0;
442  }
443 
444  const char *getNestParmName(TempIndex fieldnum) const override
445  {
446  if (fieldnum.size() < 1)
447  return 0;
448  switch (fieldnum[0])
449  {
450  case 0:
451  return "type";
452  case 1:
453  return "surftype";
454  case 2:
455  return "orient";
456  case 3:
457  return "rad";
458  case 4:
459  return "t";
460  case 5:
461  return "r";
462  case 6:
463  return "scale";
464  case 7:
465  return "imperfect";
466  case 8:
467  return "orderu";
468  case 9:
469  return "orderv";
470  case 10:
471  return "closeu";
472  case 11:
473  return "closev";
474  case 12:
475  return "capu";
476  case 13:
477  return "capv";
478  case 14:
479  return "rows";
480  case 15:
481  return "cols";
482  case 16:
483  return "angleu";
484  case 17:
485  return "anglev";
486 
487  }
488  return 0;
489  }
490 
491  ParmType getNestParmType(TempIndex fieldnum) const override
492  {
493  if (fieldnum.size() < 1)
494  return PARM_UNSUPPORTED;
495  switch (fieldnum[0])
496  {
497  case 0:
498  return PARM_INTEGER;
499  case 1:
500  return PARM_INTEGER;
501  case 2:
502  return PARM_INTEGER;
503  case 3:
504  return PARM_VECTOR2;
505  case 4:
506  return PARM_VECTOR3;
507  case 5:
508  return PARM_VECTOR3;
509  case 6:
510  return PARM_FLOAT;
511  case 7:
512  return PARM_INTEGER;
513  case 8:
514  return PARM_INTEGER;
515  case 9:
516  return PARM_INTEGER;
517  case 10:
518  return PARM_INTEGER;
519  case 11:
520  return PARM_INTEGER;
521  case 12:
522  return PARM_INTEGER;
523  case 13:
524  return PARM_INTEGER;
525  case 14:
526  return PARM_INTEGER;
527  case 15:
528  return PARM_INTEGER;
529  case 16:
530  return PARM_VECTOR2;
531  case 17:
532  return PARM_VECTOR2;
533 
534  }
535  return PARM_UNSUPPORTED;
536  }
537 
538  // Boiler plate to load individual types.
539  static void loadData(UT_IStream &is, int64 &v)
540  { is.bread(&v, 1); }
541  static void loadData(UT_IStream &is, bool &v)
542  { int64 iv; is.bread(&iv, 1); v = iv; }
543  static void loadData(UT_IStream &is, fpreal64 &v)
544  { is.bread<fpreal64>(&v, 1); }
545  static void loadData(UT_IStream &is, UT_Vector2D &v)
546  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
547  static void loadData(UT_IStream &is, UT_Vector3D &v)
548  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
549  is.bread<fpreal64>(&v.z(), 1); }
550  static void loadData(UT_IStream &is, UT_Vector4D &v)
551  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
552  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
553  static void loadData(UT_IStream &is, UT_Matrix2D &v)
554  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
555  static void loadData(UT_IStream &is, UT_Matrix3D &v)
556  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
557  static void loadData(UT_IStream &is, UT_Matrix4D &v)
558  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
559  static void loadData(UT_IStream &is, UT_Vector2I &v)
560  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
561  static void loadData(UT_IStream &is, UT_Vector3I &v)
562  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
563  is.bread<int64>(&v.z(), 1); }
564  static void loadData(UT_IStream &is, UT_Vector4I &v)
565  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
566  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
568  { is.bread(v); }
570  { UT_StringHolder rampdata;
571  loadData(is, rampdata);
572  if (rampdata.isstring())
573  {
574  v.reset(new UT_Ramp());
575  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
576  v->load(istr);
577  }
578  else v.reset();
579  }
582  loadData(is, data);
583  if (data.isstring())
584  {
585  // Find the data type.
586  const char *colon = UT_StringWrap(data).findChar(':');
587  if (colon)
588  {
589  int typelen = colon - data.buffer();
591  type.strncpy(data.buffer(), typelen);
592  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
593 
594  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
595  }
596  }
597  else v.reset();
598  }
599 
600  static void saveData(std::ostream &os, int64 v)
601  { UTwrite(os, &v); }
602  static void saveData(std::ostream &os, bool v)
603  { int64 iv = v; UTwrite(os, &iv); }
604  static void saveData(std::ostream &os, fpreal64 v)
605  { UTwrite<fpreal64>(os, &v); }
606  static void saveData(std::ostream &os, UT_Vector2D v)
607  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
608  static void saveData(std::ostream &os, UT_Vector3D v)
609  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
610  UTwrite<fpreal64>(os, &v.z()); }
611  static void saveData(std::ostream &os, UT_Vector4D v)
612  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
613  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
614  static void saveData(std::ostream &os, UT_Matrix2D v)
616  static void saveData(std::ostream &os, UT_Matrix3D v)
618  static void saveData(std::ostream &os, UT_Matrix4D v)
620  static void saveData(std::ostream &os, UT_StringHolder s)
621  { UT_StringWrap(s).saveBinary(os); }
622  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
624  UT_OStringStream ostr;
625  if (s) s->save(ostr);
626  result = ostr.str();
627  saveData(os, result);
628  }
629  static void saveData(std::ostream &os, PRM_DataItemHandle s)
631  UT_OStringStream ostr;
632  if (s)
633  {
634  ostr << s->getDataTypeToken();
635  ostr << ":";
636  s->saveBinary(ostr);
637  }
638  result = ostr.str();
639  saveData(os, result);
640  }
641 
642 
643  void save(std::ostream &os) const
644  {
645  int32 v = version();
646  UTwrite(os, &v);
647  saveData(os, myType);
648  saveData(os, mySurftype);
649  saveData(os, myOrient);
650  saveData(os, myRad);
651  saveData(os, myT);
652  saveData(os, myR);
653  saveData(os, myScale);
654  saveData(os, myImperfect);
655  saveData(os, myOrderu);
656  saveData(os, myOrderv);
657  saveData(os, myCloseu);
658  saveData(os, myClosev);
659  saveData(os, myCapu);
660  saveData(os, myCapv);
661  saveData(os, myRows);
662  saveData(os, myCols);
663  saveData(os, myAngleu);
664  saveData(os, myAnglev);
665 
666  }
667 
668  bool load(UT_IStream &is)
669  {
670  int32 v;
671  is.bread(&v, 1);
672  if (version() != v)
673  {
674  // Fail incompatible versions
675  return false;
676  }
677  loadData(is, myType);
678  loadData(is, mySurftype);
679  loadData(is, myOrient);
680  loadData(is, myRad);
681  loadData(is, myT);
682  loadData(is, myR);
683  loadData(is, myScale);
684  loadData(is, myImperfect);
685  loadData(is, myOrderu);
686  loadData(is, myOrderv);
687  loadData(is, myCloseu);
688  loadData(is, myClosev);
689  loadData(is, myCapu);
690  loadData(is, myCapv);
691  loadData(is, myRows);
692  loadData(is, myCols);
693  loadData(is, myAngleu);
694  loadData(is, myAnglev);
695 
696  return true;
697  }
698 
699  Type getType() const { return Type(myType); }
700  void setType(Type val) { myType = int64(val); }
701  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
702  {
703  SOP_Node *thissop = cookparms.getNode();
704  if (!thissop) return getType();
705  int64 result;
706  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
707  return Type(result);
708  }
709  Surftype getSurftype() const { return Surftype(mySurftype); }
710  void setSurftype(Surftype val) { mySurftype = int64(val); }
712  {
713  SOP_Node *thissop = cookparms.getNode();
714  if (!thissop) return getSurftype();
715  int64 result;
716  OP_Utils::evalOpParm(result, thissop, "surftype", cookparms.getCookTime(), 0);
717  return Surftype(result);
718  }
719  Orient getOrient() const { return Orient(myOrient); }
720  void setOrient(Orient val) { myOrient = int64(val); }
721  Orient opOrient(const SOP_NodeVerb::CookParms &cookparms) const
722  {
723  SOP_Node *thissop = cookparms.getNode();
724  if (!thissop) return getOrient();
725  int64 result;
726  OP_Utils::evalOpParm(result, thissop, "orient", cookparms.getCookTime(), 0);
727  return Orient(result);
728  }
729  UT_Vector2D getRad() const { return myRad; }
730  void setRad(UT_Vector2D val) { myRad = val; }
731  UT_Vector2D opRad(const SOP_NodeVerb::CookParms &cookparms) const
732  {
733  SOP_Node *thissop = cookparms.getNode();
734  if (!thissop) return getRad();
736  OP_Utils::evalOpParm(result, thissop, "rad", cookparms.getCookTime(), 0);
737  return result;
738  }
739  UT_Vector3D getT() const { return myT; }
740  void setT(UT_Vector3D val) { myT = val; }
741  UT_Vector3D opT(const SOP_NodeVerb::CookParms &cookparms) const
742  {
743  SOP_Node *thissop = cookparms.getNode();
744  if (!thissop) return getT();
746  OP_Utils::evalOpParm(result, thissop, "t", cookparms.getCookTime(), 0);
747  return result;
748  }
749  UT_Vector3D getR() const { return myR; }
750  void setR(UT_Vector3D val) { myR = val; }
751  UT_Vector3D opR(const SOP_NodeVerb::CookParms &cookparms) const
752  {
753  SOP_Node *thissop = cookparms.getNode();
754  if (!thissop) return getR();
756  OP_Utils::evalOpParm(result, thissop, "r", cookparms.getCookTime(), 0);
757  return result;
758  }
759  fpreal64 getScale() const { return myScale; }
760  void setScale(fpreal64 val) { myScale = val; }
761  fpreal64 opScale(const SOP_NodeVerb::CookParms &cookparms) const
762  {
763  SOP_Node *thissop = cookparms.getNode();
764  if (!thissop) return getScale();
766  OP_Utils::evalOpParm(result, thissop, "scale", cookparms.getCookTime(), 0);
767  return result;
768  }
769  bool getImperfect() const { return myImperfect; }
770  void setImperfect(bool val) { myImperfect = val; }
771  bool opImperfect(const SOP_NodeVerb::CookParms &cookparms) const
772  {
773  SOP_Node *thissop = cookparms.getNode();
774  if (!thissop) return getImperfect();
775  bool result;
776  OP_Utils::evalOpParm(result, thissop, "imperfect", cookparms.getCookTime(), 0);
777  return result;
778  }
779  int64 getOrderu() const { return myOrderu; }
780  void setOrderu(int64 val) { myOrderu = val; }
781  int64 opOrderu(const SOP_NodeVerb::CookParms &cookparms) const
782  {
783  SOP_Node *thissop = cookparms.getNode();
784  if (!thissop) return getOrderu();
785  int64 result;
786  OP_Utils::evalOpParm(result, thissop, "orderu", cookparms.getCookTime(), 0);
787  return result;
788  }
789  int64 getOrderv() const { return myOrderv; }
790  void setOrderv(int64 val) { myOrderv = val; }
791  int64 opOrderv(const SOP_NodeVerb::CookParms &cookparms) const
792  {
793  SOP_Node *thissop = cookparms.getNode();
794  if (!thissop) return getOrderv();
795  int64 result;
796  OP_Utils::evalOpParm(result, thissop, "orderv", cookparms.getCookTime(), 0);
797  return result;
798  }
799  bool getCloseu() const { return myCloseu; }
800  void setCloseu(bool val) { myCloseu = val; }
801  bool opCloseu(const SOP_NodeVerb::CookParms &cookparms) const
802  {
803  SOP_Node *thissop = cookparms.getNode();
804  if (!thissop) return getCloseu();
805  bool result;
806  OP_Utils::evalOpParm(result, thissop, "closeu", cookparms.getCookTime(), 0);
807  return result;
808  }
809  bool getClosev() const { return myClosev; }
810  void setClosev(bool val) { myClosev = val; }
811  bool opClosev(const SOP_NodeVerb::CookParms &cookparms) const
812  {
813  SOP_Node *thissop = cookparms.getNode();
814  if (!thissop) return getClosev();
815  bool result;
816  OP_Utils::evalOpParm(result, thissop, "closev", cookparms.getCookTime(), 0);
817  return result;
818  }
819  bool getCapu() const { return myCapu; }
820  void setCapu(bool val) { myCapu = val; }
821  bool opCapu(const SOP_NodeVerb::CookParms &cookparms) const
822  {
823  SOP_Node *thissop = cookparms.getNode();
824  if (!thissop) return getCapu();
825  bool result;
826  OP_Utils::evalOpParm(result, thissop, "capu", cookparms.getCookTime(), 0);
827  return result;
828  }
829  bool getCapv() const { return myCapv; }
830  void setCapv(bool val) { myCapv = val; }
831  bool opCapv(const SOP_NodeVerb::CookParms &cookparms) const
832  {
833  SOP_Node *thissop = cookparms.getNode();
834  if (!thissop) return getCapv();
835  bool result;
836  OP_Utils::evalOpParm(result, thissop, "capv", cookparms.getCookTime(), 0);
837  return result;
838  }
839  int64 getRows() const { return myRows; }
840  void setRows(int64 val) { myRows = val; }
841  int64 opRows(const SOP_NodeVerb::CookParms &cookparms) const
842  {
843  SOP_Node *thissop = cookparms.getNode();
844  if (!thissop) return getRows();
845  int64 result;
846  OP_Utils::evalOpParm(result, thissop, "rows", cookparms.getCookTime(), 0);
847  return result;
848  }
849  int64 getCols() const { return myCols; }
850  void setCols(int64 val) { myCols = val; }
851  int64 opCols(const SOP_NodeVerb::CookParms &cookparms) const
852  {
853  SOP_Node *thissop = cookparms.getNode();
854  if (!thissop) return getCols();
855  int64 result;
856  OP_Utils::evalOpParm(result, thissop, "cols", cookparms.getCookTime(), 0);
857  return result;
858  }
859  UT_Vector2D getAngleu() const { return myAngleu; }
860  void setAngleu(UT_Vector2D val) { myAngleu = val; }
862  {
863  SOP_Node *thissop = cookparms.getNode();
864  if (!thissop) return getAngleu();
866  OP_Utils::evalOpParm(result, thissop, "angleu", cookparms.getCookTime(), 0);
867  return result;
868  }
869  UT_Vector2D getAnglev() const { return myAnglev; }
870  void setAnglev(UT_Vector2D val) { myAnglev = val; }
872  {
873  SOP_Node *thissop = cookparms.getNode();
874  if (!thissop) return getAnglev();
876  OP_Utils::evalOpParm(result, thissop, "anglev", cookparms.getCookTime(), 0);
877  return result;
878  }
879 
880 private:
881  int64 myType;
882  int64 mySurftype;
883  int64 myOrient;
884  UT_Vector2D myRad;
885  UT_Vector3D myT;
886  UT_Vector3D myR;
887  fpreal64 myScale;
888  bool myImperfect;
889  int64 myOrderu;
890  int64 myOrderv;
891  bool myCloseu;
892  bool myClosev;
893  bool myCapu;
894  bool myCapv;
895  int64 myRows;
896  int64 myCols;
897  UT_Vector2D myAngleu;
898  UT_Vector2D myAnglev;
899 
900 };
type
Definition: core.h:556
static int version()
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
bool operator==(const SOP_TorusParms &src) const
void setT(UT_Vector3D val)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_StringHolder &v)
UT_Vector2D opAnglev(const SOP_NodeVerb::CookParms &cookparms) const
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
int64 opCols(const SOP_NodeVerb::CookParms &cookparms) const
bool getClosev() const
static void saveData(std::ostream &os, UT_Matrix4D v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setCols(int64 val)
fpreal64 opScale(const SOP_NodeVerb::CookParms &cookparms) const
void setSurftype(Surftype val)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
exint bread(int32 *buffer, exint asize=1)
void loadFromOpSubclass(const LoadParms &loadparms) override
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
static void loadData(UT_IStream &is, UT_Vector3D &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:63
int64 opOrderv(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector2T< fpreal64 > UT_Vector2D
UT_Vector3D opR(const SOP_NodeVerb::CookParms &cookparms) const
void setClosev(bool val)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
bool getCapu() const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
void setAngleu(UT_Vector2D val)
An output stream object that owns its own string buffer storage.
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
int64 getCols() const
static void loadData(UT_IStream &is, UT_Vector2D &v)
**But if you need a result
Definition: thread.h:622
SYS_FORCE_INLINE UT_StringHolder getToken(Type enum_value)
static void saveData(std::ostream &os, bool v)
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
bool operator!=(const SOP_TorusParms &src) const
bool opImperfect(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
bool getCloseu() const
static void saveData(std::ostream &os, UT_Vector4D v)
double fpreal64
Definition: SYS_Types.h:201
bool opClosev(const SOP_NodeVerb::CookParms &cookparms) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
UT_Vector2D getAnglev() const
static void saveData(std::ostream &os, UT_Matrix2D v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
Type getType() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_Vector3D getT() const
void setOrderv(int64 val)
UT_Vector2D getRad() const
const char * getNestParmName(TempIndex fieldnum) const override
void setScale(fpreal64 val)
int64 opRows(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, fpreal64 v)
void setCapv(bool val)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
bool load(UT_IStream &is)
exint length() const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
UT_Vector2D opRad(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
int64 getOrderv() const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
UT_Vector2D opAngleu(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
UT_Vector3D getR() const
bool getImperfect() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setCapu(bool val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
bool isParmColorRamp(exint idx) const override
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
static void saveData(std::ostream &os, int64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void setAnglev(UT_Vector2D val)
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, UT_Matrix3D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void loadData(UT_IStream &is, bool &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
UT_Vector3T< fpreal64 > UT_Vector3D
void setOrient(Orient val)
void setR(UT_Vector3D val)
fpreal64 getScale() const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void saveData(std::ostream &os, UT_Vector3D v)
void setRows(int64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setImperfect(bool val)
UT_Vector2D getAngleu() const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:303
int64 opOrderu(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
Orient opOrient(const SOP_NodeVerb::CookParms &cookparms) const
int64 getRows() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
exint getNestNumParms(TempIndex idx) const override
fpreal64 fpreal
Definition: SYS_Types.h:278
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setCloseu(bool val)
Surftype opSurftype(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3×3's rows.
Definition: Mat.h:633
#define SOP_API
Definition: SOP_API.h:10
void copyFrom(const OP_NodeParms *src) override
static void loadData(UT_IStream &is, int64 &v)
bool opCapv(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:372
bool opCloseu(const SOP_NodeVerb::CookParms &cookparms) const
Surftype getSurftype() const
const char * findChar(int c) const
Definition: UT_String.h:1401
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
bool getCapv() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
GLboolean r
Definition: glcorearb.h:1222
void setOrderu(int64 val)
ParmType getNestParmType(TempIndex fieldnum) const override
static void saveData(std::ostream &os, UT_StringHolder s)
UT_Vector3D opT(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setType(Type val)
bool opCapu(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
void save(std::ostream &os) const
void setRad(UT_Vector2D val)
static void loadData(UT_IStream &is, fpreal64 &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
int64 getOrderu() const
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
GLenum src
Definition: glcorearb.h:1793
Orient getOrient() const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override