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 <OP/OP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 namespace SOP_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 
231  if (baseGetSignature() != src.baseGetSignature()) return false;
232 
233  return true;
234  }
236  {
237  return !operator==(src);
238  }
244 
245 
246 
247  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
248  {
249  mySourceGroup = ""_UTsh;
250  if (true)
251  graph->evalOpParm(mySourceGroup, nodeidx, "sourcegroup", time, graph->isDirect()?nullptr:depnode);
252  mySourceGroupType = 0;
253  if (true)
254  graph->evalOpParm(mySourceGroupType, nodeidx, "sourcegrouptype", time, graph->isDirect()?nullptr:depnode);
255  myTargetGroup = ""_UTsh;
256  if (true)
257  graph->evalOpParm(myTargetGroup, nodeidx, "targetgroup", time, graph->isDirect()?nullptr:depnode);
258  myUseIDAttrib = false;
259  if (true)
260  graph->evalOpParm(myUseIDAttrib, nodeidx, "useidattrib", time, graph->isDirect()?nullptr:depnode);
261  myIDAttrib = "name"_UTsh;
262  if (true && ( (true&&!(((getUseIDAttrib()==0)))) ) )
263  graph->evalOpParm(myIDAttrib, nodeidx, "idattrib", time, graph->isDirect()?nullptr:depnode);
264  myPack = false;
265  if (true)
266  graph->evalOpParm(myPack, nodeidx, "pack", time, graph->isDirect()?nullptr:depnode);
267  myPivot = 1;
268  if (true && ( (true&&!(((getPack()==0)))) ) )
269  graph->evalOpParm(myPivot, nodeidx, "pivot", time, graph->isDirect()?nullptr:depnode);
270  myViewportLOD = 0;
271  if (true && ( (true&&!(((getPack()==0)))) ) )
272  graph->evalOpParm(myViewportLOD, nodeidx, "viewportlod", time, graph->isDirect()?nullptr:depnode);
273  myTransform = true;
274  if (true)
275  graph->evalOpParm(myTransform, nodeidx, "transform", time, graph->isDirect()?nullptr:depnode);
276  myUseImplicitN = true;
277  if (true && ( (true&&!(((getTransform()==0)))) ) )
278  graph->evalOpParm(myUseImplicitN, nodeidx, "useimplicitn", time, graph->isDirect()?nullptr:depnode);
279  if (true)
280  {
281  int64 length = 0;
282  graph->evalOpParm(length, nodeidx, "targetattribs", time, graph->isDirect()?nullptr:depnode);
283  if (length < 0) length = 0;
284  myTargetAttribs.setSize(length);
285  for (exint i = 0; i < length; i++)
286  {
287  int parmidx[1];
288  int offsets[1];
289  parmidx[0] = i+1;
290  offsets[0] = 1;
291  auto && _curentry = myTargetAttribs(i);
292  (void) _curentry;
293  _curentry.useapply = true;
294  if (true)
295  graph->evalOpParmInst(_curentry.useapply, nodeidx, "useapply#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
296  _curentry.applyto = 0;
297  if (true)
298  graph->evalOpParmInst(_curentry.applyto, nodeidx, "applyto#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
299  _curentry.applymethod = 0;
300  if (true)
301  graph->evalOpParmInst(_curentry.applymethod, nodeidx, "applymethod#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
302  _curentry.applyattribs = ""_UTsh;
303  if (true)
304  graph->evalOpParmInst(_curentry.applyattribs, nodeidx, "applyattribs#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
305 
306  }
307  }
308  else
309  myTargetAttribs.clear();
310 
311  }
312 
313 
314  void loadFromOpSubclass(const LoadParms &loadparms) override
315  {
316  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
317  }
318 
319 
320  void copyFrom(const OP_NodeParms *src) override
321  {
322  *this = *((const SOP_CopyToPoints_2_0Parms *)src);
323  }
324 
325  template <typename T>
326  void
327  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
328  {
329  if (idx.size() < 1)
330  return;
331  UT_ASSERT(idx.size() == instance.size()+1);
332  if (idx.size() != instance.size()+1)
333  return;
334  switch (idx[0])
335  {
336  case 0:
337  coerceValue(value, mySourceGroup);
338  break;
339  case 1:
340  coerceValue(value, mySourceGroupType);
341  break;
342  case 2:
343  coerceValue(value, myTargetGroup);
344  break;
345  case 3:
346  coerceValue(value, myUseIDAttrib);
347  break;
348  case 4:
349  coerceValue(value, myIDAttrib);
350  break;
351  case 5:
352  coerceValue(value, myPack);
353  break;
354  case 6:
355  coerceValue(value, myPivot);
356  break;
357  case 7:
358  coerceValue(value, myViewportLOD);
359  break;
360  case 8:
361  coerceValue(value, myTransform);
362  break;
363  case 9:
364  coerceValue(value, myUseImplicitN);
365  break;
366  case 10:
367  if (idx.size() == 1)
368  coerceValue(value, myTargetAttribs.entries());
369  else if (instance[0] < myTargetAttribs.entries())
370  {
371  auto && _data = myTargetAttribs(instance[0]);
372  switch (idx[1])
373  {
374  case 0:
375  coerceValue(value, _data.useapply);
376  break;
377  case 1:
378  coerceValue(value, _data.applyto);
379  break;
380  case 2:
381  coerceValue(value, _data.applymethod);
382  break;
383  case 3:
384  coerceValue(value, _data.applyattribs);
385  break;
386 
387  }
388  }
389  break;
390 
391  }
392  }
393 
394  bool isParmColorRamp(exint idx) const override
395  {
396  switch (idx)
397  {
398 
399  }
400  return false;
401  }
402 
403  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
404  { doGetParmValue(idx, instance, value); }
405  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
406  { doGetParmValue(idx, instance, value); }
407  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
408  { doGetParmValue(idx, instance, value); }
409  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
410  { doGetParmValue(idx, instance, value); }
411  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
412  { doGetParmValue(idx, instance, value); }
413  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
414  { doGetParmValue(idx, instance, value); }
415  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
416  { doGetParmValue(idx, instance, value); }
417  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
418  { doGetParmValue(idx, instance, value); }
419  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
420  { doGetParmValue(idx, instance, value); }
421  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
422  { doGetParmValue(idx, instance, value); }
423  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
424  { doGetParmValue(idx, instance, value); }
425 
426  template <typename T>
427  void
428  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
429  {
430  if (idx.size() < 1)
431  return;
432  UT_ASSERT(idx.size() == instance.size()+1);
433  if (idx.size() != instance.size()+1)
434  return;
435  switch (idx[0])
436  {
437  case 0:
438  coerceValue(mySourceGroup, ( ( value ) ));
439  break;
440  case 1:
441  coerceValue(mySourceGroupType, clampMinValue(0, clampMaxValue(2, value ) ));
442  break;
443  case 2:
444  coerceValue(myTargetGroup, ( ( value ) ));
445  break;
446  case 3:
447  coerceValue(myUseIDAttrib, ( ( value ) ));
448  break;
449  case 4:
450  coerceValue(myIDAttrib, ( ( value ) ));
451  break;
452  case 5:
453  coerceValue(myPack, ( ( value ) ));
454  break;
455  case 6:
456  coerceValue(myPivot, clampMinValue(0, clampMaxValue(1, value ) ));
457  break;
458  case 7:
459  coerceValue(myViewportLOD, clampMinValue(0, clampMaxValue(4, value ) ));
460  break;
461  case 8:
462  coerceValue(myTransform, ( ( value ) ));
463  break;
464  case 9:
465  coerceValue(myUseImplicitN, ( ( value ) ));
466  break;
467  case 10:
468  if (idx.size() == 1)
469  {
470  exint newsize;
471  coerceValue(newsize, value);
472  if (newsize < 0) newsize = 0;
473  myTargetAttribs.setSize(newsize);
474  }
475  else
476  {
477  if (instance[0] < 0)
478  return;
479  myTargetAttribs.setSizeIfNeeded(instance[0]+1);
480  auto && _data = myTargetAttribs(instance[0]);
481  switch (idx[1])
482  {
483  case 0:
484  coerceValue(_data.useapply, value);
485  break;
486  case 1:
487  coerceValue(_data.applyto, value);
488  break;
489  case 2:
490  coerceValue(_data.applymethod, value);
491  break;
492  case 3:
493  coerceValue(_data.applyattribs, value);
494  break;
495 
496  }
497  }
498  break;
499 
500  }
501  }
502 
503  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
504  { doSetParmValue(idx, instance, value); }
505  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
506  { doSetParmValue(idx, instance, value); }
507  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
508  { doSetParmValue(idx, instance, value); }
509  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
510  { doSetParmValue(idx, instance, value); }
511  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
512  { doSetParmValue(idx, instance, value); }
513  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
514  { doSetParmValue(idx, instance, value); }
515  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
516  { doSetParmValue(idx, instance, value); }
517  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
518  { doSetParmValue(idx, instance, value); }
519  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
520  { doSetParmValue(idx, instance, value); }
521  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
522  { doSetParmValue(idx, instance, value); }
523  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
524  { doSetParmValue(idx, instance, value); }
525 
526  exint getNestNumParms(TempIndex idx) const override
527  {
528  if (idx.size() == 0)
529  return 11;
530  switch (idx[0])
531  {
532  case 10:
533  return 4;
534 
535  }
536  // Invalid
537  return 0;
538  }
539 
540  const char *getNestParmName(TempIndex fieldnum) const override
541  {
542  if (fieldnum.size() < 1)
543  return 0;
544  switch (fieldnum[0])
545  {
546  case 0:
547  return "sourcegroup";
548  case 1:
549  return "sourcegrouptype";
550  case 2:
551  return "targetgroup";
552  case 3:
553  return "useidattrib";
554  case 4:
555  return "idattrib";
556  case 5:
557  return "pack";
558  case 6:
559  return "pivot";
560  case 7:
561  return "viewportlod";
562  case 8:
563  return "transform";
564  case 9:
565  return "useimplicitn";
566  case 10:
567  if (fieldnum.size() == 1)
568  return "targetattribs";
569  switch (fieldnum[1])
570  {
571  case 0:
572  return "useapply#";
573  case 1:
574  return "applyto#";
575  case 2:
576  return "applymethod#";
577  case 3:
578  return "applyattribs#";
579 
580  }
581  return 0;
582 
583  }
584  return 0;
585  }
586 
587  ParmType getNestParmType(TempIndex fieldnum) const override
588  {
589  if (fieldnum.size() < 1)
590  return PARM_UNSUPPORTED;
591  switch (fieldnum[0])
592  {
593  case 0:
594  return PARM_STRING;
595  case 1:
596  return PARM_INTEGER;
597  case 2:
598  return PARM_STRING;
599  case 3:
600  return PARM_INTEGER;
601  case 4:
602  return PARM_STRING;
603  case 5:
604  return PARM_INTEGER;
605  case 6:
606  return PARM_INTEGER;
607  case 7:
608  return PARM_INTEGER;
609  case 8:
610  return PARM_INTEGER;
611  case 9:
612  return PARM_INTEGER;
613  case 10:
614  if (fieldnum.size() == 1)
615  return PARM_MULTIPARM;
616  switch (fieldnum[1])
617  {
618  case 0:
619  return PARM_INTEGER;
620  case 1:
621  return PARM_INTEGER;
622  case 2:
623  return PARM_INTEGER;
624  case 3:
625  return PARM_STRING;
626 
627  }
628  return PARM_UNSUPPORTED;
629 
630  }
631  return PARM_UNSUPPORTED;
632  }
633 
634  // Boiler plate to load individual types.
635  static void loadData(UT_IStream &is, int64 &v)
636  { is.bread(&v, 1); }
637  static void loadData(UT_IStream &is, bool &v)
638  { int64 iv; is.bread(&iv, 1); v = iv; }
639  static void loadData(UT_IStream &is, fpreal64 &v)
640  { is.bread<fpreal64>(&v, 1); }
641  static void loadData(UT_IStream &is, UT_Vector2D &v)
642  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
643  static void loadData(UT_IStream &is, UT_Vector3D &v)
644  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
645  is.bread<fpreal64>(&v.z(), 1); }
646  static void loadData(UT_IStream &is, UT_Vector4D &v)
647  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
648  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
649  static void loadData(UT_IStream &is, UT_Matrix2D &v)
650  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
651  static void loadData(UT_IStream &is, UT_Matrix3D &v)
652  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
653  static void loadData(UT_IStream &is, UT_Matrix4D &v)
654  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
655  static void loadData(UT_IStream &is, UT_Vector2I &v)
656  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
657  static void loadData(UT_IStream &is, UT_Vector3I &v)
658  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
659  is.bread<int64>(&v.z(), 1); }
660  static void loadData(UT_IStream &is, UT_Vector4I &v)
661  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
662  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
664  { is.bread(v); }
666  { UT_StringHolder rampdata;
667  loadData(is, rampdata);
668  if (rampdata.isstring())
669  {
670  v.reset(new UT_Ramp());
671  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
672  v->load(istr);
673  }
674  else v.reset();
675  }
678  loadData(is, data);
679  if (data.isstring())
680  {
681  // Find the data type.
682  const char *colon = UT_StringWrap(data).findChar(':');
683  if (colon)
684  {
685  int typelen = colon - data.buffer();
687  type.strncpy(data.buffer(), typelen);
688  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
689 
690  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
691  }
692  }
693  else v.reset();
694  }
695 
696  static void saveData(std::ostream &os, int64 v)
697  { UTwrite(os, &v); }
698  static void saveData(std::ostream &os, bool v)
699  { int64 iv = v; UTwrite(os, &iv); }
700  static void saveData(std::ostream &os, fpreal64 v)
701  { UTwrite<fpreal64>(os, &v); }
702  static void saveData(std::ostream &os, UT_Vector2D v)
703  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
704  static void saveData(std::ostream &os, UT_Vector3D v)
705  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
706  UTwrite<fpreal64>(os, &v.z()); }
707  static void saveData(std::ostream &os, UT_Vector4D v)
708  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
709  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
710  static void saveData(std::ostream &os, UT_Matrix2D v)
712  static void saveData(std::ostream &os, UT_Matrix3D v)
714  static void saveData(std::ostream &os, UT_Matrix4D v)
716  static void saveData(std::ostream &os, UT_StringHolder s)
717  { UT_StringWrap(s).saveBinary(os); }
718  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
720  UT_OStringStream ostr;
721  if (s) s->save(ostr);
722  result = ostr.str();
723  saveData(os, result);
724  }
725  static void saveData(std::ostream &os, PRM_DataItemHandle s)
727  UT_OStringStream ostr;
728  if (s)
729  {
730  ostr << s->getDataTypeToken();
731  ostr << ":";
732  s->saveBinary(ostr);
733  }
734  result = ostr.str();
735  saveData(os, result);
736  }
737 
738 
739  void save(std::ostream &os) const
740  {
741  int32 v = version();
742  UTwrite(os, &v);
743  saveData(os, mySourceGroup);
744  saveData(os, mySourceGroupType);
745  saveData(os, myTargetGroup);
746  saveData(os, myUseIDAttrib);
747  saveData(os, myIDAttrib);
748  saveData(os, myPack);
749  saveData(os, myPivot);
750  saveData(os, myViewportLOD);
751  saveData(os, myTransform);
752  saveData(os, myUseImplicitN);
753  {
754  int64 length = myTargetAttribs.entries();
755  UTwrite(os, &length);
756  for (exint i = 0; i < length; i++)
757  {
758  auto && _curentry = myTargetAttribs(i);
759  (void) _curentry;
760  saveData(os, _curentry.useapply);
761  saveData(os, _curentry.applyto);
762  saveData(os, _curentry.applymethod);
763  saveData(os, _curentry.applyattribs);
764 
765  }
766  }
767 
768  }
769 
770  bool load(UT_IStream &is)
771  {
772  int32 v;
773  is.bread(&v, 1);
774  if (version() != v)
775  {
776  // Fail incompatible versions
777  return false;
778  }
779  loadData(is, mySourceGroup);
780  loadData(is, mySourceGroupType);
781  loadData(is, myTargetGroup);
782  loadData(is, myUseIDAttrib);
783  loadData(is, myIDAttrib);
784  loadData(is, myPack);
785  loadData(is, myPivot);
786  loadData(is, myViewportLOD);
787  loadData(is, myTransform);
788  loadData(is, myUseImplicitN);
789  {
790  int64 length;
791  is.read(&length, 1);
792  myTargetAttribs.setSize(length);
793  for (exint i = 0; i < length; i++)
794  {
795  auto && _curentry = myTargetAttribs(i);
796  (void) _curentry;
797  loadData(is, _curentry.useapply);
798  loadData(is, _curentry.applyto);
799  loadData(is, _curentry.applymethod);
800  loadData(is, _curentry.applyattribs);
801 
802  }
803  }
804 
805  return true;
806  }
807 
808  const UT_StringHolder & getSourceGroup() const { return mySourceGroup; }
809  void setSourceGroup(const UT_StringHolder & val) { mySourceGroup = val; }
811  {
812  SOP_Node *thissop = cookparms.getNode();
813  if (!thissop) return getSourceGroup();
815  OP_Utils::evalOpParm(result, thissop, "sourcegroup", cookparms.getCookTime(), 0);
816  return result;
817  }
818  SourceGroupType getSourceGroupType() const { return SourceGroupType(mySourceGroupType); }
819  void setSourceGroupType(SourceGroupType val) { mySourceGroupType = int64(val); }
821  {
822  SOP_Node *thissop = cookparms.getNode();
823  if (!thissop) return getSourceGroupType();
824  int64 result;
825  OP_Utils::evalOpParm(result, thissop, "sourcegrouptype", cookparms.getCookTime(), 0);
826  return SourceGroupType(result);
827  }
828  const UT_StringHolder & getTargetGroup() const { return myTargetGroup; }
829  void setTargetGroup(const UT_StringHolder & val) { myTargetGroup = val; }
831  {
832  SOP_Node *thissop = cookparms.getNode();
833  if (!thissop) return getTargetGroup();
835  OP_Utils::evalOpParm(result, thissop, "targetgroup", cookparms.getCookTime(), 0);
836  return result;
837  }
838  bool getUseIDAttrib() const { return myUseIDAttrib; }
839  void setUseIDAttrib(bool val) { myUseIDAttrib = val; }
840  bool opUseIDAttrib(const SOP_NodeVerb::CookParms &cookparms) const
841  {
842  SOP_Node *thissop = cookparms.getNode();
843  if (!thissop) return getUseIDAttrib();
844  bool result;
845  OP_Utils::evalOpParm(result, thissop, "useidattrib", cookparms.getCookTime(), 0);
846  return result;
847  }
848  const UT_StringHolder & getIDAttrib() const { return myIDAttrib; }
849  void setIDAttrib(const UT_StringHolder & val) { myIDAttrib = val; }
851  {
852  SOP_Node *thissop = cookparms.getNode();
853  if (!thissop) return getIDAttrib();
855  OP_Utils::evalOpParm(result, thissop, "idattrib", cookparms.getCookTime(), 0);
856  return result;
857  }
858  bool getPack() const { return myPack; }
859  void setPack(bool val) { myPack = val; }
860  bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
861  {
862  SOP_Node *thissop = cookparms.getNode();
863  if (!thissop) return getPack();
864  bool result;
865  OP_Utils::evalOpParm(result, thissop, "pack", cookparms.getCookTime(), 0);
866  return result;
867  }
868  Pivot getPivot() const { return Pivot(myPivot); }
869  void setPivot(Pivot val) { myPivot = int64(val); }
870  Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
871  {
872  SOP_Node *thissop = cookparms.getNode();
873  if (!thissop) return getPivot();
874  int64 result;
875  OP_Utils::evalOpParm(result, thissop, "pivot", cookparms.getCookTime(), 0);
876  return Pivot(result);
877  }
878  ViewportLOD getViewportLOD() const { return ViewportLOD(myViewportLOD); }
879  void setViewportLOD(ViewportLOD val) { myViewportLOD = int64(val); }
881  {
882  SOP_Node *thissop = cookparms.getNode();
883  if (!thissop) return getViewportLOD();
884  int64 result;
885  OP_Utils::evalOpParm(result, thissop, "viewportlod", cookparms.getCookTime(), 0);
886  return ViewportLOD(result);
887  }
888  bool getTransform() const { return myTransform; }
889  void setTransform(bool val) { myTransform = val; }
890  bool opTransform(const SOP_NodeVerb::CookParms &cookparms) const
891  {
892  SOP_Node *thissop = cookparms.getNode();
893  if (!thissop) return getTransform();
894  bool result;
895  OP_Utils::evalOpParm(result, thissop, "transform", cookparms.getCookTime(), 0);
896  return result;
897  }
898  bool getUseImplicitN() const { return myUseImplicitN; }
899  void setUseImplicitN(bool val) { myUseImplicitN = val; }
900  bool opUseImplicitN(const SOP_NodeVerb::CookParms &cookparms) const
901  {
902  SOP_Node *thissop = cookparms.getNode();
903  if (!thissop) return getUseImplicitN();
904  bool result;
905  OP_Utils::evalOpParm(result, thissop, "useimplicitn", cookparms.getCookTime(), 0);
906  return result;
907  }
908  const UT_Array<TargetAttribs> &getTargetAttribs() const { return myTargetAttribs; }
909 void setTargetAttribs(const UT_Array<TargetAttribs> &val) { myTargetAttribs = val; }
911  {
912  SOP_Node *thissop = cookparms.getNode();
913  if (!thissop) return getTargetAttribs().entries();
914  exint result;
915  OP_Utils::evalOpParm(result, thissop, "targetattribs", cookparms.getCookTime(), 0);
916  return result;
917  }
918  bool opTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
919  { return opinstTargetAttribs_useapply(cookparms, &_idx); }
920  bool opinstTargetAttribs_useapply(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
921  {
922  SOP_Node *thissop = cookparms.getNode();
923  if (!thissop) return (myTargetAttribs(_idx[0]).useapply);
924  int _parmidx[2-1];
925  _parmidx[1-1] = _idx[1-1] + 1;
926 
927  bool result;
928  OP_Utils::evalOpParmInst(result, thissop, "useapply#", _parmidx, cookparms.getCookTime(), 0, 2-1);
929  return (result);
930  }
931  int64 opTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
932  { return opinstTargetAttribs_applyto(cookparms, &_idx); }
933  int64 opinstTargetAttribs_applyto(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
934  {
935  SOP_Node *thissop = cookparms.getNode();
936  if (!thissop) return (myTargetAttribs(_idx[0]).applyto);
937  int _parmidx[2-1];
938  _parmidx[1-1] = _idx[1-1] + 1;
939 
940  int64 result;
941  OP_Utils::evalOpParmInst(result, thissop, "applyto#", _parmidx, cookparms.getCookTime(), 0, 2-1);
942  return (result);
943  }
945  { return opinstTargetAttribs_applymethod(cookparms, &_idx); }
946  int64 opinstTargetAttribs_applymethod(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
947  {
948  SOP_Node *thissop = cookparms.getNode();
949  if (!thissop) return (myTargetAttribs(_idx[0]).applymethod);
950  int _parmidx[2-1];
951  _parmidx[1-1] = _idx[1-1] + 1;
952 
953  int64 result;
954  OP_Utils::evalOpParmInst(result, thissop, "applymethod#", _parmidx, cookparms.getCookTime(), 0, 2-1);
955  return (result);
956  }
958  { return opinstTargetAttribs_applyattribs(cookparms, &_idx); }
960  {
961  SOP_Node *thissop = cookparms.getNode();
962  if (!thissop) return (myTargetAttribs(_idx[0]).applyattribs);
963  int _parmidx[2-1];
964  _parmidx[1-1] = _idx[1-1] + 1;
965 
967  OP_Utils::evalOpParmInst(result, thissop, "applyattribs#", _parmidx, cookparms.getCookTime(), 0, 2-1);
968  return (result);
969  }
970 
971 
972 private:
973  UT_StringHolder mySourceGroup;
974  int64 mySourceGroupType;
975  UT_StringHolder myTargetGroup;
976  bool myUseIDAttrib;
977  UT_StringHolder myIDAttrib;
978  bool myPack;
979  int64 myPivot;
980  int64 myViewportLOD;
981  bool myTransform;
982  bool myUseImplicitN;
983  UT_Array<TargetAttribs> myTargetAttribs;
984 
985 };
type
Definition: core.h:556
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:63
static void saveData(std::ostream &os, UT_Matrix3D v)
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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:622
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
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:303
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:655
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:278
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:96
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
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
#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:372
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:1401
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
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
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
static void loadData(UT_IStream &is, UT_Vector4I &v)
bool operator==(const SOP_CopyToPoints_2_0Parms &src) const
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