HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_CopyToPoints-2.0.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_CopyToPoints_2_0Enums
24 {
25  enum class SourceGroupType
26  {
27  GUESS = 0,
28  PRIMS,
29  POINTS
30  };
31 
34  {
35  using namespace UT::Literal;
36  switch (enum_value) {
37  case SourceGroupType::GUESS: return "guess"_sh;
38  case SourceGroupType::PRIMS: return "prims"_sh;
39  case SourceGroupType::POINTS: return "points"_sh;
40  default: UT_ASSERT(false); return ""_sh;
41  }
42  }
43 
44  enum class Pivot
45  {
46  ORIGIN = 0,
47  CENTROID
48  };
49 
51  getToken(Pivot enum_value)
52  {
53  using namespace UT::Literal;
54  switch (enum_value) {
55  case Pivot::ORIGIN: return "origin"_sh;
56  case Pivot::CENTROID: return "centroid"_sh;
57  default: UT_ASSERT(false); return ""_sh;
58  }
59  }
60 
61  enum class ViewportLOD
62  {
63  FULL = 0,
64  POINTS,
65  BOX,
66  CENTROID,
67  HIDDEN
68  };
69 
71  getToken(ViewportLOD enum_value)
72  {
73  using namespace UT::Literal;
74  switch (enum_value) {
75  case ViewportLOD::FULL: return "full"_sh;
76  case ViewportLOD::POINTS: return "points"_sh;
77  case ViewportLOD::BOX: return "box"_sh;
78  case ViewportLOD::CENTROID: return "centroid"_sh;
79  case ViewportLOD::HIDDEN: return "hidden"_sh;
80  default: UT_ASSERT(false); return ""_sh;
81  }
82  }
83 
84  enum class Applyto
85  {
86  POINTS = 0,
87  VERTS,
88  PRIMS
89  };
90 
92  getToken(Applyto enum_value)
93  {
94  using namespace UT::Literal;
95  switch (enum_value) {
96  case Applyto::POINTS: return "points"_sh;
97  case Applyto::VERTS: return "verts"_sh;
98  case Applyto::PRIMS: return "prims"_sh;
99  default: UT_ASSERT(false); return ""_sh;
100  }
101  }
102 
103  enum class Applymethod
104  {
105  COPY = 0,
106  NONE,
107  MULT,
108  ADD,
109  SUB
110  };
111 
113  getToken(Applymethod enum_value)
114  {
115  using namespace UT::Literal;
116  switch (enum_value) {
117  case Applymethod::COPY: return "copy"_sh;
118  case Applymethod::NONE: return "none"_sh;
119  case Applymethod::MULT: return "mult"_sh;
120  case Applymethod::ADD: return "add"_sh;
121  case Applymethod::SUB: return "sub"_sh;
122  default: UT_ASSERT(false); return ""_sh;
123  }
124  }
125 
126 }
127 
128 
130 {
131 public:
132  static int version() { return 1; }
134  {
135  bool useapply;
139 
140 
142  {
143  useapply = true;
144  applyto = 0;
145  applymethod = 0;
146  applyattribs = ""_UTsh;
147 
148  }
149 
150  bool operator==(const TargetAttribs &src) const
151  {
152  if (useapply != src.useapply) return false;
153  if (applyto != src.applyto) return false;
154  if (applymethod != src.applymethod) return false;
155  if (applyattribs != src.applyattribs) return false;
156 
157  return true;
158  }
159  bool operator!=(const TargetAttribs &src) const
160  {
161  return !operator==(src);
162  }
163 
164  };
165 
167  {
169 
170  buf.strcat("[ ");
171  for (int i = 0; i < list.entries(); i++)
172  {
173  if (i)
174  buf.strcat(", ");
175  buf.strcat("( ");
176  buf.append("");
177  buf.appendSprintf("%s", (list(i).useapply) ? "true" : "false");
178  buf.append(", ");
179  buf.appendSprintf("%d", (int) list(i).applyto);
180  buf.append(", ");
181  buf.appendSprintf("%d", (int) list(i).applymethod);
182  buf.append(", ");
183  { UT_String tmp; tmp = UT_StringWrap(list(i).applyattribs).makeQuotedString('"'); buf.strcat(tmp); }
184 
185  buf.strcat(" )");
186  }
187  buf.strcat(" ]");
188 
190  return result;
191  }
192 
194  {
195  mySourceGroup = ""_UTsh;
196  mySourceGroupType = 0;
197  myTargetGroup = ""_UTsh;
198  myUseIDAttrib = false;
199  myIDAttrib = "name"_UTsh;
200  myPack = false;
201  myPivot = 1;
202  myViewportLOD = 0;
203  myTransform = true;
204  myUseImplicitN = true;
205  myTargetAttribs.setSize(0);
206 
207  }
208 
209  explicit SOP_CopyToPoints_2_0Parms(const SOP_CopyToPoints_2_0Parms &) = default;
212  SOP_CopyToPoints_2_0Parms &operator=(SOP_CopyToPoints_2_0Parms &&) noexcept = default;
213 
215 
217  {
218  if (mySourceGroup != src.mySourceGroup) return false;
219  if (mySourceGroupType != src.mySourceGroupType) return false;
220  if (myTargetGroup != src.myTargetGroup) return false;
221  if (myUseIDAttrib != src.myUseIDAttrib) return false;
222  if (myIDAttrib != src.myIDAttrib) return false;
223  if (myPack != src.myPack) return false;
224  if (myPivot != src.myPivot) return false;
225  if (myViewportLOD != src.myViewportLOD) return false;
226  if (myTransform != src.myTransform) return false;
227  if (myUseImplicitN != src.myUseImplicitN) return false;
228  if (myTargetAttribs != src.myTargetAttribs) return false;
229 
230  return true;
231  }
233  {
234  return !operator==(src);
235  }
241 
242 
243 
244  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
245  {
246  mySourceGroup = ""_UTsh;
247  if (true)
248  graph->evalOpParm(mySourceGroup, nodeidx, "sourcegroup", time, 0);
249  mySourceGroupType = 0;
250  if (true)
251  graph->evalOpParm(mySourceGroupType, nodeidx, "sourcegrouptype", time, 0);
252  myTargetGroup = ""_UTsh;
253  if (true)
254  graph->evalOpParm(myTargetGroup, nodeidx, "targetgroup", time, 0);
255  myUseIDAttrib = false;
256  if (true)
257  graph->evalOpParm(myUseIDAttrib, nodeidx, "useidattrib", time, 0);
258  myIDAttrib = "name"_UTsh;
259  if (true && ( (true&&!(((getUseIDAttrib()==0)))) ) )
260  graph->evalOpParm(myIDAttrib, nodeidx, "idattrib", time, 0);
261  myPack = false;
262  if (true)
263  graph->evalOpParm(myPack, nodeidx, "pack", time, 0);
264  myPivot = 1;
265  if (true && ( (true&&!(((getPack()==0)))) ) )
266  graph->evalOpParm(myPivot, nodeidx, "pivot", time, 0);
267  myViewportLOD = 0;
268  if (true && ( (true&&!(((getPack()==0)))) ) )
269  graph->evalOpParm(myViewportLOD, nodeidx, "viewportlod", time, 0);
270  myTransform = true;
271  if (true)
272  graph->evalOpParm(myTransform, nodeidx, "transform", time, 0);
273  myUseImplicitN = true;
274  if (true && ( (true&&!(((getTransform()==0)))) ) )
275  graph->evalOpParm(myUseImplicitN, nodeidx, "useimplicitn", time, 0);
276  if (true)
277  {
278  int64 length = 0;
279  graph->evalOpParm(length, nodeidx, "targetattribs", time, 0);
280  if (length < 0) length = 0;
281  myTargetAttribs.setSize(length);
282  for (exint i = 0; i < length; i++)
283  {
284  int parmidx[1];
285  int offsets[1];
286  parmidx[0] = i+1;
287  offsets[0] = 1;
288  auto && _curentry = myTargetAttribs(i);
289  (void) _curentry;
290  _curentry.useapply = true;
291  if (true)
292  graph->evalOpParmInst(_curentry.useapply, nodeidx, "useapply#", parmidx, offsets, time, 0, 2-1);
293  _curentry.applyto = 0;
294  if (true)
295  graph->evalOpParmInst(_curentry.applyto, nodeidx, "applyto#", parmidx, offsets, time, 0, 2-1);
296  _curentry.applymethod = 0;
297  if (true)
298  graph->evalOpParmInst(_curentry.applymethod, nodeidx, "applymethod#", parmidx, offsets, time, 0, 2-1);
299  _curentry.applyattribs = ""_UTsh;
300  if (true)
301  graph->evalOpParmInst(_curentry.applyattribs, nodeidx, "applyattribs#", parmidx, offsets, time, 0, 2-1);
302 
303  }
304  }
305  else
306  myTargetAttribs.clear();
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_CopyToPoints_2_0Parms *)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, mySourceGroup);
335  break;
336  case 1:
337  coerceValue(value, mySourceGroupType);
338  break;
339  case 2:
340  coerceValue(value, myTargetGroup);
341  break;
342  case 3:
343  coerceValue(value, myUseIDAttrib);
344  break;
345  case 4:
346  coerceValue(value, myIDAttrib);
347  break;
348  case 5:
349  coerceValue(value, myPack);
350  break;
351  case 6:
352  coerceValue(value, myPivot);
353  break;
354  case 7:
355  coerceValue(value, myViewportLOD);
356  break;
357  case 8:
358  coerceValue(value, myTransform);
359  break;
360  case 9:
361  coerceValue(value, myUseImplicitN);
362  break;
363  case 10:
364  if (idx.size() == 1)
365  coerceValue(value, myTargetAttribs.entries());
366  else if (instance[0] < myTargetAttribs.entries())
367  {
368  auto && _data = myTargetAttribs(instance[0]);
369  switch (idx[1])
370  {
371  case 0:
372  coerceValue(value, _data.useapply);
373  break;
374  case 1:
375  coerceValue(value, _data.applyto);
376  break;
377  case 2:
378  coerceValue(value, _data.applymethod);
379  break;
380  case 3:
381  coerceValue(value, _data.applyattribs);
382  break;
383 
384  }
385  }
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(mySourceGroup, ( ( value ) ));
436  break;
437  case 1:
438  coerceValue(mySourceGroupType, clampMinValue(0, clampMaxValue(2, value ) ));
439  break;
440  case 2:
441  coerceValue(myTargetGroup, ( ( value ) ));
442  break;
443  case 3:
444  coerceValue(myUseIDAttrib, ( ( value ) ));
445  break;
446  case 4:
447  coerceValue(myIDAttrib, ( ( value ) ));
448  break;
449  case 5:
450  coerceValue(myPack, ( ( value ) ));
451  break;
452  case 6:
453  coerceValue(myPivot, clampMinValue(0, clampMaxValue(1, value ) ));
454  break;
455  case 7:
456  coerceValue(myViewportLOD, clampMinValue(0, clampMaxValue(4, value ) ));
457  break;
458  case 8:
459  coerceValue(myTransform, ( ( value ) ));
460  break;
461  case 9:
462  coerceValue(myUseImplicitN, ( ( value ) ));
463  break;
464  case 10:
465  if (idx.size() == 1)
466  {
467  exint newsize;
468  coerceValue(newsize, value);
469  if (newsize < 0) newsize = 0;
470  myTargetAttribs.setSize(newsize);
471  }
472  else
473  {
474  if (instance[0] < 0)
475  return;
476  myTargetAttribs.setSizeIfNeeded(instance[0]+1);
477  auto && _data = myTargetAttribs(instance[0]);
478  switch (idx[1])
479  {
480  case 0:
481  coerceValue(_data.useapply, value);
482  break;
483  case 1:
484  coerceValue(_data.applyto, value);
485  break;
486  case 2:
487  coerceValue(_data.applymethod, value);
488  break;
489  case 3:
490  coerceValue(_data.applyattribs, value);
491  break;
492 
493  }
494  }
495  break;
496 
497  }
498  }
499 
500  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
501  { doSetParmValue(idx, instance, value); }
502  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
503  { doSetParmValue(idx, instance, value); }
504  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
505  { doSetParmValue(idx, instance, value); }
506  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
507  { doSetParmValue(idx, instance, value); }
508  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
509  { doSetParmValue(idx, instance, value); }
510  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
511  { doSetParmValue(idx, instance, value); }
512  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
513  { doSetParmValue(idx, instance, value); }
514  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
515  { doSetParmValue(idx, instance, value); }
516  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
517  { doSetParmValue(idx, instance, value); }
518  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
519  { doSetParmValue(idx, instance, value); }
520  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
521  { doSetParmValue(idx, instance, value); }
522 
523  exint getNestNumParms(TempIndex idx) const override
524  {
525  if (idx.size() == 0)
526  return 11;
527  switch (idx[0])
528  {
529  case 10:
530  return 4;
531 
532  }
533  // Invalid
534  return 0;
535  }
536 
537  const char *getNestParmName(TempIndex fieldnum) const override
538  {
539  if (fieldnum.size() < 1)
540  return 0;
541  switch (fieldnum[0])
542  {
543  case 0:
544  return "sourcegroup";
545  case 1:
546  return "sourcegrouptype";
547  case 2:
548  return "targetgroup";
549  case 3:
550  return "useidattrib";
551  case 4:
552  return "idattrib";
553  case 5:
554  return "pack";
555  case 6:
556  return "pivot";
557  case 7:
558  return "viewportlod";
559  case 8:
560  return "transform";
561  case 9:
562  return "useimplicitn";
563  case 10:
564  if (fieldnum.size() == 1)
565  return "targetattribs";
566  switch (fieldnum[1])
567  {
568  case 0:
569  return "useapply#";
570  case 1:
571  return "applyto#";
572  case 2:
573  return "applymethod#";
574  case 3:
575  return "applyattribs#";
576 
577  }
578  return 0;
579 
580  }
581  return 0;
582  }
583 
584  ParmType getNestParmType(TempIndex fieldnum) const override
585  {
586  if (fieldnum.size() < 1)
587  return PARM_UNSUPPORTED;
588  switch (fieldnum[0])
589  {
590  case 0:
591  return PARM_STRING;
592  case 1:
593  return PARM_INTEGER;
594  case 2:
595  return PARM_STRING;
596  case 3:
597  return PARM_INTEGER;
598  case 4:
599  return PARM_STRING;
600  case 5:
601  return PARM_INTEGER;
602  case 6:
603  return PARM_INTEGER;
604  case 7:
605  return PARM_INTEGER;
606  case 8:
607  return PARM_INTEGER;
608  case 9:
609  return PARM_INTEGER;
610  case 10:
611  if (fieldnum.size() == 1)
612  return PARM_MULTIPARM;
613  switch (fieldnum[1])
614  {
615  case 0:
616  return PARM_INTEGER;
617  case 1:
618  return PARM_INTEGER;
619  case 2:
620  return PARM_INTEGER;
621  case 3:
622  return PARM_STRING;
623 
624  }
625  return PARM_UNSUPPORTED;
626 
627  }
628  return PARM_UNSUPPORTED;
629  }
630 
631  // Boiler plate to load individual types.
632  static void loadData(UT_IStream &is, int64 &v)
633  { is.bread(&v, 1); }
634  static void loadData(UT_IStream &is, bool &v)
635  { int64 iv; is.bread(&iv, 1); v = iv; }
636  static void loadData(UT_IStream &is, fpreal64 &v)
637  { is.bread<fpreal64>(&v, 1); }
638  static void loadData(UT_IStream &is, UT_Vector2D &v)
639  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
640  static void loadData(UT_IStream &is, UT_Vector3D &v)
641  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
642  is.bread<fpreal64>(&v.z(), 1); }
643  static void loadData(UT_IStream &is, UT_Vector4D &v)
644  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
645  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
646  static void loadData(UT_IStream &is, UT_Matrix2D &v)
647  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
648  static void loadData(UT_IStream &is, UT_Matrix3D &v)
649  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
650  static void loadData(UT_IStream &is, UT_Matrix4D &v)
651  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
652  static void loadData(UT_IStream &is, UT_Vector2I &v)
653  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
654  static void loadData(UT_IStream &is, UT_Vector3I &v)
655  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
656  is.bread<int64>(&v.z(), 1); }
657  static void loadData(UT_IStream &is, UT_Vector4I &v)
658  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
659  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
661  { is.bread(v); }
663  { UT_StringHolder rampdata;
664  loadData(is, rampdata);
665  if (rampdata.isstring())
666  {
667  v.reset(new UT_Ramp());
668  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
669  v->load(istr);
670  }
671  else v.reset();
672  }
675  loadData(is, data);
676  if (data.isstring())
677  {
678  // Find the data type.
679  const char *colon = UT_StringWrap(data).findChar(':');
680  if (colon)
681  {
682  int typelen = colon - data.buffer();
684  type.strncpy(data.buffer(), typelen);
685  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
686 
687  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
688  }
689  }
690  else v.reset();
691  }
692 
693  static void saveData(std::ostream &os, int64 v)
694  { UTwrite(os, &v); }
695  static void saveData(std::ostream &os, bool v)
696  { int64 iv = v; UTwrite(os, &iv); }
697  static void saveData(std::ostream &os, fpreal64 v)
698  { UTwrite<fpreal64>(os, &v); }
699  static void saveData(std::ostream &os, UT_Vector2D v)
700  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
701  static void saveData(std::ostream &os, UT_Vector3D v)
702  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
703  UTwrite<fpreal64>(os, &v.z()); }
704  static void saveData(std::ostream &os, UT_Vector4D v)
705  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
706  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
707  static void saveData(std::ostream &os, UT_Matrix2D v)
709  static void saveData(std::ostream &os, UT_Matrix3D v)
711  static void saveData(std::ostream &os, UT_Matrix4D v)
713  static void saveData(std::ostream &os, UT_StringHolder s)
714  { UT_StringWrap(s).saveBinary(os); }
715  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
717  UT_OStringStream ostr;
718  if (s) s->save(ostr);
719  result = ostr.str();
720  saveData(os, result);
721  }
722  static void saveData(std::ostream &os, PRM_DataItemHandle s)
724  UT_OStringStream ostr;
725  if (s)
726  {
727  ostr << s->getDataTypeToken();
728  ostr << ":";
729  s->saveBinary(ostr);
730  }
731  result = ostr.str();
732  saveData(os, result);
733  }
734 
735 
736  void save(std::ostream &os) const
737  {
738  int32 v = version();
739  UTwrite(os, &v);
740  saveData(os, mySourceGroup);
741  saveData(os, mySourceGroupType);
742  saveData(os, myTargetGroup);
743  saveData(os, myUseIDAttrib);
744  saveData(os, myIDAttrib);
745  saveData(os, myPack);
746  saveData(os, myPivot);
747  saveData(os, myViewportLOD);
748  saveData(os, myTransform);
749  saveData(os, myUseImplicitN);
750  {
751  int64 length = myTargetAttribs.entries();
752  UTwrite(os, &length);
753  for (exint i = 0; i < length; i++)
754  {
755  auto && _curentry = myTargetAttribs(i);
756  (void) _curentry;
757  saveData(os, _curentry.useapply);
758  saveData(os, _curentry.applyto);
759  saveData(os, _curentry.applymethod);
760  saveData(os, _curentry.applyattribs);
761 
762  }
763  }
764 
765  }
766 
767  bool load(UT_IStream &is)
768  {
769  int32 v;
770  is.bread(&v, 1);
771  if (version() != v)
772  {
773  // Fail incompatible versions
774  return false;
775  }
776  loadData(is, mySourceGroup);
777  loadData(is, mySourceGroupType);
778  loadData(is, myTargetGroup);
779  loadData(is, myUseIDAttrib);
780  loadData(is, myIDAttrib);
781  loadData(is, myPack);
782  loadData(is, myPivot);
783  loadData(is, myViewportLOD);
784  loadData(is, myTransform);
785  loadData(is, myUseImplicitN);
786  {
787  int64 length;
788  is.read(&length, 1);
789  myTargetAttribs.setSize(length);
790  for (exint i = 0; i < length; i++)
791  {
792  auto && _curentry = myTargetAttribs(i);
793  (void) _curentry;
794  loadData(is, _curentry.useapply);
795  loadData(is, _curentry.applyto);
796  loadData(is, _curentry.applymethod);
797  loadData(is, _curentry.applyattribs);
798 
799  }
800  }
801 
802  return true;
803  }
804 
805  const UT_StringHolder & getSourceGroup() const { return mySourceGroup; }
806  void setSourceGroup(const UT_StringHolder & val) { mySourceGroup = val; }
808  {
809  SOP_Node *thissop = cookparms.getNode();
810  if (!thissop) return getSourceGroup();
812  OP_Utils::evalOpParm(result, thissop, "sourcegroup", cookparms.getCookTime(), 0);
813  return result;
814  }
815  SourceGroupType getSourceGroupType() const { return SourceGroupType(mySourceGroupType); }
816  void setSourceGroupType(SourceGroupType val) { mySourceGroupType = int64(val); }
818  {
819  SOP_Node *thissop = cookparms.getNode();
820  if (!thissop) return getSourceGroupType();
821  int64 result;
822  OP_Utils::evalOpParm(result, thissop, "sourcegrouptype", cookparms.getCookTime(), 0);
823  return SourceGroupType(result);
824  }
825  const UT_StringHolder & getTargetGroup() const { return myTargetGroup; }
826  void setTargetGroup(const UT_StringHolder & val) { myTargetGroup = val; }
828  {
829  SOP_Node *thissop = cookparms.getNode();
830  if (!thissop) return getTargetGroup();
832  OP_Utils::evalOpParm(result, thissop, "targetgroup", cookparms.getCookTime(), 0);
833  return result;
834  }
835  bool getUseIDAttrib() const { return myUseIDAttrib; }
836  void setUseIDAttrib(bool val) { myUseIDAttrib = val; }
837  bool opUseIDAttrib(const SOP_NodeVerb::CookParms &cookparms) const
838  {
839  SOP_Node *thissop = cookparms.getNode();
840  if (!thissop) return getUseIDAttrib();
841  bool result;
842  OP_Utils::evalOpParm(result, thissop, "useidattrib", cookparms.getCookTime(), 0);
843  return result;
844  }
845  const UT_StringHolder & getIDAttrib() const { return myIDAttrib; }
846  void setIDAttrib(const UT_StringHolder & val) { myIDAttrib = val; }
848  {
849  SOP_Node *thissop = cookparms.getNode();
850  if (!thissop) return getIDAttrib();
852  OP_Utils::evalOpParm(result, thissop, "idattrib", cookparms.getCookTime(), 0);
853  return result;
854  }
855  bool getPack() const { return myPack; }
856  void setPack(bool val) { myPack = val; }
857  bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
858  {
859  SOP_Node *thissop = cookparms.getNode();
860  if (!thissop) return getPack();
861  bool result;
862  OP_Utils::evalOpParm(result, thissop, "pack", cookparms.getCookTime(), 0);
863  return result;
864  }
865  Pivot getPivot() const { return Pivot(myPivot); }
866  void setPivot(Pivot val) { myPivot = int64(val); }
867  Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
868  {
869  SOP_Node *thissop = cookparms.getNode();
870  if (!thissop) return getPivot();
871  int64 result;
872  OP_Utils::evalOpParm(result, thissop, "pivot", cookparms.getCookTime(), 0);
873  return Pivot(result);
874  }
875  ViewportLOD getViewportLOD() const { return ViewportLOD(myViewportLOD); }
876  void setViewportLOD(ViewportLOD val) { myViewportLOD = int64(val); }
878  {
879  SOP_Node *thissop = cookparms.getNode();
880  if (!thissop) return getViewportLOD();
881  int64 result;
882  OP_Utils::evalOpParm(result, thissop, "viewportlod", cookparms.getCookTime(), 0);
883  return ViewportLOD(result);
884  }
885  bool getTransform() const { return myTransform; }
886  void setTransform(bool val) { myTransform = val; }
887  bool opTransform(const SOP_NodeVerb::CookParms &cookparms) const
888  {
889  SOP_Node *thissop = cookparms.getNode();
890  if (!thissop) return getTransform();
891  bool result;
892  OP_Utils::evalOpParm(result, thissop, "transform", cookparms.getCookTime(), 0);
893  return result;
894  }
895  bool getUseImplicitN() const { return myUseImplicitN; }
896  void setUseImplicitN(bool val) { myUseImplicitN = val; }
897  bool opUseImplicitN(const SOP_NodeVerb::CookParms &cookparms) const
898  {
899  SOP_Node *thissop = cookparms.getNode();
900  if (!thissop) return getUseImplicitN();
901  bool result;
902  OP_Utils::evalOpParm(result, thissop, "useimplicitn", cookparms.getCookTime(), 0);
903  return result;
904  }
905  const UT_Array<TargetAttribs> &getTargetAttribs() const { return myTargetAttribs; }
906 void setTargetAttribs(const UT_Array<TargetAttribs> &val) { myTargetAttribs = val; }
908  {
909  SOP_Node *thissop = cookparms.getNode();
910  if (!thissop) return getTargetAttribs().entries();
911  exint result;
912  OP_Utils::evalOpParm(result, thissop, "targetattribs", cookparms.getCookTime(), 0);
913  return result;
914  }
915  bool opTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
916  { return opinstTargetAttribs_useapply(cookparms, &_idx); }
917  bool opinstTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
918  {
919  SOP_Node *thissop = cookparms.getNode();
920  if (!thissop) return (myTargetAttribs(_idx[0]).useapply);
921  int _parmidx[2-1];
922  _parmidx[1-1] = _idx[1-1] + 1;
923 
924  bool result;
925  OP_Utils::evalOpParmInst(result, thissop, "useapply#", _parmidx, cookparms.getCookTime(), 0, 2-1);
926  return (result);
927  }
928  int64 opTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
929  { return opinstTargetAttribs_applyto(cookparms, &_idx); }
930  int64 opinstTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
931  {
932  SOP_Node *thissop = cookparms.getNode();
933  if (!thissop) return (myTargetAttribs(_idx[0]).applyto);
934  int _parmidx[2-1];
935  _parmidx[1-1] = _idx[1-1] + 1;
936 
937  int64 result;
938  OP_Utils::evalOpParmInst(result, thissop, "applyto#", _parmidx, cookparms.getCookTime(), 0, 2-1);
939  return (result);
940  }
942  { return opinstTargetAttribs_applymethod(cookparms, &_idx); }
943  int64 opinstTargetAttribs_applymethod(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
944  {
945  SOP_Node *thissop = cookparms.getNode();
946  if (!thissop) return (myTargetAttribs(_idx[0]).applymethod);
947  int _parmidx[2-1];
948  _parmidx[1-1] = _idx[1-1] + 1;
949 
950  int64 result;
951  OP_Utils::evalOpParmInst(result, thissop, "applymethod#", _parmidx, cookparms.getCookTime(), 0, 2-1);
952  return (result);
953  }
955  { return opinstTargetAttribs_applyattribs(cookparms, &_idx); }
957  {
958  SOP_Node *thissop = cookparms.getNode();
959  if (!thissop) return (myTargetAttribs(_idx[0]).applyattribs);
960  int _parmidx[2-1];
961  _parmidx[1-1] = _idx[1-1] + 1;
962 
964  OP_Utils::evalOpParmInst(result, thissop, "applyattribs#", _parmidx, cookparms.getCookTime(), 0, 2-1);
965  return (result);
966  }
967 
968 
969 private:
970  UT_StringHolder mySourceGroup;
971  int64 mySourceGroupType;
972  UT_StringHolder myTargetGroup;
973  bool myUseIDAttrib;
974  UT_StringHolder myIDAttrib;
975  bool myPack;
976  int64 myPivot;
977  int64 myViewportLOD;
978  bool myTransform;
979  bool myUseImplicitN;
980  UT_Array<TargetAttribs> myTargetAttribs;
981 
982 };
SourceGroupType opSourceGroupType(const SOP_NodeVerb::CookParms &cookparms) const
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
int64 opinstTargetAttribs_applymethod(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setTargetGroup(const UT_StringHolder &val)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Vector2D v)
UT_StringHolder createString(const UT_Array< TargetAttribs > &list) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void
Definition: png.h:1083
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
fpreal getTime() const
Definition: OP_Context.h:62
static void saveData(std::ostream &os, UT_Matrix3D v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setTargetAttribs(const UT_Array< TargetAttribs > &val)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
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
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
static void loadData(UT_IStream &is, UT_Matrix2D &v)
An output stream object that owns its own string buffer storage.
bool opinstTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool opUseImplicitN(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, bool &v)
**But if you need a result
Definition: thread.h:613
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setSourceGroup(const UT_StringHolder &val)
void setSourceGroupType(SourceGroupType val)
UT_StringHolder opTargetGroup(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void setIDAttrib(const UT_StringHolder &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 operator!=(const SOP_CopyToPoints_2_0Parms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_StringHolder opIDAttrib(const SOP_NodeVerb::CookParms &cookparms) const
int64 opTargetAttribs_applymethod(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void copyFrom(const OP_NodeParms *src) override
ParmType getNestParmType(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
bool opUseIDAttrib(const SOP_NodeVerb::CookParms &cookparms) const
void loadFromOpSubclass(const LoadParms &loadparms) override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
bool operator==(const TargetAttribs &src) const
Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, UT_StringHolder s)
static void loadData(UT_IStream &is, UT_Vector2D &v)
const UT_StringHolder & getTargetGroup() const
UT_StringHolder opTargetAttribs_applyattribs(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
exint length() const
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_SharedPtr< UT_Ramp > s)
int64 opTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
exint opTargetAttribs(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
const UT_Array< TargetAttribs > & getTargetAttribs() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
bool opTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, const int *inst, const int *offsets, fpreal time, DEP_MicroNode *depnode, int nestlevel=1) const =0
long long int64
Definition: SYS_Types.h:116
ViewportLOD opViewportLOD(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, int64 v)
void save(std::ostream &os) const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
const char * getNestParmName(TempIndex fieldnum) 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_Matrix4D &v)
UT_StringHolder opinstTargetAttribs_applyattribs(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
SYS_FORCE_INLINE void strcat(const char *src)
static void saveData(std::ostream &os, fpreal64 v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
GT_API const UT_StringHolder version
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
bool operator!=(const TargetAttribs &src) const
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
fpreal64 fpreal
Definition: SYS_Types.h:277
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
static void saveData(std::ostream &os, UT_Vector4D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, fpreal64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
bool opTransform(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
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 opinstTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
GLboolean r
Definition: glcorearb.h:1222
bool isParmColorRamp(exint idx) const override
static void saveData(std::ostream &os, bool v)
exint getNestNumParms(TempIndex idx) const override
UT_StringHolder opSourceGroup(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
type
Definition: core.h:1059
static void loadData(UT_IStream &is, UT_Vector4I &v)
bool operator==(const SOP_CopyToPoints_2_0Parms &src) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
const UT_StringHolder & getSourceGroup() const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
static void saveData(std::ostream &os, UT_Matrix2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, UT_Matrix4D v)
SYS_FORCE_INLINE UT_StringHolder getToken(SourceGroupType enum_value)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
const UT_StringHolder & getIDAttrib() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
SourceGroupType getSourceGroupType() const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
static void saveData(std::ostream &os, UT_Vector3D v)
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override