HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Convert.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_ConvertEnums
24 {
25  enum class Fromtype
26  {
27  ALL = 0,
28  SPHERE,
29  TUBE,
30  PART,
31  METABALL,
32  POLY,
33  MESH,
34  BEZCURVE,
35  BEZSURF,
36  NURBCURVE,
37  NURBSURF,
38  PASTESURF,
39  CIRCLE,
40  TRISTRIP,
41  TRIFAN,
42  TRIBEZ,
43  VOLUME,
44  POLYSOUP,
45  VDB
46  };
47 
49  getToken(Fromtype enum_value)
50  {
51  using namespace UT::Literal;
52  switch (enum_value) {
53  case Fromtype::ALL: return "all"_sh;
54  case Fromtype::SPHERE: return "sphere"_sh;
55  case Fromtype::TUBE: return "tube"_sh;
56  case Fromtype::PART: return "part"_sh;
57  case Fromtype::METABALL: return "metaball"_sh;
58  case Fromtype::POLY: return "poly"_sh;
59  case Fromtype::MESH: return "mesh"_sh;
60  case Fromtype::BEZCURVE: return "bezCurve"_sh;
61  case Fromtype::BEZSURF: return "bezSurf"_sh;
62  case Fromtype::NURBCURVE: return "nurbCurve"_sh;
63  case Fromtype::NURBSURF: return "nurbSurf"_sh;
64  case Fromtype::PASTESURF: return "pasteSurf"_sh;
65  case Fromtype::CIRCLE: return "circle"_sh;
66  case Fromtype::TRISTRIP: return "tristrip"_sh;
67  case Fromtype::TRIFAN: return "trifan"_sh;
68  case Fromtype::TRIBEZ: return "tribez"_sh;
69  case Fromtype::VOLUME: return "volume"_sh;
70  case Fromtype::POLYSOUP: return "polySoup"_sh;
71  case Fromtype::VDB: return "vdb"_sh;
72  default: UT_ASSERT(false); return ""_sh;
73  }
74  }
75 
76  enum class Totype
77  {
78  POLY = 0,
79  MESH,
80  BEZCURVE,
81  BEZSURF,
82  NURBCURVE,
83  NURBSURF,
84  PASTESURF,
85  CIRCLE,
88  TRIBEZ,
89  POLYSOUP,
90  VOLUME,
91  VDB
92  };
93 
95  getToken(Totype enum_value)
96  {
97  using namespace UT::Literal;
98  switch (enum_value) {
99  case Totype::POLY: return "poly"_sh;
100  case Totype::MESH: return "mesh"_sh;
101  case Totype::BEZCURVE: return "bezCurve"_sh;
102  case Totype::BEZSURF: return "bezSurf"_sh;
103  case Totype::NURBCURVE: return "nurbCurve"_sh;
104  case Totype::NURBSURF: return "nurbSurf"_sh;
105  case Totype::PASTESURF: return "pasteSurf"_sh;
106  case Totype::CIRCLE: return "circle"_sh;
107  case Totype::TRIMBEZSURF: return "trimBezSurf"_sh;
108  case Totype::TRIMNURBSURF: return "trimNurbSurf"_sh;
109  case Totype::TRIBEZ: return "tribez"_sh;
110  case Totype::POLYSOUP: return "polySoup"_sh;
111  case Totype::VOLUME: return "volume"_sh;
112  case Totype::VDB: return "vdb"_sh;
113  default: UT_ASSERT(false); return ""_sh;
114  }
115  }
116 
117  enum class Surftype
118  {
119  ROWS = 0,
120  COLS,
121  ROWCOL,
122  TRIANGLES,
123  QUADS,
124  ALTTRIANGLES,
126  };
127 
129  getToken(Surftype enum_value)
130  {
131  using namespace UT::Literal;
132  switch (enum_value) {
133  case Surftype::ROWS: return "rows"_sh;
134  case Surftype::COLS: return "cols"_sh;
135  case Surftype::ROWCOL: return "rowcol"_sh;
136  case Surftype::TRIANGLES: return "triangles"_sh;
137  case Surftype::QUADS: return "quads"_sh;
138  case Surftype::ALTTRIANGLES: return "alttriangles"_sh;
139  case Surftype::REVTRIANGLES: return "revtriangles"_sh;
140  default: UT_ASSERT(false); return ""_sh;
141  }
142  }
143 
144  enum class Pastecoord
145  {
146  CFEATURE = 0,
147  CBASE
148  };
149 
151  getToken(Pastecoord enum_value)
152  {
153  using namespace UT::Literal;
154  switch (enum_value) {
155  case Pastecoord::CFEATURE: return "cfeature"_sh;
156  case Pastecoord::CBASE: return "cbase"_sh;
157  default: UT_ASSERT(false); return ""_sh;
158  }
159  }
160 
161  enum class Pasteattrib
162  {
163  AFEATURE = 0,
164  ABASE
165  };
166 
168  getToken(Pasteattrib enum_value)
169  {
170  using namespace UT::Literal;
171  switch (enum_value) {
172  case Pasteattrib::AFEATURE: return "afeature"_sh;
173  case Pasteattrib::ABASE: return "abase"_sh;
174  default: UT_ASSERT(false); return ""_sh;
175  }
176  }
177 
178 }
179 
180 
182 {
183 public:
184  static int version() { return 1; }
185 
187  {
188  myGroup = ""_UTsh;
189  myFromtype = 0;
190  myTotype = 0;
191  mySurftype = 4;
192  myStdswitcher = 0;
193  myOrderu = 4;
194  myOrderv = 4;
195  myPastecoord = 0;
196  myPasteattrib = 0;
197  myNew = false;
198  myInterphull = false;
199  myOffset = 0;
200  myLodu = 0.5;
201  myLodv = 0.5;
202  myLodtrim = 1;
203  myDivu = 2;
204  myDivv = 2;
205  myDivtrim = 1;
206 
207  }
208 
209  explicit SOP_ConvertParms(const SOP_ConvertParms &) = default;
210  SOP_ConvertParms &operator=(const SOP_ConvertParms &) = default;
211  SOP_ConvertParms(SOP_ConvertParms &&) noexcept = default;
212  SOP_ConvertParms &operator=(SOP_ConvertParms &&) noexcept = default;
213 
214  ~SOP_ConvertParms() override {}
215 
216  bool operator==(const SOP_ConvertParms &src) const
217  {
218  if (myGroup != src.myGroup) return false;
219  if (myFromtype != src.myFromtype) return false;
220  if (myTotype != src.myTotype) return false;
221  if (mySurftype != src.mySurftype) return false;
222  if (myStdswitcher != src.myStdswitcher) return false;
223  if (myOrderu != src.myOrderu) return false;
224  if (myOrderv != src.myOrderv) return false;
225  if (myPastecoord != src.myPastecoord) return false;
226  if (myPasteattrib != src.myPasteattrib) return false;
227  if (myNew != src.myNew) return false;
228  if (myInterphull != src.myInterphull) return false;
229  if (myOffset != src.myOffset) return false;
230  if (myLodu != src.myLodu) return false;
231  if (myLodv != src.myLodv) return false;
232  if (myLodtrim != src.myLodtrim) return false;
233  if (myDivu != src.myDivu) return false;
234  if (myDivv != src.myDivv) return false;
235  if (myDivtrim != src.myDivtrim) return false;
236 
237  return true;
238  }
239  bool operator!=(const SOP_ConvertParms &src) const
240  {
241  return !operator==(src);
242  }
248 
249 
250 
251  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
252  {
253  myGroup = ""_UTsh;
254  if (true)
255  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
256  myFromtype = 0;
257  if (true)
258  graph->evalOpParm(myFromtype, nodeidx, "fromtype", time, 0);
259  myTotype = 0;
260  if (true)
261  graph->evalOpParm(myTotype, nodeidx, "totype", time, 0);
262  mySurftype = 4;
263  if (true && ( (true&&!(((int64(getTotype())!=3)&&(int64(getTotype())!=5)&&(int64(getTotype())!=1)&&(int64(getTotype())!=0)&&(int64(getTotype())!=11)))) ) )
264  graph->evalOpParm(mySurftype, nodeidx, "surftype", time, 0);
265  myStdswitcher = 0;
266  if (true)
267  graph->evalOpParm(myStdswitcher, nodeidx, "stdswitcher", time, 0);
268  myOrderu = 4;
269  if (true && ( (true&&!(((int64(getTotype())!=2)&&(int64(getTotype())!=4)&&(int64(getTotype())!=3)&&(int64(getTotype())!=5)))) ) )
270  graph->evalOpParm(myOrderu, nodeidx, "orderu", time, 0);
271  myOrderv = 4;
272  if (true && ( (true&&!(((int64(getTotype())!=3)&&(int64(getTotype())!=5)))) ) )
273  graph->evalOpParm(myOrderv, nodeidx, "orderv", time, 0);
274  myPastecoord = 0;
275  if (true)
276  graph->evalOpParm(myPastecoord, nodeidx, "pastecoord", time, 0);
277  myPasteattrib = 0;
278  if (true)
279  graph->evalOpParm(myPasteattrib, nodeidx, "pasteattrib", time, 0);
280  myNew = false;
281  if (true)
282  graph->evalOpParm(myNew, nodeidx, "new", time, 0);
283  myInterphull = false;
284  if (true)
285  graph->evalOpParm(myInterphull, nodeidx, "interphull", time, 0);
286  myOffset = 0;
287  if (true)
288  graph->evalOpParm(myOffset, nodeidx, "offset", time, 0);
289  myLodu = 0.5;
290  if (true && ( (true&&!(((getInterphull()==1)))) ) )
291  graph->evalOpParm(myLodu, nodeidx, "lodu", time, 0);
292  myLodv = 0.5;
293  if (true && ( (true&&!(((getInterphull()==1)))) ) )
294  graph->evalOpParm(myLodv, nodeidx, "lodv", time, 0);
295  myLodtrim = 1;
296  if (true && ( (true&&!(((getInterphull()==1)))) ) )
297  graph->evalOpParm(myLodtrim, nodeidx, "lodtrim", time, 0);
298  myDivu = 2;
299  if (true && ( (true&&!(((getInterphull()==1)))) ) )
300  graph->evalOpParm(myDivu, nodeidx, "divu", time, 0);
301  myDivv = 2;
302  if (true && ( (true&&!(((getInterphull()==1)))) ) )
303  graph->evalOpParm(myDivv, nodeidx, "divv", time, 0);
304  myDivtrim = 1;
305  if (true && ( (true&&!(((getInterphull()==1)))) ) )
306  graph->evalOpParm(myDivtrim, nodeidx, "divtrim", time, 0);
307 
308  }
309 
310 
311  void loadFromOpSubclass(const LoadParms &loadparms) override
312  {
313  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
314  }
315 
316 
317  void copyFrom(const OP_NodeParms *src) override
318  {
319  *this = *((const SOP_ConvertParms *)src);
320  }
321 
322  template <typename T>
323  void
324  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
325  {
326  if (idx.size() < 1)
327  return;
328  UT_ASSERT(idx.size() == instance.size()+1);
329  if (idx.size() != instance.size()+1)
330  return;
331  switch (idx[0])
332  {
333  case 0:
334  coerceValue(value, myGroup);
335  break;
336  case 1:
337  coerceValue(value, myFromtype);
338  break;
339  case 2:
340  coerceValue(value, myTotype);
341  break;
342  case 3:
343  coerceValue(value, mySurftype);
344  break;
345  case 4:
346  coerceValue(value, myStdswitcher);
347  break;
348  case 5:
349  coerceValue(value, myOrderu);
350  break;
351  case 6:
352  coerceValue(value, myOrderv);
353  break;
354  case 7:
355  coerceValue(value, myPastecoord);
356  break;
357  case 8:
358  coerceValue(value, myPasteattrib);
359  break;
360  case 9:
361  coerceValue(value, myNew);
362  break;
363  case 10:
364  coerceValue(value, myInterphull);
365  break;
366  case 11:
367  coerceValue(value, myOffset);
368  break;
369  case 12:
370  coerceValue(value, myLodu);
371  break;
372  case 13:
373  coerceValue(value, myLodv);
374  break;
375  case 14:
376  coerceValue(value, myLodtrim);
377  break;
378  case 15:
379  coerceValue(value, myDivu);
380  break;
381  case 16:
382  coerceValue(value, myDivv);
383  break;
384  case 17:
385  coerceValue(value, myDivtrim);
386  break;
387 
388  }
389  }
390 
391  bool isParmColorRamp(exint idx) const override
392  {
393  switch (idx)
394  {
395 
396  }
397  return false;
398  }
399 
400  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
401  { doGetParmValue(idx, instance, value); }
402  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
403  { doGetParmValue(idx, instance, value); }
404  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
405  { doGetParmValue(idx, instance, value); }
406  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
407  { doGetParmValue(idx, instance, value); }
408  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
409  { doGetParmValue(idx, instance, value); }
410  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
411  { doGetParmValue(idx, instance, value); }
412  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
413  { doGetParmValue(idx, instance, value); }
414  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
415  { doGetParmValue(idx, instance, value); }
416  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
417  { doGetParmValue(idx, instance, value); }
418  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
419  { doGetParmValue(idx, instance, value); }
420  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
421  { doGetParmValue(idx, instance, value); }
422 
423  template <typename T>
424  void
425  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
426  {
427  if (idx.size() < 1)
428  return;
429  UT_ASSERT(idx.size() == instance.size()+1);
430  if (idx.size() != instance.size()+1)
431  return;
432  switch (idx[0])
433  {
434  case 0:
435  coerceValue(myGroup, ( ( value ) ));
436  break;
437  case 1:
438  coerceValue(myFromtype, clampMinValue(0, clampMaxValue(18, value ) ));
439  break;
440  case 2:
441  coerceValue(myTotype, clampMinValue(0, clampMaxValue(13, value ) ));
442  break;
443  case 3:
444  coerceValue(mySurftype, clampMinValue(0, clampMaxValue(6, value ) ));
445  break;
446  case 4:
447  coerceValue(myStdswitcher, ( ( value ) ));
448  break;
449  case 5:
450  coerceValue(myOrderu, clampMinValue(2, clampMaxValue(11, value ) ));
451  break;
452  case 6:
453  coerceValue(myOrderv, clampMinValue(2, clampMaxValue(11, value ) ));
454  break;
455  case 7:
456  coerceValue(myPastecoord, clampMinValue(0, clampMaxValue(1, value ) ));
457  break;
458  case 8:
459  coerceValue(myPasteattrib, clampMinValue(0, clampMaxValue(1, value ) ));
460  break;
461  case 9:
462  coerceValue(myNew, ( ( value ) ));
463  break;
464  case 10:
465  coerceValue(myInterphull, ( ( value ) ));
466  break;
467  case 11:
468  coerceValue(myOffset, ( ( value ) ));
469  break;
470  case 12:
471  coerceValue(myLodu, clampMinValue(0.001, ( value ) ));
472  break;
473  case 13:
474  coerceValue(myLodv, clampMinValue(0.001, ( value ) ));
475  break;
476  case 14:
477  coerceValue(myLodtrim, clampMinValue(0.001, ( value ) ));
478  break;
479  case 15:
480  coerceValue(myDivu, clampMinValue(0, ( value ) ));
481  break;
482  case 16:
483  coerceValue(myDivv, clampMinValue(0, ( value ) ));
484  break;
485  case 17:
486  coerceValue(myDivtrim, clampMinValue(1, ( value ) ));
487  break;
488 
489  }
490  }
491 
492  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
493  { doSetParmValue(idx, instance, value); }
494  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
495  { doSetParmValue(idx, instance, value); }
496  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
497  { doSetParmValue(idx, instance, value); }
498  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
499  { doSetParmValue(idx, instance, value); }
500  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
501  { doSetParmValue(idx, instance, value); }
502  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
503  { doSetParmValue(idx, instance, value); }
504  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
505  { doSetParmValue(idx, instance, value); }
506  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
507  { doSetParmValue(idx, instance, value); }
508  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
509  { doSetParmValue(idx, instance, value); }
510  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
511  { doSetParmValue(idx, instance, value); }
512  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
513  { doSetParmValue(idx, instance, value); }
514 
515  exint getNestNumParms(TempIndex idx) const override
516  {
517  if (idx.size() == 0)
518  return 18;
519  switch (idx[0])
520  {
521 
522  }
523  // Invalid
524  return 0;
525  }
526 
527  const char *getNestParmName(TempIndex fieldnum) const override
528  {
529  if (fieldnum.size() < 1)
530  return 0;
531  switch (fieldnum[0])
532  {
533  case 0:
534  return "group";
535  case 1:
536  return "fromtype";
537  case 2:
538  return "totype";
539  case 3:
540  return "surftype";
541  case 4:
542  return "stdswitcher";
543  case 5:
544  return "orderu";
545  case 6:
546  return "orderv";
547  case 7:
548  return "pastecoord";
549  case 8:
550  return "pasteattrib";
551  case 9:
552  return "new";
553  case 10:
554  return "interphull";
555  case 11:
556  return "offset";
557  case 12:
558  return "lodu";
559  case 13:
560  return "lodv";
561  case 14:
562  return "lodtrim";
563  case 15:
564  return "divu";
565  case 16:
566  return "divv";
567  case 17:
568  return "divtrim";
569 
570  }
571  return 0;
572  }
573 
574  ParmType getNestParmType(TempIndex fieldnum) const override
575  {
576  if (fieldnum.size() < 1)
577  return PARM_UNSUPPORTED;
578  switch (fieldnum[0])
579  {
580  case 0:
581  return PARM_STRING;
582  case 1:
583  return PARM_INTEGER;
584  case 2:
585  return PARM_INTEGER;
586  case 3:
587  return PARM_INTEGER;
588  case 4:
589  return PARM_INTEGER;
590  case 5:
591  return PARM_INTEGER;
592  case 6:
593  return PARM_INTEGER;
594  case 7:
595  return PARM_INTEGER;
596  case 8:
597  return PARM_INTEGER;
598  case 9:
599  return PARM_INTEGER;
600  case 10:
601  return PARM_INTEGER;
602  case 11:
603  return PARM_FLOAT;
604  case 12:
605  return PARM_FLOAT;
606  case 13:
607  return PARM_FLOAT;
608  case 14:
609  return PARM_FLOAT;
610  case 15:
611  return PARM_INTEGER;
612  case 16:
613  return PARM_INTEGER;
614  case 17:
615  return PARM_INTEGER;
616 
617  }
618  return PARM_UNSUPPORTED;
619  }
620 
621  // Boiler plate to load individual types.
622  static void loadData(UT_IStream &is, int64 &v)
623  { is.bread(&v, 1); }
624  static void loadData(UT_IStream &is, bool &v)
625  { int64 iv; is.bread(&iv, 1); v = iv; }
626  static void loadData(UT_IStream &is, fpreal64 &v)
627  { is.bread<fpreal64>(&v, 1); }
628  static void loadData(UT_IStream &is, UT_Vector2D &v)
629  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
630  static void loadData(UT_IStream &is, UT_Vector3D &v)
631  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
632  is.bread<fpreal64>(&v.z(), 1); }
633  static void loadData(UT_IStream &is, UT_Vector4D &v)
634  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
635  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
636  static void loadData(UT_IStream &is, UT_Matrix2D &v)
637  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
638  static void loadData(UT_IStream &is, UT_Matrix3D &v)
639  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
640  static void loadData(UT_IStream &is, UT_Matrix4D &v)
641  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
642  static void loadData(UT_IStream &is, UT_Vector2I &v)
643  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
644  static void loadData(UT_IStream &is, UT_Vector3I &v)
645  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
646  is.bread<int64>(&v.z(), 1); }
647  static void loadData(UT_IStream &is, UT_Vector4I &v)
648  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
649  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
651  { is.bread(v); }
653  { UT_StringHolder rampdata;
654  loadData(is, rampdata);
655  if (rampdata.isstring())
656  {
657  v.reset(new UT_Ramp());
658  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
659  v->load(istr);
660  }
661  else v.reset();
662  }
665  loadData(is, data);
666  if (data.isstring())
667  {
668  // Find the data type.
669  const char *colon = UT_StringWrap(data).findChar(':');
670  if (colon)
671  {
672  int typelen = colon - data.buffer();
674  type.strncpy(data.buffer(), typelen);
675  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
676 
677  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
678  }
679  }
680  else v.reset();
681  }
682 
683  static void saveData(std::ostream &os, int64 v)
684  { UTwrite(os, &v); }
685  static void saveData(std::ostream &os, bool v)
686  { int64 iv = v; UTwrite(os, &iv); }
687  static void saveData(std::ostream &os, fpreal64 v)
688  { UTwrite<fpreal64>(os, &v); }
689  static void saveData(std::ostream &os, UT_Vector2D v)
690  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
691  static void saveData(std::ostream &os, UT_Vector3D v)
692  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
693  UTwrite<fpreal64>(os, &v.z()); }
694  static void saveData(std::ostream &os, UT_Vector4D v)
695  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
696  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
697  static void saveData(std::ostream &os, UT_Matrix2D v)
699  static void saveData(std::ostream &os, UT_Matrix3D v)
701  static void saveData(std::ostream &os, UT_Matrix4D v)
703  static void saveData(std::ostream &os, UT_StringHolder s)
704  { UT_StringWrap(s).saveBinary(os); }
705  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
707  UT_OStringStream ostr;
708  if (s) s->save(ostr);
709  result = ostr.str();
710  saveData(os, result);
711  }
712  static void saveData(std::ostream &os, PRM_DataItemHandle s)
714  UT_OStringStream ostr;
715  if (s)
716  {
717  ostr << s->getDataTypeToken();
718  ostr << ":";
719  s->saveBinary(ostr);
720  }
721  result = ostr.str();
722  saveData(os, result);
723  }
724 
725 
726  void save(std::ostream &os) const
727  {
728  int32 v = version();
729  UTwrite(os, &v);
730  saveData(os, myGroup);
731  saveData(os, myFromtype);
732  saveData(os, myTotype);
733  saveData(os, mySurftype);
734  saveData(os, myStdswitcher);
735  saveData(os, myOrderu);
736  saveData(os, myOrderv);
737  saveData(os, myPastecoord);
738  saveData(os, myPasteattrib);
739  saveData(os, myNew);
740  saveData(os, myInterphull);
741  saveData(os, myOffset);
742  saveData(os, myLodu);
743  saveData(os, myLodv);
744  saveData(os, myLodtrim);
745  saveData(os, myDivu);
746  saveData(os, myDivv);
747  saveData(os, myDivtrim);
748 
749  }
750 
751  bool load(UT_IStream &is)
752  {
753  int32 v;
754  is.bread(&v, 1);
755  if (version() != v)
756  {
757  // Fail incompatible versions
758  return false;
759  }
760  loadData(is, myGroup);
761  loadData(is, myFromtype);
762  loadData(is, myTotype);
763  loadData(is, mySurftype);
764  loadData(is, myStdswitcher);
765  loadData(is, myOrderu);
766  loadData(is, myOrderv);
767  loadData(is, myPastecoord);
768  loadData(is, myPasteattrib);
769  loadData(is, myNew);
770  loadData(is, myInterphull);
771  loadData(is, myOffset);
772  loadData(is, myLodu);
773  loadData(is, myLodv);
774  loadData(is, myLodtrim);
775  loadData(is, myDivu);
776  loadData(is, myDivv);
777  loadData(is, myDivtrim);
778 
779  return true;
780  }
781 
782  const UT_StringHolder & getGroup() const { return myGroup; }
783  void setGroup(const UT_StringHolder & val) { myGroup = val; }
785  {
786  SOP_Node *thissop = cookparms.getNode();
787  if (!thissop) return getGroup();
789  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
790  return result;
791  }
792  Fromtype getFromtype() const { return Fromtype(myFromtype); }
793  void setFromtype(Fromtype val) { myFromtype = int64(val); }
795  {
796  SOP_Node *thissop = cookparms.getNode();
797  if (!thissop) return getFromtype();
798  int64 result;
799  OP_Utils::evalOpParm(result, thissop, "fromtype", cookparms.getCookTime(), 0);
800  return Fromtype(result);
801  }
802  Totype getTotype() const { return Totype(myTotype); }
803  void setTotype(Totype val) { myTotype = int64(val); }
804  Totype opTotype(const SOP_NodeVerb::CookParms &cookparms) const
805  {
806  SOP_Node *thissop = cookparms.getNode();
807  if (!thissop) return getTotype();
808  int64 result;
809  OP_Utils::evalOpParm(result, thissop, "totype", cookparms.getCookTime(), 0);
810  return Totype(result);
811  }
812  Surftype getSurftype() const { return Surftype(mySurftype); }
813  void setSurftype(Surftype val) { mySurftype = int64(val); }
815  {
816  SOP_Node *thissop = cookparms.getNode();
817  if (!thissop) return getSurftype();
818  int64 result;
819  OP_Utils::evalOpParm(result, thissop, "surftype", cookparms.getCookTime(), 0);
820  return Surftype(result);
821  }
822  int64 getStdswitcher() const { return myStdswitcher; }
823  void setStdswitcher(int64 val) { myStdswitcher = val; }
825  {
826  SOP_Node *thissop = cookparms.getNode();
827  if (!thissop) return getStdswitcher();
828  int64 result;
829  OP_Utils::evalOpParm(result, thissop, "stdswitcher", cookparms.getCookTime(), 0);
830  return result;
831  }
832  int64 getOrderu() const { return myOrderu; }
833  void setOrderu(int64 val) { myOrderu = val; }
834  int64 opOrderu(const SOP_NodeVerb::CookParms &cookparms) const
835  {
836  SOP_Node *thissop = cookparms.getNode();
837  if (!thissop) return getOrderu();
838  int64 result;
839  OP_Utils::evalOpParm(result, thissop, "orderu", cookparms.getCookTime(), 0);
840  return result;
841  }
842  int64 getOrderv() const { return myOrderv; }
843  void setOrderv(int64 val) { myOrderv = val; }
844  int64 opOrderv(const SOP_NodeVerb::CookParms &cookparms) const
845  {
846  SOP_Node *thissop = cookparms.getNode();
847  if (!thissop) return getOrderv();
848  int64 result;
849  OP_Utils::evalOpParm(result, thissop, "orderv", cookparms.getCookTime(), 0);
850  return result;
851  }
852  Pastecoord getPastecoord() const { return Pastecoord(myPastecoord); }
853  void setPastecoord(Pastecoord val) { myPastecoord = int64(val); }
855  {
856  SOP_Node *thissop = cookparms.getNode();
857  if (!thissop) return getPastecoord();
858  int64 result;
859  OP_Utils::evalOpParm(result, thissop, "pastecoord", cookparms.getCookTime(), 0);
860  return Pastecoord(result);
861  }
862  Pasteattrib getPasteattrib() const { return Pasteattrib(myPasteattrib); }
863  void setPasteattrib(Pasteattrib val) { myPasteattrib = int64(val); }
865  {
866  SOP_Node *thissop = cookparms.getNode();
867  if (!thissop) return getPasteattrib();
868  int64 result;
869  OP_Utils::evalOpParm(result, thissop, "pasteattrib", cookparms.getCookTime(), 0);
870  return Pasteattrib(result);
871  }
872  bool getNew() const { return myNew; }
873  void setNew(bool val) { myNew = val; }
874  bool opNew(const SOP_NodeVerb::CookParms &cookparms) const
875  {
876  SOP_Node *thissop = cookparms.getNode();
877  if (!thissop) return getNew();
878  bool result;
879  OP_Utils::evalOpParm(result, thissop, "new", cookparms.getCookTime(), 0);
880  return result;
881  }
882  bool getInterphull() const { return myInterphull; }
883  void setInterphull(bool val) { myInterphull = val; }
884  bool opInterphull(const SOP_NodeVerb::CookParms &cookparms) const
885  {
886  SOP_Node *thissop = cookparms.getNode();
887  if (!thissop) return getInterphull();
888  bool result;
889  OP_Utils::evalOpParm(result, thissop, "interphull", cookparms.getCookTime(), 0);
890  return result;
891  }
892  fpreal64 getOffset() const { return myOffset; }
893  void setOffset(fpreal64 val) { myOffset = val; }
894  fpreal64 opOffset(const SOP_NodeVerb::CookParms &cookparms) const
895  {
896  SOP_Node *thissop = cookparms.getNode();
897  if (!thissop) return getOffset();
899  OP_Utils::evalOpParm(result, thissop, "offset", cookparms.getCookTime(), 0);
900  return result;
901  }
902  fpreal64 getLodu() const { return myLodu; }
903  void setLodu(fpreal64 val) { myLodu = val; }
904  fpreal64 opLodu(const SOP_NodeVerb::CookParms &cookparms) const
905  {
906  SOP_Node *thissop = cookparms.getNode();
907  if (!thissop) return getLodu();
909  OP_Utils::evalOpParm(result, thissop, "lodu", cookparms.getCookTime(), 0);
910  return result;
911  }
912  fpreal64 getLodv() const { return myLodv; }
913  void setLodv(fpreal64 val) { myLodv = val; }
914  fpreal64 opLodv(const SOP_NodeVerb::CookParms &cookparms) const
915  {
916  SOP_Node *thissop = cookparms.getNode();
917  if (!thissop) return getLodv();
919  OP_Utils::evalOpParm(result, thissop, "lodv", cookparms.getCookTime(), 0);
920  return result;
921  }
922  fpreal64 getLodtrim() const { return myLodtrim; }
923  void setLodtrim(fpreal64 val) { myLodtrim = val; }
925  {
926  SOP_Node *thissop = cookparms.getNode();
927  if (!thissop) return getLodtrim();
929  OP_Utils::evalOpParm(result, thissop, "lodtrim", cookparms.getCookTime(), 0);
930  return result;
931  }
932  int64 getDivu() const { return myDivu; }
933  void setDivu(int64 val) { myDivu = val; }
934  int64 opDivu(const SOP_NodeVerb::CookParms &cookparms) const
935  {
936  SOP_Node *thissop = cookparms.getNode();
937  if (!thissop) return getDivu();
938  int64 result;
939  OP_Utils::evalOpParm(result, thissop, "divu", cookparms.getCookTime(), 0);
940  return result;
941  }
942  int64 getDivv() const { return myDivv; }
943  void setDivv(int64 val) { myDivv = val; }
944  int64 opDivv(const SOP_NodeVerb::CookParms &cookparms) const
945  {
946  SOP_Node *thissop = cookparms.getNode();
947  if (!thissop) return getDivv();
948  int64 result;
949  OP_Utils::evalOpParm(result, thissop, "divv", cookparms.getCookTime(), 0);
950  return result;
951  }
952  int64 getDivtrim() const { return myDivtrim; }
953  void setDivtrim(int64 val) { myDivtrim = val; }
954  int64 opDivtrim(const SOP_NodeVerb::CookParms &cookparms) const
955  {
956  SOP_Node *thissop = cookparms.getNode();
957  if (!thissop) return getDivtrim();
958  int64 result;
959  OP_Utils::evalOpParm(result, thissop, "divtrim", cookparms.getCookTime(), 0);
960  return result;
961  }
962 
963 private:
964  UT_StringHolder myGroup;
965  int64 myFromtype;
966  int64 myTotype;
967  int64 mySurftype;
968  int64 myStdswitcher;
969  int64 myOrderu;
970  int64 myOrderv;
971  int64 myPastecoord;
972  int64 myPasteattrib;
973  bool myNew;
974  bool myInterphull;
975  fpreal64 myOffset;
976  fpreal64 myLodu;
977  fpreal64 myLodv;
978  fpreal64 myLodtrim;
979  int64 myDivu;
980  int64 myDivv;
981  int64 myDivtrim;
982 
983 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, UT_StringHolder s)
fpreal64 opLodu(const SOP_NodeVerb::CookParms &cookparms) const
Totype getTotype() const
int64 opOrderu(const SOP_NodeVerb::CookParms &cookparms) const
int64 opOrderv(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, int64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, bool &v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
bool operator==(const SOP_ConvertParms &src) const
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
Fromtype opFromtype(const SOP_NodeVerb::CookParms &cookparms) const
fpreal getTime() const
Definition: OP_Context.h:62
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
Totype opTotype(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
void setSurftype(Surftype val)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
SYS_FORCE_INLINE const char * buffer() const
bool isParmColorRamp(exint idx) const override
GLdouble s
Definition: glad.h:3009
Pasteattrib getPasteattrib() const
void save(std::ostream &os) const
static void saveData(std::ostream &os, UT_Vector2D v)
int64 getDivu() const
void setDivv(int64 val)
An output stream object that owns its own string buffer storage.
int64 getStdswitcher() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
**But if you need a result
Definition: thread.h:613
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setLodv(fpreal64 val)
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.
bool getNew() const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
Pastecoord getPastecoord() const
double fpreal64
Definition: SYS_Types.h:201
static void saveData(std::ostream &os, UT_Matrix2D v)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
Surftype opSurftype(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector3D v)
exint length() const
void setLodu(fpreal64 val)
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
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
int64 getOrderv() const
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
fpreal64 getLodtrim() const
void setGroup(const UT_StringHolder &val)
fpreal64 getLodv() const
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setPastecoord(Pastecoord val)
static void saveData(std::ostream &os, bool v)
long long int64
Definition: SYS_Types.h:116
Fromtype getFromtype() const
SYS_FORCE_INLINE UT_StringHolder getToken(Fromtype enum_value)
void setDivu(int64 val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
void setTotype(Totype val)
void setOffset(fpreal64 val)
int64 getDivv() const
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static int version()
void setPasteattrib(Pasteattrib val)
void setInterphull(bool val)
Pastecoord opPastecoord(const SOP_NodeVerb::CookParms &cookparms) const
void setStdswitcher(int64 val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
const UT_StringHolder & getGroup() const
static void saveData(std::ostream &os, UT_Matrix3D v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
GT_API const UT_StringHolder version
static void saveData(std::ostream &os, PRM_DataItemHandle s)
exint getNestNumParms(TempIndex idx) const override
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
fpreal64 opOffset(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
int64 opDivtrim(const SOP_NodeVerb::CookParms &cookparms) const
void setDivtrim(int64 val)
int64 getDivtrim() const
static void saveData(std::ostream &os, UT_Vector4D v)
void loadFromOpSubclass(const LoadParms &loadparms) override
bool getInterphull() const
void setOrderu(int64 val)
int64 opDivv(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 opLodtrim(const SOP_NodeVerb::CookParms &cookparms) const
void setOrderv(int64 val)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
bool opNew(const SOP_NodeVerb::CookParms &cookparms) const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
fpreal64 getLodu() const
ParmType getNestParmType(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
const char * getNestParmName(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, UT_Vector2D &v)
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 getOffset() const
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
bool opInterphull(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void copyFrom(const OP_NodeParms *src) override
#define SOP_API
Definition: SOP_API.h:10
bool operator!=(const SOP_ConvertParms &src) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
int64 opStdswitcher(const SOP_NodeVerb::CookParms &cookparms) const
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
int64 getOrderu() 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
int64 opDivu(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
GLboolean r
Definition: glcorearb.h:1222
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void loadData(UT_IStream &is, int64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
static void loadData(UT_IStream &is, UT_Matrix2D &v)
fpreal64 opLodv(const SOP_NodeVerb::CookParms &cookparms) const
bool load(UT_IStream &is)
void setFromtype(Fromtype val)
type
Definition: core.h:1059
void setLodtrim(fpreal64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
Surftype getSurftype() const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setNew(bool val)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
Pasteattrib opPasteattrib(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663