HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Fit.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_FitEnums
24 {
25  enum class Method
26  {
27  APPROX = 0,
28  INTERP
29  };
30 
32  getToken(Method enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Method::APPROX: return "approx"_sh;
37  case Method::INTERP: return "interp"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42  enum class Type
43  {
44  NURBS = 0,
45  BEZIER
46  };
47 
49  getToken(Type enum_value)
50  {
51  using namespace UT::Literal;
52  switch (enum_value) {
53  case Type::NURBS: return "nurbs"_sh;
54  case Type::BEZIER: return "bezier"_sh;
55  default: UT_ASSERT(false); return ""_sh;
56  }
57  }
58 
59  enum class SurfType
60  {
61  ROWS = 0,
62  COLS,
63  ROWCOL,
64  TRIANGLES,
65  QUADS,
68  };
69 
71  getToken(SurfType enum_value)
72  {
73  using namespace UT::Literal;
74  switch (enum_value) {
75  case SurfType::ROWS: return "rows"_sh;
76  case SurfType::COLS: return "cols"_sh;
77  case SurfType::ROWCOL: return "rowcol"_sh;
78  case SurfType::TRIANGLES: return "triangles"_sh;
79  case SurfType::QUADS: return "quads"_sh;
80  case SurfType::ALTTRIANGLES: return "alttriangles"_sh;
81  case SurfType::REVTRIANGLES: return "revtriangles"_sh;
82  default: UT_ASSERT(false); return ""_sh;
83  }
84  }
85 
86  enum class Scope
87  {
88  GLOBAL = 0,
89  LOCAL,
90  BREAKPNT
91  };
92 
94  getToken(Scope enum_value)
95  {
96  using namespace UT::Literal;
97  switch (enum_value) {
98  case Scope::GLOBAL: return "global"_sh;
99  case Scope::LOCAL: return "local"_sh;
100  case Scope::BREAKPNT: return "breakpnt"_sh;
101  default: UT_ASSERT(false); return ""_sh;
102  }
103  }
104 
105  enum class DataParmU
106  {
107  UNIFORM = 0,
108  CHRDLEN,
109  CENTRIP
110  };
111 
113  getToken(DataParmU enum_value)
114  {
115  using namespace UT::Literal;
116  switch (enum_value) {
117  case DataParmU::UNIFORM: return "uniform"_sh;
118  case DataParmU::CHRDLEN: return "chrdlen"_sh;
119  case DataParmU::CENTRIP: return "centrip"_sh;
120  default: UT_ASSERT(false); return ""_sh;
121  }
122  }
123 
124  enum class DataParmV
125  {
126  UNIFORM = 0,
127  CHRDLEN,
128  CENTRIP
129  };
130 
132  getToken(DataParmV enum_value)
133  {
134  using namespace UT::Literal;
135  switch (enum_value) {
136  case DataParmV::UNIFORM: return "uniform"_sh;
137  case DataParmV::CHRDLEN: return "chrdlen"_sh;
138  case DataParmV::CENTRIP: return "centrip"_sh;
139  default: UT_ASSERT(false); return ""_sh;
140  }
141  }
142 
143  enum class CloseU
144  {
145  NONEWU = 0,
146  WU,
147  IFPRIMWU
148  };
149 
151  getToken(CloseU enum_value)
152  {
153  using namespace UT::Literal;
154  switch (enum_value) {
155  case CloseU::NONEWU: return "nonewu"_sh;
156  case CloseU::WU: return "wu"_sh;
157  case CloseU::IFPRIMWU: return "ifprimwu"_sh;
158  default: UT_ASSERT(false); return ""_sh;
159  }
160  }
161 
162  enum class CloseV
163  {
164  NONEWV = 0,
165  WV,
166  IFPRIMWV
167  };
168 
170  getToken(CloseV enum_value)
171  {
172  using namespace UT::Literal;
173  switch (enum_value) {
174  case CloseV::NONEWV: return "nonewv"_sh;
175  case CloseV::WV: return "wv"_sh;
176  case CloseV::IFPRIMWV: return "ifprimwv"_sh;
177  default: UT_ASSERT(false); return ""_sh;
178  }
179  }
180 
181 }
182 
183 
185 {
186 public:
187  static int version() { return 1; }
188 
190  {
191  myGroup = ""_UTsh;
192  myMethod = 0;
193  myType = 0;
194  mySurfType = 4;
195  myOrderU = 4;
196  myOrderV = 4;
197  myTol = 0.01;
198  mySmooth = 0;
199  myMultipleU = false;
200  myMultipleV = false;
201  myScope = 0;
202  myDataParmU = 1;
203  myDataParmV = 1;
204  myCloseU = 2;
205  myCloseV = 2;
206  myCorners = false;
207 
208  }
209 
210  explicit SOP_FitParms(const SOP_FitParms &) = default;
211  SOP_FitParms &operator=(const SOP_FitParms &) = default;
212  SOP_FitParms(SOP_FitParms &&) noexcept = default;
213  SOP_FitParms &operator=(SOP_FitParms &&) noexcept = default;
214 
215  ~SOP_FitParms() override {}
216 
217  bool operator==(const SOP_FitParms &src) const
218  {
219  if (myGroup != src.myGroup) return false;
220  if (myMethod != src.myMethod) return false;
221  if (myType != src.myType) return false;
222  if (mySurfType != src.mySurfType) return false;
223  if (myOrderU != src.myOrderU) return false;
224  if (myOrderV != src.myOrderV) return false;
225  if (myTol != src.myTol) return false;
226  if (mySmooth != src.mySmooth) return false;
227  if (myMultipleU != src.myMultipleU) return false;
228  if (myMultipleV != src.myMultipleV) return false;
229  if (myScope != src.myScope) return false;
230  if (myDataParmU != src.myDataParmU) return false;
231  if (myDataParmV != src.myDataParmV) return false;
232  if (myCloseU != src.myCloseU) return false;
233  if (myCloseV != src.myCloseV) return false;
234  if (myCorners != src.myCorners) return false;
235 
236  return true;
237  }
238  bool operator!=(const SOP_FitParms &src) const
239  {
240  return !operator==(src);
241  }
250 
251 
252 
253  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
254  {
255  myGroup = ""_UTsh;
256  if (true)
257  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
258  myMethod = 0;
259  if (true)
260  graph->evalOpParm(myMethod, nodeidx, "method", time, 0);
261  myType = 0;
262  if (true)
263  graph->evalOpParm(myType, nodeidx, "type", time, 0);
264  mySurfType = 4;
265  if (true)
266  graph->evalOpParm(mySurfType, nodeidx, "surftype", time, 0);
267  myOrderU = 4;
268  if (true)
269  graph->evalOpParm(myOrderU, nodeidx, "orderu", time, 0);
270  myOrderV = 4;
271  if (true)
272  graph->evalOpParm(myOrderV, nodeidx, "orderv", time, 0);
273  myTol = 0.01;
274  if (true && ( (true&&!(((int64(getMethod())!=0))||((int64(getMethod())==1)))) ) )
275  graph->evalOpParm(myTol, nodeidx, "tol", time, 0);
276  mySmooth = 0;
277  if (true && ( (true&&!(((int64(getMethod())!=0))||((int64(getMethod())==1)))) ) )
278  graph->evalOpParm(mySmooth, nodeidx, "smooth", time, 0);
279  myMultipleU = false;
280  if (true && ( (true&&!(((int64(getMethod())!=0))||((int64(getMethod())==1)))) ) )
281  graph->evalOpParm(myMultipleU, nodeidx, "multipleu", time, 0);
282  myMultipleV = false;
283  if (true && ( (true&&!(((int64(getMethod())!=0))||((int64(getMethod())==1)))) ) )
284  graph->evalOpParm(myMultipleV, nodeidx, "multiplev", time, 0);
285  myScope = 0;
286  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0)))) ) )
287  graph->evalOpParm(myScope, nodeidx, "scope", time, 0);
288  myDataParmU = 1;
289  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0)))) ) )
290  graph->evalOpParm(myDataParmU, nodeidx, "dataparmu", time, 0);
291  myDataParmV = 1;
292  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0)))) ) )
293  graph->evalOpParm(myDataParmV, nodeidx, "dataparmv", time, 0);
294  myCloseU = 2;
295  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0)))) ) )
296  graph->evalOpParm(myCloseU, nodeidx, "closeu", time, 0);
297  myCloseV = 2;
298  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0)))) ) )
299  graph->evalOpParm(myCloseV, nodeidx, "closev", time, 0);
300  myCorners = false;
301  if (true && ( (true&&!(((int64(getMethod())!=1))||((int64(getMethod())==0))||((int64(getScope())!=1)))) ) )
302  graph->evalOpParm(myCorners, nodeidx, "corners", time, 0);
303 
304  }
305 
306 
307  void loadFromOpSubclass(const LoadParms &loadparms) override
308  {
309  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
310  }
311 
312 
313  void copyFrom(const OP_NodeParms *src) override
314  {
315  *this = *((const SOP_FitParms *)src);
316  }
317 
318  template <typename T>
319  void
320  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
321  {
322  if (idx.size() < 1)
323  return;
324  UT_ASSERT(idx.size() == instance.size()+1);
325  if (idx.size() != instance.size()+1)
326  return;
327  switch (idx[0])
328  {
329  case 0:
330  coerceValue(value, myGroup);
331  break;
332  case 1:
333  coerceValue(value, myMethod);
334  break;
335  case 2:
336  coerceValue(value, myType);
337  break;
338  case 3:
339  coerceValue(value, mySurfType);
340  break;
341  case 4:
342  coerceValue(value, myOrderU);
343  break;
344  case 5:
345  coerceValue(value, myOrderV);
346  break;
347  case 6:
348  coerceValue(value, myTol);
349  break;
350  case 7:
351  coerceValue(value, mySmooth);
352  break;
353  case 8:
354  coerceValue(value, myMultipleU);
355  break;
356  case 9:
357  coerceValue(value, myMultipleV);
358  break;
359  case 10:
360  coerceValue(value, myScope);
361  break;
362  case 11:
363  coerceValue(value, myDataParmU);
364  break;
365  case 12:
366  coerceValue(value, myDataParmV);
367  break;
368  case 13:
369  coerceValue(value, myCloseU);
370  break;
371  case 14:
372  coerceValue(value, myCloseV);
373  break;
374  case 15:
375  coerceValue(value, myCorners);
376  break;
377 
378  }
379  }
380 
381  bool isParmColorRamp(exint idx) const override
382  {
383  switch (idx)
384  {
385 
386  }
387  return false;
388  }
389 
390  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
391  { doGetParmValue(idx, instance, value); }
392  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
393  { doGetParmValue(idx, instance, value); }
394  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
395  { doGetParmValue(idx, instance, value); }
396  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
397  { doGetParmValue(idx, instance, value); }
398  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
399  { doGetParmValue(idx, instance, value); }
400  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
401  { doGetParmValue(idx, instance, value); }
402  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
403  { doGetParmValue(idx, instance, value); }
404  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
405  { doGetParmValue(idx, instance, value); }
406  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
407  { doGetParmValue(idx, instance, value); }
408  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
409  { doGetParmValue(idx, instance, value); }
410  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
411  { doGetParmValue(idx, instance, value); }
412 
413  template <typename T>
414  void
415  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
416  {
417  if (idx.size() < 1)
418  return;
419  UT_ASSERT(idx.size() == instance.size()+1);
420  if (idx.size() != instance.size()+1)
421  return;
422  switch (idx[0])
423  {
424  case 0:
425  coerceValue(myGroup, ( ( value ) ));
426  break;
427  case 1:
428  coerceValue(myMethod, clampMinValue(0, clampMaxValue(1, value ) ));
429  break;
430  case 2:
431  coerceValue(myType, clampMinValue(0, clampMaxValue(1, value ) ));
432  break;
433  case 3:
434  coerceValue(mySurfType, clampMinValue(0, clampMaxValue(6, value ) ));
435  break;
436  case 4:
437  coerceValue(myOrderU, clampMinValue(2, clampMaxValue(11, value ) ));
438  break;
439  case 5:
440  coerceValue(myOrderV, clampMinValue(2, clampMaxValue(11, value ) ));
441  break;
442  case 6:
443  coerceValue(myTol, clampMinValue(0, ( value ) ));
444  break;
445  case 7:
446  coerceValue(mySmooth, clampMinValue(0, clampMaxValue(1, value ) ));
447  break;
448  case 8:
449  coerceValue(myMultipleU, ( ( value ) ));
450  break;
451  case 9:
452  coerceValue(myMultipleV, ( ( value ) ));
453  break;
454  case 10:
455  coerceValue(myScope, clampMinValue(0, clampMaxValue(2, value ) ));
456  break;
457  case 11:
458  coerceValue(myDataParmU, clampMinValue(0, clampMaxValue(2, value ) ));
459  break;
460  case 12:
461  coerceValue(myDataParmV, clampMinValue(0, clampMaxValue(2, value ) ));
462  break;
463  case 13:
464  coerceValue(myCloseU, clampMinValue(0, clampMaxValue(2, value ) ));
465  break;
466  case 14:
467  coerceValue(myCloseV, clampMinValue(0, clampMaxValue(2, value ) ));
468  break;
469  case 15:
470  coerceValue(myCorners, ( ( value ) ));
471  break;
472 
473  }
474  }
475 
476  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
477  { doSetParmValue(idx, instance, value); }
478  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
479  { doSetParmValue(idx, instance, value); }
480  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
481  { doSetParmValue(idx, instance, value); }
482  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
483  { doSetParmValue(idx, instance, value); }
484  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
485  { doSetParmValue(idx, instance, value); }
486  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
487  { doSetParmValue(idx, instance, value); }
488  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
489  { doSetParmValue(idx, instance, value); }
490  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
491  { doSetParmValue(idx, instance, value); }
492  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
493  { doSetParmValue(idx, instance, value); }
494  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
495  { doSetParmValue(idx, instance, value); }
496  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
497  { doSetParmValue(idx, instance, value); }
498 
499  exint getNestNumParms(TempIndex idx) const override
500  {
501  if (idx.size() == 0)
502  return 16;
503  switch (idx[0])
504  {
505 
506  }
507  // Invalid
508  return 0;
509  }
510 
511  const char *getNestParmName(TempIndex fieldnum) const override
512  {
513  if (fieldnum.size() < 1)
514  return 0;
515  switch (fieldnum[0])
516  {
517  case 0:
518  return "group";
519  case 1:
520  return "method";
521  case 2:
522  return "type";
523  case 3:
524  return "surftype";
525  case 4:
526  return "orderu";
527  case 5:
528  return "orderv";
529  case 6:
530  return "tol";
531  case 7:
532  return "smooth";
533  case 8:
534  return "multipleu";
535  case 9:
536  return "multiplev";
537  case 10:
538  return "scope";
539  case 11:
540  return "dataparmu";
541  case 12:
542  return "dataparmv";
543  case 13:
544  return "closeu";
545  case 14:
546  return "closev";
547  case 15:
548  return "corners";
549 
550  }
551  return 0;
552  }
553 
554  ParmType getNestParmType(TempIndex fieldnum) const override
555  {
556  if (fieldnum.size() < 1)
557  return PARM_UNSUPPORTED;
558  switch (fieldnum[0])
559  {
560  case 0:
561  return PARM_STRING;
562  case 1:
563  return PARM_INTEGER;
564  case 2:
565  return PARM_INTEGER;
566  case 3:
567  return PARM_INTEGER;
568  case 4:
569  return PARM_INTEGER;
570  case 5:
571  return PARM_INTEGER;
572  case 6:
573  return PARM_FLOAT;
574  case 7:
575  return PARM_FLOAT;
576  case 8:
577  return PARM_INTEGER;
578  case 9:
579  return PARM_INTEGER;
580  case 10:
581  return PARM_INTEGER;
582  case 11:
583  return PARM_INTEGER;
584  case 12:
585  return PARM_INTEGER;
586  case 13:
587  return PARM_INTEGER;
588  case 14:
589  return PARM_INTEGER;
590  case 15:
591  return PARM_INTEGER;
592 
593  }
594  return PARM_UNSUPPORTED;
595  }
596 
597  // Boiler plate to load individual types.
598  static void loadData(UT_IStream &is, int64 &v)
599  { is.bread(&v, 1); }
600  static void loadData(UT_IStream &is, bool &v)
601  { int64 iv; is.bread(&iv, 1); v = iv; }
602  static void loadData(UT_IStream &is, fpreal64 &v)
603  { is.bread<fpreal64>(&v, 1); }
604  static void loadData(UT_IStream &is, UT_Vector2D &v)
605  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
606  static void loadData(UT_IStream &is, UT_Vector3D &v)
607  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
608  is.bread<fpreal64>(&v.z(), 1); }
609  static void loadData(UT_IStream &is, UT_Vector4D &v)
610  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
611  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
612  static void loadData(UT_IStream &is, UT_Matrix2D &v)
613  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
614  static void loadData(UT_IStream &is, UT_Matrix3D &v)
615  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
616  static void loadData(UT_IStream &is, UT_Matrix4D &v)
617  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
618  static void loadData(UT_IStream &is, UT_Vector2I &v)
619  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
620  static void loadData(UT_IStream &is, UT_Vector3I &v)
621  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
622  is.bread<int64>(&v.z(), 1); }
623  static void loadData(UT_IStream &is, UT_Vector4I &v)
624  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
625  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
627  { is.bread(v); }
629  { UT_StringHolder rampdata;
630  loadData(is, rampdata);
631  if (rampdata.isstring())
632  {
633  v.reset(new UT_Ramp());
634  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
635  v->load(istr);
636  }
637  else v.reset();
638  }
641  loadData(is, data);
642  if (data.isstring())
643  {
644  // Find the data type.
645  const char *colon = UT_StringWrap(data).findChar(':');
646  if (colon)
647  {
648  int typelen = colon - data.buffer();
650  type.strncpy(data.buffer(), typelen);
651  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
652 
653  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
654  }
655  }
656  else v.reset();
657  }
658 
659  static void saveData(std::ostream &os, int64 v)
660  { UTwrite(os, &v); }
661  static void saveData(std::ostream &os, bool v)
662  { int64 iv = v; UTwrite(os, &iv); }
663  static void saveData(std::ostream &os, fpreal64 v)
664  { UTwrite<fpreal64>(os, &v); }
665  static void saveData(std::ostream &os, UT_Vector2D v)
666  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
667  static void saveData(std::ostream &os, UT_Vector3D v)
668  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
669  UTwrite<fpreal64>(os, &v.z()); }
670  static void saveData(std::ostream &os, UT_Vector4D v)
671  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
672  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
673  static void saveData(std::ostream &os, UT_Matrix2D v)
675  static void saveData(std::ostream &os, UT_Matrix3D v)
677  static void saveData(std::ostream &os, UT_Matrix4D v)
679  static void saveData(std::ostream &os, UT_StringHolder s)
680  { UT_StringWrap(s).saveBinary(os); }
681  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
683  UT_OStringStream ostr;
684  if (s) s->save(ostr);
685  result = ostr.str();
686  saveData(os, result);
687  }
688  static void saveData(std::ostream &os, PRM_DataItemHandle s)
690  UT_OStringStream ostr;
691  if (s)
692  {
693  ostr << s->getDataTypeToken();
694  ostr << ":";
695  s->saveBinary(ostr);
696  }
697  result = ostr.str();
698  saveData(os, result);
699  }
700 
701 
702  void save(std::ostream &os) const
703  {
704  int32 v = version();
705  UTwrite(os, &v);
706  saveData(os, myGroup);
707  saveData(os, myMethod);
708  saveData(os, myType);
709  saveData(os, mySurfType);
710  saveData(os, myOrderU);
711  saveData(os, myOrderV);
712  saveData(os, myTol);
713  saveData(os, mySmooth);
714  saveData(os, myMultipleU);
715  saveData(os, myMultipleV);
716  saveData(os, myScope);
717  saveData(os, myDataParmU);
718  saveData(os, myDataParmV);
719  saveData(os, myCloseU);
720  saveData(os, myCloseV);
721  saveData(os, myCorners);
722 
723  }
724 
725  bool load(UT_IStream &is)
726  {
727  int32 v;
728  is.bread(&v, 1);
729  if (version() != v)
730  {
731  // Fail incompatible versions
732  return false;
733  }
734  loadData(is, myGroup);
735  loadData(is, myMethod);
736  loadData(is, myType);
737  loadData(is, mySurfType);
738  loadData(is, myOrderU);
739  loadData(is, myOrderV);
740  loadData(is, myTol);
741  loadData(is, mySmooth);
742  loadData(is, myMultipleU);
743  loadData(is, myMultipleV);
744  loadData(is, myScope);
745  loadData(is, myDataParmU);
746  loadData(is, myDataParmV);
747  loadData(is, myCloseU);
748  loadData(is, myCloseV);
749  loadData(is, myCorners);
750 
751  return true;
752  }
753 
754  const UT_StringHolder & getGroup() const { return myGroup; }
755  void setGroup(const UT_StringHolder & val) { myGroup = val; }
757  {
758  SOP_Node *thissop = cookparms.getNode();
759  if (!thissop) return getGroup();
761  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
762  return result;
763  }
764  Method getMethod() const { return Method(myMethod); }
765  void setMethod(Method val) { myMethod = int64(val); }
766  Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
767  {
768  SOP_Node *thissop = cookparms.getNode();
769  if (!thissop) return getMethod();
770  int64 result;
771  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
772  return Method(result);
773  }
774  Type getType() const { return Type(myType); }
775  void setType(Type val) { myType = int64(val); }
776  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
777  {
778  SOP_Node *thissop = cookparms.getNode();
779  if (!thissop) return getType();
780  int64 result;
781  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
782  return Type(result);
783  }
784  SurfType getSurfType() const { return SurfType(mySurfType); }
785  void setSurfType(SurfType val) { mySurfType = int64(val); }
787  {
788  SOP_Node *thissop = cookparms.getNode();
789  if (!thissop) return getSurfType();
790  int64 result;
791  OP_Utils::evalOpParm(result, thissop, "surftype", cookparms.getCookTime(), 0);
792  return SurfType(result);
793  }
794  int64 getOrderU() const { return myOrderU; }
795  void setOrderU(int64 val) { myOrderU = val; }
796  int64 opOrderU(const SOP_NodeVerb::CookParms &cookparms) const
797  {
798  SOP_Node *thissop = cookparms.getNode();
799  if (!thissop) return getOrderU();
800  int64 result;
801  OP_Utils::evalOpParm(result, thissop, "orderu", cookparms.getCookTime(), 0);
802  return result;
803  }
804  int64 getOrderV() const { return myOrderV; }
805  void setOrderV(int64 val) { myOrderV = val; }
806  int64 opOrderV(const SOP_NodeVerb::CookParms &cookparms) const
807  {
808  SOP_Node *thissop = cookparms.getNode();
809  if (!thissop) return getOrderV();
810  int64 result;
811  OP_Utils::evalOpParm(result, thissop, "orderv", cookparms.getCookTime(), 0);
812  return result;
813  }
814  fpreal64 getTol() const { return myTol; }
815  void setTol(fpreal64 val) { myTol = val; }
816  fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
817  {
818  SOP_Node *thissop = cookparms.getNode();
819  if (!thissop) return getTol();
821  OP_Utils::evalOpParm(result, thissop, "tol", cookparms.getCookTime(), 0);
822  return result;
823  }
824  fpreal64 getSmooth() const { return mySmooth; }
825  void setSmooth(fpreal64 val) { mySmooth = val; }
826  fpreal64 opSmooth(const SOP_NodeVerb::CookParms &cookparms) const
827  {
828  SOP_Node *thissop = cookparms.getNode();
829  if (!thissop) return getSmooth();
831  OP_Utils::evalOpParm(result, thissop, "smooth", cookparms.getCookTime(), 0);
832  return result;
833  }
834  bool getMultipleU() const { return myMultipleU; }
835  void setMultipleU(bool val) { myMultipleU = val; }
836  bool opMultipleU(const SOP_NodeVerb::CookParms &cookparms) const
837  {
838  SOP_Node *thissop = cookparms.getNode();
839  if (!thissop) return getMultipleU();
840  bool result;
841  OP_Utils::evalOpParm(result, thissop, "multipleu", cookparms.getCookTime(), 0);
842  return result;
843  }
844  bool getMultipleV() const { return myMultipleV; }
845  void setMultipleV(bool val) { myMultipleV = val; }
846  bool opMultipleV(const SOP_NodeVerb::CookParms &cookparms) const
847  {
848  SOP_Node *thissop = cookparms.getNode();
849  if (!thissop) return getMultipleV();
850  bool result;
851  OP_Utils::evalOpParm(result, thissop, "multiplev", cookparms.getCookTime(), 0);
852  return result;
853  }
854  Scope getScope() const { return Scope(myScope); }
855  void setScope(Scope val) { myScope = int64(val); }
856  Scope opScope(const SOP_NodeVerb::CookParms &cookparms) const
857  {
858  SOP_Node *thissop = cookparms.getNode();
859  if (!thissop) return getScope();
860  int64 result;
861  OP_Utils::evalOpParm(result, thissop, "scope", cookparms.getCookTime(), 0);
862  return Scope(result);
863  }
864  DataParmU getDataParmU() const { return DataParmU(myDataParmU); }
865  void setDataParmU(DataParmU val) { myDataParmU = int64(val); }
867  {
868  SOP_Node *thissop = cookparms.getNode();
869  if (!thissop) return getDataParmU();
870  int64 result;
871  OP_Utils::evalOpParm(result, thissop, "dataparmu", cookparms.getCookTime(), 0);
872  return DataParmU(result);
873  }
874  DataParmV getDataParmV() const { return DataParmV(myDataParmV); }
875  void setDataParmV(DataParmV val) { myDataParmV = int64(val); }
877  {
878  SOP_Node *thissop = cookparms.getNode();
879  if (!thissop) return getDataParmV();
880  int64 result;
881  OP_Utils::evalOpParm(result, thissop, "dataparmv", cookparms.getCookTime(), 0);
882  return DataParmV(result);
883  }
884  CloseU getCloseU() const { return CloseU(myCloseU); }
885  void setCloseU(CloseU val) { myCloseU = int64(val); }
886  CloseU opCloseU(const SOP_NodeVerb::CookParms &cookparms) const
887  {
888  SOP_Node *thissop = cookparms.getNode();
889  if (!thissop) return getCloseU();
890  int64 result;
891  OP_Utils::evalOpParm(result, thissop, "closeu", cookparms.getCookTime(), 0);
892  return CloseU(result);
893  }
894  CloseV getCloseV() const { return CloseV(myCloseV); }
895  void setCloseV(CloseV val) { myCloseV = int64(val); }
896  CloseV opCloseV(const SOP_NodeVerb::CookParms &cookparms) const
897  {
898  SOP_Node *thissop = cookparms.getNode();
899  if (!thissop) return getCloseV();
900  int64 result;
901  OP_Utils::evalOpParm(result, thissop, "closev", cookparms.getCookTime(), 0);
902  return CloseV(result);
903  }
904  bool getCorners() const { return myCorners; }
905  void setCorners(bool val) { myCorners = val; }
906  bool opCorners(const SOP_NodeVerb::CookParms &cookparms) const
907  {
908  SOP_Node *thissop = cookparms.getNode();
909  if (!thissop) return getCorners();
910  bool result;
911  OP_Utils::evalOpParm(result, thissop, "corners", cookparms.getCookTime(), 0);
912  return result;
913  }
914 
915 private:
916  UT_StringHolder myGroup;
917  int64 myMethod;
918  int64 myType;
919  int64 mySurfType;
920  int64 myOrderU;
921  int64 myOrderV;
922  fpreal64 myTol;
923  fpreal64 mySmooth;
924  bool myMultipleU;
925  bool myMultipleV;
926  int64 myScope;
927  int64 myDataParmU;
928  int64 myDataParmV;
929  int64 myCloseU;
930  int64 myCloseV;
931  bool myCorners;
932 
933 };
static void saveData(std::ostream &os, UT_Matrix3D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, int64 &v)
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
CloseU opCloseU(const SOP_NodeVerb::CookParms &cookparms) const
Method getMethod() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
int int32
Definition: SYS_Types.h:39
bool operator!=(const SOP_FitParms &src) const
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
bool opMultipleU(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix2D v)
void setDataParmV(DataParmV val)
void setOrderU(int64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
fpreal64 opTol(const SOP_NodeVerb::CookParms &cookparms) const
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
CloseV getCloseV() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static void saveData(std::ostream &os, UT_StringHolder s)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
bool getMultipleU() const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
void setScope(Scope val)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, int64 v)
void setMethod(Method val)
**But if you need a result
Definition: thread.h:613
bool getMultipleV() const
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setCorners(bool val)
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void setTol(fpreal64 val)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void loadData(UT_IStream &is, UT_Vector3D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
static void saveData(std::ostream &os, bool v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void save(std::ostream &os) const
static void saveData(std::ostream &os, UT_Vector2D v)
double fpreal64
Definition: SYS_Types.h:201
static void loadData(UT_IStream &is, UT_Matrix2D &v)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
DataParmU getDataParmU() const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, bool &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
exint length() const
void setSmooth(fpreal64 val)
void setMultipleV(bool val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
bool opMultipleV(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
exint getNestNumParms(TempIndex idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void copyFrom(const OP_NodeParms *src) override
DataParmV getDataParmV() const
void setCloseV(CloseV val)
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
CloseU getCloseU() const
fpreal64 opSmooth(const SOP_NodeVerb::CookParms &cookparms) const
void setCloseU(CloseU val)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
long long int64
Definition: SYS_Types.h:116
void setDataParmU(DataParmU val)
int64 getOrderU() const
int64 opOrderU(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setType(Type val)
void setOrderV(int64 val)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void loadFromOpSubclass(const LoadParms &loadparms) override
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
bool getCorners() const
void setSurfType(SurfType val)
void setMultipleU(bool val)
Scope opScope(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
Type getType() const
SYS_FORCE_INLINE UT_StringHolder getToken(Method enum_value)
Definition: SOP_Fit.proto.h:32
SurfType opSurfType(const SOP_NodeVerb::CookParms &cookparms) const
CloseV opCloseV(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
SurfType getSurfType() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
static int version()
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
bool opCorners(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
int64 getOrderV() const
static void saveData(std::ostream &os, fpreal64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
DataParmV opDataParmV(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
Definition: core.h:1131
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
fpreal64 getTol() const
DataParmU opDataParmU(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
bool load(UT_IStream &is)
bool operator==(const SOP_FitParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
type
Definition: core.h:1059
const char * getNestParmName(TempIndex fieldnum) const override
int64 opOrderV(const SOP_NodeVerb::CookParms &cookparms) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
ParmType getNestParmType(TempIndex fieldnum) const override
void setGroup(const UT_StringHolder &val)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
Scope getScope() const
const UT_StringHolder & getGroup() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
bool isParmColorRamp(exint idx) const override
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
static void loadData(UT_IStream &is, fpreal64 &v)
fpreal64 getSmooth() const