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 <SOP/SOP_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  return true;
154  }
155  bool operator!=(const SOP_TorusParms &src) const
156  {
157  return !operator==(src);
158  }
162 
163 
164 
165  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
166  {
167  myType = 0;
168  if (true)
169  graph->evalOpParm(myType, nodeidx, "type", time, 0);
170  mySurftype = 4;
171  if (true)
172  graph->evalOpParm(mySurftype, nodeidx, "surftype", time, 0);
173  myOrient = 1;
174  if (true)
175  graph->evalOpParm(myOrient, nodeidx, "orient", time, 0);
176  myRad = UT_Vector2D(1,0.5);
177  if (true)
178  graph->evalOpParm(myRad, nodeidx, "rad", time, 0);
179  myT = UT_Vector3D(0,0,0);
180  if (true)
181  graph->evalOpParm(myT, nodeidx, "t", time, 0);
182  myR = UT_Vector3D(0,0,0);
183  if (true)
184  graph->evalOpParm(myR, nodeidx, "r", time, 0);
185  myScale = 1;
186  if (true)
187  graph->evalOpParm(myScale, nodeidx, "scale", time, 0);
188  myImperfect = true;
189  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
190  graph->evalOpParm(myImperfect, nodeidx, "imperfect", time, 0);
191  myOrderu = 4;
192  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
193  graph->evalOpParm(myOrderu, nodeidx, "orderu", time, 0);
194  myOrderv = 4;
195  if (true && ( (true&&!(((int64(getType())!=3)&&(int64(getType())!=2)))) ) )
196  graph->evalOpParm(myOrderv, nodeidx, "orderv", time, 0);
197  myCloseu = true;
198  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
199  graph->evalOpParm(myCloseu, nodeidx, "closeu", time, 0);
200  myClosev = true;
201  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
202  graph->evalOpParm(myClosev, nodeidx, "closev", time, 0);
203  myCapu = false;
204  if (true && ( (true&&!(((getCloseu()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
205  graph->evalOpParm(myCapu, nodeidx, "capu", time, 0);
206  myCapv = false;
207  if (true && ( (true&&!(((getClosev()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
208  graph->evalOpParm(myCapv, nodeidx, "capv", time, 0);
209  myRows = 12;
210  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
211  graph->evalOpParm(myRows, nodeidx, "rows", time, 0);
212  myCols = 24;
213  if (true && ( (true&&!(((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
214  graph->evalOpParm(myCols, nodeidx, "cols", time, 0);
215  myAngleu = UT_Vector2D(0,360);
216  if (true && ( (true&&!(((getCloseu()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
217  graph->evalOpParm(myAngleu, nodeidx, "angleu", time, 0);
218  myAnglev = UT_Vector2D(0,360);
219  if (true && ( (true&&!(((getClosev()==1))||((int64(getType())==2)&&(getImperfect()==0))||((int64(getType())==3)&&(getImperfect()==0)))) ) )
220  graph->evalOpParm(myAnglev, nodeidx, "anglev", time, 0);
221 
222  }
223 
224 
225  void loadFromOpSubclass(const LoadParms &loadparms) override
226  {
227  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
228  }
229 
230 
231  void copyFrom(const OP_NodeParms *src) override
232  {
233  *this = *((const SOP_TorusParms *)src);
234  }
235 
236  template <typename T>
237  void
238  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
239  {
240  if (idx.size() < 1)
241  return;
242  UT_ASSERT(idx.size() == instance.size()+1);
243  if (idx.size() != instance.size()+1)
244  return;
245  switch (idx[0])
246  {
247  case 0:
248  coerceValue(value, myType);
249  break;
250  case 1:
251  coerceValue(value, mySurftype);
252  break;
253  case 2:
254  coerceValue(value, myOrient);
255  break;
256  case 3:
257  coerceValue(value, myRad);
258  break;
259  case 4:
260  coerceValue(value, myT);
261  break;
262  case 5:
263  coerceValue(value, myR);
264  break;
265  case 6:
266  coerceValue(value, myScale);
267  break;
268  case 7:
269  coerceValue(value, myImperfect);
270  break;
271  case 8:
272  coerceValue(value, myOrderu);
273  break;
274  case 9:
275  coerceValue(value, myOrderv);
276  break;
277  case 10:
278  coerceValue(value, myCloseu);
279  break;
280  case 11:
281  coerceValue(value, myClosev);
282  break;
283  case 12:
284  coerceValue(value, myCapu);
285  break;
286  case 13:
287  coerceValue(value, myCapv);
288  break;
289  case 14:
290  coerceValue(value, myRows);
291  break;
292  case 15:
293  coerceValue(value, myCols);
294  break;
295  case 16:
296  coerceValue(value, myAngleu);
297  break;
298  case 17:
299  coerceValue(value, myAnglev);
300  break;
301 
302  }
303  }
304 
305  bool isParmColorRamp(exint idx) const override
306  {
307  switch (idx)
308  {
309 
310  }
311  return false;
312  }
313 
314  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
315  { doGetParmValue(idx, instance, value); }
316  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
317  { doGetParmValue(idx, instance, value); }
318  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
319  { doGetParmValue(idx, instance, value); }
320  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
321  { doGetParmValue(idx, instance, value); }
322  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
323  { doGetParmValue(idx, instance, value); }
324  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
325  { doGetParmValue(idx, instance, value); }
326  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
327  { doGetParmValue(idx, instance, value); }
328  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
329  { doGetParmValue(idx, instance, value); }
330  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
331  { doGetParmValue(idx, instance, value); }
332  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
333  { doGetParmValue(idx, instance, value); }
334  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
335  { doGetParmValue(idx, instance, value); }
336 
337  template <typename T>
338  void
339  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
340  {
341  if (idx.size() < 1)
342  return;
343  UT_ASSERT(idx.size() == instance.size()+1);
344  if (idx.size() != instance.size()+1)
345  return;
346  switch (idx[0])
347  {
348  case 0:
349  coerceValue(myType, clampMinValue(0, clampMaxValue(4, value ) ));
350  break;
351  case 1:
352  coerceValue(mySurftype, clampMinValue(0, clampMaxValue(6, value ) ));
353  break;
354  case 2:
355  coerceValue(myOrient, clampMinValue(0, clampMaxValue(2, value ) ));
356  break;
357  case 3:
358  coerceValue(myRad, ( ( value ) ));
359  break;
360  case 4:
361  coerceValue(myT, ( ( value ) ));
362  break;
363  case 5:
364  coerceValue(myR, ( ( value ) ));
365  break;
366  case 6:
367  coerceValue(myScale, ( ( value ) ));
368  break;
369  case 7:
370  coerceValue(myImperfect, ( ( value ) ));
371  break;
372  case 8:
373  coerceValue(myOrderu, clampMinValue(2, clampMaxValue(11, value ) ));
374  break;
375  case 9:
376  coerceValue(myOrderv, clampMinValue(2, clampMaxValue(11, value ) ));
377  break;
378  case 10:
379  coerceValue(myCloseu, ( ( value ) ));
380  break;
381  case 11:
382  coerceValue(myClosev, ( ( value ) ));
383  break;
384  case 12:
385  coerceValue(myCapu, ( ( value ) ));
386  break;
387  case 13:
388  coerceValue(myCapv, ( ( value ) ));
389  break;
390  case 14:
391  coerceValue(myRows, clampMinValue(3, ( value ) ));
392  break;
393  case 15:
394  coerceValue(myCols, clampMinValue(3, ( value ) ));
395  break;
396  case 16:
397  coerceValue(myAngleu, ( ( value ) ));
398  break;
399  case 17:
400  coerceValue(myAnglev, ( ( value ) ));
401  break;
402 
403  }
404  }
405 
406  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
407  { doSetParmValue(idx, instance, value); }
408  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
409  { doSetParmValue(idx, instance, value); }
410  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
411  { doSetParmValue(idx, instance, value); }
412  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
413  { doSetParmValue(idx, instance, value); }
414  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
415  { doSetParmValue(idx, instance, value); }
416  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
417  { doSetParmValue(idx, instance, value); }
418  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
419  { doSetParmValue(idx, instance, value); }
420  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
421  { doSetParmValue(idx, instance, value); }
422  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
423  { doSetParmValue(idx, instance, value); }
424  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
425  { doSetParmValue(idx, instance, value); }
426  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
427  { doSetParmValue(idx, instance, value); }
428 
429  exint getNestNumParms(TempIndex idx) const override
430  {
431  if (idx.size() == 0)
432  return 18;
433  switch (idx[0])
434  {
435 
436  }
437  // Invalid
438  return 0;
439  }
440 
441  const char *getNestParmName(TempIndex fieldnum) const override
442  {
443  if (fieldnum.size() < 1)
444  return 0;
445  switch (fieldnum[0])
446  {
447  case 0:
448  return "type";
449  case 1:
450  return "surftype";
451  case 2:
452  return "orient";
453  case 3:
454  return "rad";
455  case 4:
456  return "t";
457  case 5:
458  return "r";
459  case 6:
460  return "scale";
461  case 7:
462  return "imperfect";
463  case 8:
464  return "orderu";
465  case 9:
466  return "orderv";
467  case 10:
468  return "closeu";
469  case 11:
470  return "closev";
471  case 12:
472  return "capu";
473  case 13:
474  return "capv";
475  case 14:
476  return "rows";
477  case 15:
478  return "cols";
479  case 16:
480  return "angleu";
481  case 17:
482  return "anglev";
483 
484  }
485  return 0;
486  }
487 
488  ParmType getNestParmType(TempIndex fieldnum) const override
489  {
490  if (fieldnum.size() < 1)
491  return PARM_UNSUPPORTED;
492  switch (fieldnum[0])
493  {
494  case 0:
495  return PARM_INTEGER;
496  case 1:
497  return PARM_INTEGER;
498  case 2:
499  return PARM_INTEGER;
500  case 3:
501  return PARM_VECTOR2;
502  case 4:
503  return PARM_VECTOR3;
504  case 5:
505  return PARM_VECTOR3;
506  case 6:
507  return PARM_FLOAT;
508  case 7:
509  return PARM_INTEGER;
510  case 8:
511  return PARM_INTEGER;
512  case 9:
513  return PARM_INTEGER;
514  case 10:
515  return PARM_INTEGER;
516  case 11:
517  return PARM_INTEGER;
518  case 12:
519  return PARM_INTEGER;
520  case 13:
521  return PARM_INTEGER;
522  case 14:
523  return PARM_INTEGER;
524  case 15:
525  return PARM_INTEGER;
526  case 16:
527  return PARM_VECTOR2;
528  case 17:
529  return PARM_VECTOR2;
530 
531  }
532  return PARM_UNSUPPORTED;
533  }
534 
535  // Boiler plate to load individual types.
536  static void loadData(UT_IStream &is, int64 &v)
537  { is.bread(&v, 1); }
538  static void loadData(UT_IStream &is, bool &v)
539  { int64 iv; is.bread(&iv, 1); v = iv; }
540  static void loadData(UT_IStream &is, fpreal64 &v)
541  { is.bread<fpreal64>(&v, 1); }
542  static void loadData(UT_IStream &is, UT_Vector2D &v)
543  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
544  static void loadData(UT_IStream &is, UT_Vector3D &v)
545  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
546  is.bread<fpreal64>(&v.z(), 1); }
547  static void loadData(UT_IStream &is, UT_Vector4D &v)
548  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
549  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
550  static void loadData(UT_IStream &is, UT_Matrix2D &v)
551  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
552  static void loadData(UT_IStream &is, UT_Matrix3D &v)
553  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
554  static void loadData(UT_IStream &is, UT_Matrix4D &v)
555  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
556  static void loadData(UT_IStream &is, UT_Vector2I &v)
557  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
558  static void loadData(UT_IStream &is, UT_Vector3I &v)
559  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
560  is.bread<int64>(&v.z(), 1); }
561  static void loadData(UT_IStream &is, UT_Vector4I &v)
562  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
563  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
565  { is.bread(v); }
567  { UT_StringHolder rampdata;
568  loadData(is, rampdata);
569  if (rampdata.isstring())
570  {
571  v.reset(new UT_Ramp());
572  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
573  v->load(istr);
574  }
575  else v.reset();
576  }
579  loadData(is, data);
580  if (data.isstring())
581  {
582  // Find the data type.
583  const char *colon = UT_StringWrap(data).findChar(':');
584  if (colon)
585  {
586  int typelen = colon - data.buffer();
588  type.strncpy(data.buffer(), typelen);
589  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
590 
591  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
592  }
593  }
594  else v.reset();
595  }
596 
597  static void saveData(std::ostream &os, int64 v)
598  { UTwrite(os, &v); }
599  static void saveData(std::ostream &os, bool v)
600  { int64 iv = v; UTwrite(os, &iv); }
601  static void saveData(std::ostream &os, fpreal64 v)
602  { UTwrite<fpreal64>(os, &v); }
603  static void saveData(std::ostream &os, UT_Vector2D v)
604  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
605  static void saveData(std::ostream &os, UT_Vector3D v)
606  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
607  UTwrite<fpreal64>(os, &v.z()); }
608  static void saveData(std::ostream &os, UT_Vector4D v)
609  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
610  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
611  static void saveData(std::ostream &os, UT_Matrix2D v)
613  static void saveData(std::ostream &os, UT_Matrix3D v)
615  static void saveData(std::ostream &os, UT_Matrix4D v)
617  static void saveData(std::ostream &os, UT_StringHolder s)
618  { UT_StringWrap(s).saveBinary(os); }
619  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
621  UT_OStringStream ostr;
622  if (s) s->save(ostr);
623  result = ostr.str();
624  saveData(os, result);
625  }
626  static void saveData(std::ostream &os, PRM_DataItemHandle s)
628  UT_OStringStream ostr;
629  if (s)
630  {
631  ostr << s->getDataTypeToken();
632  ostr << ":";
633  s->saveBinary(ostr);
634  }
635  result = ostr.str();
636  saveData(os, result);
637  }
638 
639 
640  void save(std::ostream &os) const
641  {
642  int32 v = version();
643  UTwrite(os, &v);
644  saveData(os, myType);
645  saveData(os, mySurftype);
646  saveData(os, myOrient);
647  saveData(os, myRad);
648  saveData(os, myT);
649  saveData(os, myR);
650  saveData(os, myScale);
651  saveData(os, myImperfect);
652  saveData(os, myOrderu);
653  saveData(os, myOrderv);
654  saveData(os, myCloseu);
655  saveData(os, myClosev);
656  saveData(os, myCapu);
657  saveData(os, myCapv);
658  saveData(os, myRows);
659  saveData(os, myCols);
660  saveData(os, myAngleu);
661  saveData(os, myAnglev);
662 
663  }
664 
665  bool load(UT_IStream &is)
666  {
667  int32 v;
668  is.bread(&v, 1);
669  if (version() != v)
670  {
671  // Fail incompatible versions
672  return false;
673  }
674  loadData(is, myType);
675  loadData(is, mySurftype);
676  loadData(is, myOrient);
677  loadData(is, myRad);
678  loadData(is, myT);
679  loadData(is, myR);
680  loadData(is, myScale);
681  loadData(is, myImperfect);
682  loadData(is, myOrderu);
683  loadData(is, myOrderv);
684  loadData(is, myCloseu);
685  loadData(is, myClosev);
686  loadData(is, myCapu);
687  loadData(is, myCapv);
688  loadData(is, myRows);
689  loadData(is, myCols);
690  loadData(is, myAngleu);
691  loadData(is, myAnglev);
692 
693  return true;
694  }
695 
696  Type getType() const { return Type(myType); }
697  void setType(Type val) { myType = int64(val); }
698  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
699  {
700  SOP_Node *thissop = cookparms.getNode();
701  if (!thissop) return getType();
702  int64 result;
703  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
704  return Type(result);
705  }
706  Surftype getSurftype() const { return Surftype(mySurftype); }
707  void setSurftype(Surftype val) { mySurftype = int64(val); }
709  {
710  SOP_Node *thissop = cookparms.getNode();
711  if (!thissop) return getSurftype();
712  int64 result;
713  OP_Utils::evalOpParm(result, thissop, "surftype", cookparms.getCookTime(), 0);
714  return Surftype(result);
715  }
716  Orient getOrient() const { return Orient(myOrient); }
717  void setOrient(Orient val) { myOrient = int64(val); }
718  Orient opOrient(const SOP_NodeVerb::CookParms &cookparms) const
719  {
720  SOP_Node *thissop = cookparms.getNode();
721  if (!thissop) return getOrient();
722  int64 result;
723  OP_Utils::evalOpParm(result, thissop, "orient", cookparms.getCookTime(), 0);
724  return Orient(result);
725  }
726  UT_Vector2D getRad() const { return myRad; }
727  void setRad(UT_Vector2D val) { myRad = val; }
728  UT_Vector2D opRad(const SOP_NodeVerb::CookParms &cookparms) const
729  {
730  SOP_Node *thissop = cookparms.getNode();
731  if (!thissop) return getRad();
733  OP_Utils::evalOpParm(result, thissop, "rad", cookparms.getCookTime(), 0);
734  return result;
735  }
736  UT_Vector3D getT() const { return myT; }
737  void setT(UT_Vector3D val) { myT = val; }
738  UT_Vector3D opT(const SOP_NodeVerb::CookParms &cookparms) const
739  {
740  SOP_Node *thissop = cookparms.getNode();
741  if (!thissop) return getT();
743  OP_Utils::evalOpParm(result, thissop, "t", cookparms.getCookTime(), 0);
744  return result;
745  }
746  UT_Vector3D getR() const { return myR; }
747  void setR(UT_Vector3D val) { myR = val; }
748  UT_Vector3D opR(const SOP_NodeVerb::CookParms &cookparms) const
749  {
750  SOP_Node *thissop = cookparms.getNode();
751  if (!thissop) return getR();
753  OP_Utils::evalOpParm(result, thissop, "r", cookparms.getCookTime(), 0);
754  return result;
755  }
756  fpreal64 getScale() const { return myScale; }
757  void setScale(fpreal64 val) { myScale = val; }
758  fpreal64 opScale(const SOP_NodeVerb::CookParms &cookparms) const
759  {
760  SOP_Node *thissop = cookparms.getNode();
761  if (!thissop) return getScale();
763  OP_Utils::evalOpParm(result, thissop, "scale", cookparms.getCookTime(), 0);
764  return result;
765  }
766  bool getImperfect() const { return myImperfect; }
767  void setImperfect(bool val) { myImperfect = val; }
768  bool opImperfect(const SOP_NodeVerb::CookParms &cookparms) const
769  {
770  SOP_Node *thissop = cookparms.getNode();
771  if (!thissop) return getImperfect();
772  bool result;
773  OP_Utils::evalOpParm(result, thissop, "imperfect", cookparms.getCookTime(), 0);
774  return result;
775  }
776  int64 getOrderu() const { return myOrderu; }
777  void setOrderu(int64 val) { myOrderu = val; }
778  int64 opOrderu(const SOP_NodeVerb::CookParms &cookparms) const
779  {
780  SOP_Node *thissop = cookparms.getNode();
781  if (!thissop) return getOrderu();
782  int64 result;
783  OP_Utils::evalOpParm(result, thissop, "orderu", cookparms.getCookTime(), 0);
784  return result;
785  }
786  int64 getOrderv() const { return myOrderv; }
787  void setOrderv(int64 val) { myOrderv = val; }
788  int64 opOrderv(const SOP_NodeVerb::CookParms &cookparms) const
789  {
790  SOP_Node *thissop = cookparms.getNode();
791  if (!thissop) return getOrderv();
792  int64 result;
793  OP_Utils::evalOpParm(result, thissop, "orderv", cookparms.getCookTime(), 0);
794  return result;
795  }
796  bool getCloseu() const { return myCloseu; }
797  void setCloseu(bool val) { myCloseu = val; }
798  bool opCloseu(const SOP_NodeVerb::CookParms &cookparms) const
799  {
800  SOP_Node *thissop = cookparms.getNode();
801  if (!thissop) return getCloseu();
802  bool result;
803  OP_Utils::evalOpParm(result, thissop, "closeu", cookparms.getCookTime(), 0);
804  return result;
805  }
806  bool getClosev() const { return myClosev; }
807  void setClosev(bool val) { myClosev = val; }
808  bool opClosev(const SOP_NodeVerb::CookParms &cookparms) const
809  {
810  SOP_Node *thissop = cookparms.getNode();
811  if (!thissop) return getClosev();
812  bool result;
813  OP_Utils::evalOpParm(result, thissop, "closev", cookparms.getCookTime(), 0);
814  return result;
815  }
816  bool getCapu() const { return myCapu; }
817  void setCapu(bool val) { myCapu = val; }
818  bool opCapu(const SOP_NodeVerb::CookParms &cookparms) const
819  {
820  SOP_Node *thissop = cookparms.getNode();
821  if (!thissop) return getCapu();
822  bool result;
823  OP_Utils::evalOpParm(result, thissop, "capu", cookparms.getCookTime(), 0);
824  return result;
825  }
826  bool getCapv() const { return myCapv; }
827  void setCapv(bool val) { myCapv = val; }
828  bool opCapv(const SOP_NodeVerb::CookParms &cookparms) const
829  {
830  SOP_Node *thissop = cookparms.getNode();
831  if (!thissop) return getCapv();
832  bool result;
833  OP_Utils::evalOpParm(result, thissop, "capv", cookparms.getCookTime(), 0);
834  return result;
835  }
836  int64 getRows() const { return myRows; }
837  void setRows(int64 val) { myRows = val; }
838  int64 opRows(const SOP_NodeVerb::CookParms &cookparms) const
839  {
840  SOP_Node *thissop = cookparms.getNode();
841  if (!thissop) return getRows();
842  int64 result;
843  OP_Utils::evalOpParm(result, thissop, "rows", cookparms.getCookTime(), 0);
844  return result;
845  }
846  int64 getCols() const { return myCols; }
847  void setCols(int64 val) { myCols = val; }
848  int64 opCols(const SOP_NodeVerb::CookParms &cookparms) const
849  {
850  SOP_Node *thissop = cookparms.getNode();
851  if (!thissop) return getCols();
852  int64 result;
853  OP_Utils::evalOpParm(result, thissop, "cols", cookparms.getCookTime(), 0);
854  return result;
855  }
856  UT_Vector2D getAngleu() const { return myAngleu; }
857  void setAngleu(UT_Vector2D val) { myAngleu = val; }
859  {
860  SOP_Node *thissop = cookparms.getNode();
861  if (!thissop) return getAngleu();
863  OP_Utils::evalOpParm(result, thissop, "angleu", cookparms.getCookTime(), 0);
864  return result;
865  }
866  UT_Vector2D getAnglev() const { return myAnglev; }
867  void setAnglev(UT_Vector2D val) { myAnglev = val; }
869  {
870  SOP_Node *thissop = cookparms.getNode();
871  if (!thissop) return getAnglev();
873  OP_Utils::evalOpParm(result, thissop, "anglev", cookparms.getCookTime(), 0);
874  return result;
875  }
876 
877 private:
878  int64 myType;
879  int64 mySurftype;
880  int64 myOrient;
881  UT_Vector2D myRad;
882  UT_Vector3D myT;
883  UT_Vector3D myR;
884  fpreal64 myScale;
885  bool myImperfect;
886  int64 myOrderu;
887  int64 myOrderv;
888  bool myCloseu;
889  bool myClosev;
890  bool myCapu;
891  bool myCapv;
892  int64 myRows;
893  int64 myCols;
894  UT_Vector2D myAngleu;
895  UT_Vector2D myAnglev;
896 
897 };
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:62
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)
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:613
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
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:296
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:277
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:92
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
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:361
bool opCloseu(const SOP_NodeVerb::CookParms &cookparms) const
Surftype getSurftype() const
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
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
type
Definition: core.h:1059
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
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