HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Add.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_NodeVerb.h>
7 #include <SOP/SOP_GraphProxy.h>
8 
9 #include <OP/OP_Utils.h>
10 #include <PRM/PRM_Parm.h>
11 #include <UT/UT_IStream.h>
12 #include <UT/UT_NTStreamUtil.h>
13 #include <UT/UT_Ramp.h>
14 #include <UT/UT_SharedPtr.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringStream.h>
17 #include <UT/UT_VectorTypes.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 namespace SOP_AddEnums
24 {
25  enum class Add
26  {
27  ALL = 0,
28  GROUP,
29  SKIP,
30  SEP,
31  ATTRIBUTE
32  };
33 }
34 
35 
37 {
38 public:
39  static int version() { return 1; }
40  struct Points
41  {
42  bool usept;
45 
46 
48  {
49  usept = false;
50  pt = UT_Vector3D(0,0,0);
51  weight = 1;
52 
53  }
54 
55  bool operator==(const Points &src) const
56  {
57  if (usept != src.usept) return false;
58  if (pt != src.pt) return false;
59  if (weight != src.weight) return false;
60 
61  return true;
62  }
63  bool operator!=(const Points &src) const
64  {
65  return !operator==(src);
66  }
67 
68  };
69 
71  {
73 
74  buf.strcat("[ ");
75  for (int i = 0; i < list.entries(); i++)
76  {
77  if (i)
78  buf.strcat(", ");
79  buf.strcat("( ");
80  buf.append("");
81  buf.appendSprintf("%s", (list(i).usept) ? "true" : "false");
82  buf.append(", ");
83  buf.appendSprintf("(%f, %f, %f)", list(i).pt.x(), list(i).pt.y(), list(i).pt.z());
84  buf.append(", ");
85  buf.appendSprintf("%f", (list(i).weight));
86 
87  buf.strcat(" )");
88  }
89  buf.strcat(" ]");
90 
92  return result;
93  }
94  struct Prims
95  {
97  bool closed;
98 
99 
101  {
102  prim = ""_sh;
103  closed = false;
104 
105  }
106 
107  bool operator==(const Prims &src) const
108  {
109  if (prim != src.prim) return false;
110  if (closed != src.closed) return false;
111 
112  return true;
113  }
114  bool operator!=(const Prims &src) const
115  {
116  return !operator==(src);
117  }
118 
119  };
120 
122  {
124 
125  buf.strcat("[ ");
126  for (int i = 0; i < list.entries(); i++)
127  {
128  if (i)
129  buf.strcat(", ");
130  buf.strcat("( ");
131  buf.append("");
132  { UT_String tmp; tmp = UT_StringWrap(list(i).prim).makeQuotedString('"'); buf.strcat(tmp); }
133  buf.append(", ");
134  buf.appendSprintf("%s", (list(i).closed) ? "true" : "false");
135 
136  buf.strcat(" )");
137  }
138  buf.strcat(" ]");
139 
141  return result;
142  }
143 
145  {
146  myKeep = false;
147  myRemove = false;
148  mySwitcher = 0;
149  myGroup = ""_sh;
150  myAdd = 0;
151  myInc = 2;
152  myAttrname = ""_sh;
153  myClosedall = false;
154  myAddparticlesystem = false;
155  myParticlegroup = ""_sh;
156  myAppendunusedtoparticlesystem = false;
157 
158  }
159 
160  explicit SOP_AddParms(const SOP_AddParms &) = default;
161 
162  ~SOP_AddParms() override {}
163 
164  bool operator==(const SOP_AddParms &src) const
165  {
166  if (myKeep != src.myKeep) return false;
167  if (myPoints != src.myPoints) return false;
168  if (myRemove != src.myRemove) return false;
169  if (myPrims != src.myPrims) return false;
170  if (mySwitcher != src.mySwitcher) return false;
171  if (myGroup != src.myGroup) return false;
172  if (myAdd != src.myAdd) return false;
173  if (myInc != src.myInc) return false;
174  if (myAttrname != src.myAttrname) return false;
175  if (myClosedall != src.myClosedall) return false;
176  if (myAddparticlesystem != src.myAddparticlesystem) return false;
177  if (myParticlegroup != src.myParticlegroup) return false;
178  if (myAppendunusedtoparticlesystem != src.myAppendunusedtoparticlesystem) return false;
179 
180  return true;
181  }
182  bool operator!=(const SOP_AddParms &src) const
183  {
184  return !operator==(src);
185  }
187 
188 
189 
190  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
191  {
192  myKeep = false;
193  if (true && ( (!((((graph->getInput(nodeidx,0)>=0)==0)))) ) )
194  graph->evalOpParm(myKeep, nodeidx, "keep", time, 0);
195  if (true)
196  {
197  int64 length = 0;
198  graph->evalOpParm(length, nodeidx, "points", time, 0);
199  myPoints.entries(length);
200  for (exint i = 0; i < length; i++)
201  {
202  int parmidx = i+0;
203  auto && _curentry = myPoints(i);
204  (void) _curentry;
205  myPoints(i).usept = false;
206  if (true)
207  graph->evalOpParmInst(myPoints(i).usept, nodeidx, "usept#", &parmidx, time, 0);
208  myPoints(i).pt = UT_Vector3D(0,0,0);
209  if (true && ( (!(((_curentry.usept==0)))) ) )
210  graph->evalOpParmInst(myPoints(i).pt, nodeidx, "pt#", &parmidx, time, 0);
211  myPoints(i).weight = 1;
212  if (true && ( (!(((_curentry.usept==0)))) ) )
213  graph->evalOpParmInst(myPoints(i).weight, nodeidx, "weight#", &parmidx, time, 0);
214 
215  }
216  }
217  else
218  myPoints.clear();
219  myRemove = false;
220  if (true)
221  graph->evalOpParm(myRemove, nodeidx, "remove", time, 0);
222  if (true)
223  {
224  int64 length = 0;
225  graph->evalOpParm(length, nodeidx, "prims", time, 0);
226  myPrims.entries(length);
227  for (exint i = 0; i < length; i++)
228  {
229  int parmidx = i+0;
230  auto && _curentry = myPrims(i);
231  (void) _curentry;
232  myPrims(i).prim = ""_sh;
233  if (true)
234  graph->evalOpParmInst(myPrims(i).prim, nodeidx, "prim#", &parmidx, time, 0);
235  myPrims(i).closed = false;
236  if (true)
237  graph->evalOpParmInst(myPrims(i).closed, nodeidx, "closed#", &parmidx, time, 0);
238 
239  }
240  }
241  else
242  myPrims.clear();
243  mySwitcher = 0;
244  if (true)
245  graph->evalOpParm(mySwitcher, nodeidx, "switcher", time, 0);
246  myGroup = ""_sh;
247  if (true)
248  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
249  myAdd = 0;
250  if (true)
251  graph->evalOpParm(myAdd, nodeidx, "add", time, 0);
252  myInc = 2;
253  if (true && ( (!(((int64(getAdd())==0))||((int64(getAdd())==3))||((int64(getAdd())==4)))) ) )
254  graph->evalOpParm(myInc, nodeidx, "inc", time, 0);
255  myAttrname = ""_sh;
256  if (true && ( (!(((int64(getAdd())!=4)))) ) )
257  graph->evalOpParm(myAttrname, nodeidx, "attrname", time, 0);
258  myClosedall = false;
259  if (true)
260  graph->evalOpParm(myClosedall, nodeidx, "closedall", time, 0);
261  myAddparticlesystem = false;
262  if (true)
263  graph->evalOpParm(myAddparticlesystem, nodeidx, "addparticlesystem", time, 0);
264  myParticlegroup = ""_sh;
265  if (true && ( (!(((getAddparticlesystem()==0)))) ) )
266  graph->evalOpParm(myParticlegroup, nodeidx, "particlegroup", time, 0);
267  myAppendunusedtoparticlesystem = false;
268  if (true)
269  graph->evalOpParm(myAppendunusedtoparticlesystem, nodeidx, "appendunusedtoparticlesystem", time, 0);
270 
271  }
272 
273 
274  void loadFromOpSubclass(const LoadParms &loadparms) override
275  {
276  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
277  }
278 
279 
280  void copyFrom(const SOP_NodeParms *src) override
281  {
282  *this = *((const SOP_AddParms *)src);
283  }
284 
285  template <typename T>
286  void
287  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
288  {
289  if (idx.size() < 1)
290  return;
291  UT_ASSERT(idx.size() == instance.size()+1);
292  if (idx.size() != instance.size()+1)
293  return;
294  switch (idx[0])
295  {
296  case 0:
297  coerceValue(value, myKeep);
298  break;
299  case 1:
300  if (idx.size() == 1)
301  coerceValue(value, myPoints.entries());
302  else if (instance[0] < myPoints.entries())
303  {
304  auto && _data = myPoints(instance[0]);
305  switch (idx[1])
306  {
307  case 0:
308  coerceValue(value, _data.usept);
309  break;
310  case 1:
311  coerceValue(value, _data.pt);
312  break;
313  case 2:
314  coerceValue(value, _data.weight);
315  break;
316 
317  }
318  }
319  break;
320  case 2:
321  coerceValue(value, myRemove);
322  break;
323  case 3:
324  if (idx.size() == 1)
325  coerceValue(value, myPrims.entries());
326  else if (instance[0] < myPrims.entries())
327  {
328  auto && _data = myPrims(instance[0]);
329  switch (idx[1])
330  {
331  case 0:
332  coerceValue(value, _data.prim);
333  break;
334  case 1:
335  coerceValue(value, _data.closed);
336  break;
337 
338  }
339  }
340  break;
341  case 4:
342  coerceValue(value, mySwitcher);
343  break;
344  case 5:
345  coerceValue(value, myGroup);
346  break;
347  case 6:
348  coerceValue(value, myAdd);
349  break;
350  case 7:
351  coerceValue(value, myInc);
352  break;
353  case 8:
354  coerceValue(value, myAttrname);
355  break;
356  case 9:
357  coerceValue(value, myClosedall);
358  break;
359  case 10:
360  coerceValue(value, myAddparticlesystem);
361  break;
362  case 11:
363  coerceValue(value, myParticlegroup);
364  break;
365  case 12:
366  coerceValue(value, myAppendunusedtoparticlesystem);
367  break;
368 
369  }
370  }
371 
372  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
373  { doGetParmValue(idx, instance, value); }
374  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
375  { doGetParmValue(idx, instance, value); }
376  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
377  { doGetParmValue(idx, instance, value); }
378  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
379  { doGetParmValue(idx, instance, value); }
380  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
381  { doGetParmValue(idx, instance, value); }
382  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
383  { doGetParmValue(idx, instance, value); }
384  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
385  { doGetParmValue(idx, instance, value); }
386  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
387  { doGetParmValue(idx, instance, value); }
388  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
389  { doGetParmValue(idx, instance, value); }
390  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
391  { doGetParmValue(idx, instance, value); }
392  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
393  { doGetParmValue(idx, instance, value); }
394 
395  template <typename T>
396  void
397  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
398  {
399  if (idx.size() < 1)
400  return;
401  UT_ASSERT(idx.size() == instance.size()+1);
402  if (idx.size() != instance.size()+1)
403  return;
404  switch (idx[0])
405  {
406  case 0:
407  coerceValue(myKeep, value);
408  break;
409  case 1:
410  if (idx.size() == 1)
411  {
412  exint newsize;
413  coerceValue(newsize, value);
414  myPoints.setSize(newsize);
415  }
416  else
417  {
418  myPoints.setSizeIfNeeded(instance[0]+1);
419  auto && _data = myPoints(instance[0]);
420  switch (idx[1])
421  {
422  case 0:
423  coerceValue(_data.usept, value);
424  break;
425  case 1:
426  coerceValue(_data.pt, value);
427  break;
428  case 2:
429  coerceValue(_data.weight, value);
430  break;
431 
432  }
433  }
434  break;
435  case 2:
436  coerceValue(myRemove, value);
437  break;
438  case 3:
439  if (idx.size() == 1)
440  {
441  exint newsize;
442  coerceValue(newsize, value);
443  myPrims.setSize(newsize);
444  }
445  else
446  {
447  myPrims.setSizeIfNeeded(instance[0]+1);
448  auto && _data = myPrims(instance[0]);
449  switch (idx[1])
450  {
451  case 0:
452  coerceValue(_data.prim, value);
453  break;
454  case 1:
455  coerceValue(_data.closed, value);
456  break;
457 
458  }
459  }
460  break;
461  case 4:
462  coerceValue(mySwitcher, value);
463  break;
464  case 5:
465  coerceValue(myGroup, value);
466  break;
467  case 6:
468  coerceValue(myAdd, value);
469  break;
470  case 7:
471  coerceValue(myInc, value);
472  break;
473  case 8:
474  coerceValue(myAttrname, value);
475  break;
476  case 9:
477  coerceValue(myClosedall, value);
478  break;
479  case 10:
480  coerceValue(myAddparticlesystem, value);
481  break;
482  case 11:
483  coerceValue(myParticlegroup, value);
484  break;
485  case 12:
486  coerceValue(myAppendunusedtoparticlesystem, 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 13;
519  switch (idx[0])
520  {
521  case 1:
522  return 3;
523  case 3:
524  return 2;
525 
526  }
527  // Invalid
528  return 0;
529  }
530 
531  const char *getNestParmName(TempIndex fieldnum) const override
532  {
533  if (fieldnum.size() < 1)
534  return 0;
535  switch (fieldnum[0])
536  {
537  case 0:
538  return "keep";
539  case 1:
540  if (fieldnum.size() == 1)
541  return "points";
542  switch (fieldnum[1])
543  {
544  case 0:
545  return "usept#";
546  case 1:
547  return "pt#";
548  case 2:
549  return "weight#";
550 
551  }
552  return 0;
553  case 2:
554  return "remove";
555  case 3:
556  if (fieldnum.size() == 1)
557  return "prims";
558  switch (fieldnum[1])
559  {
560  case 0:
561  return "prim#";
562  case 1:
563  return "closed#";
564 
565  }
566  return 0;
567  case 4:
568  return "switcher";
569  case 5:
570  return "group";
571  case 6:
572  return "add";
573  case 7:
574  return "inc";
575  case 8:
576  return "attrname";
577  case 9:
578  return "closedall";
579  case 10:
580  return "addparticlesystem";
581  case 11:
582  return "particlegroup";
583  case 12:
584  return "appendunusedtoparticlesystem";
585 
586  }
587  return 0;
588  }
589 
590  ParmType getNestParmType(TempIndex fieldnum) const override
591  {
592  if (fieldnum.size() < 1)
593  return PARM_UNSUPPORTED;
594  switch (fieldnum[0])
595  {
596  case 0:
597  return PARM_INTEGER;
598  case 1:
599  if (fieldnum.size() == 1)
600  return PARM_MULTIPARM;
601  switch (fieldnum[1])
602  {
603  case 0:
604  return PARM_INTEGER;
605  case 1:
606  return PARM_VECTOR3;
607  case 2:
608  return PARM_FLOAT;
609 
610  }
611  return PARM_UNSUPPORTED;
612  case 2:
613  return PARM_INTEGER;
614  case 3:
615  if (fieldnum.size() == 1)
616  return PARM_MULTIPARM;
617  switch (fieldnum[1])
618  {
619  case 0:
620  return PARM_STRING;
621  case 1:
622  return PARM_INTEGER;
623 
624  }
625  return PARM_UNSUPPORTED;
626  case 4:
627  return PARM_INTEGER;
628  case 5:
629  return PARM_STRING;
630  case 6:
631  return PARM_INTEGER;
632  case 7:
633  return PARM_INTEGER;
634  case 8:
635  return PARM_STRING;
636  case 9:
637  return PARM_INTEGER;
638  case 10:
639  return PARM_INTEGER;
640  case 11:
641  return PARM_STRING;
642  case 12:
643  return PARM_INTEGER;
644 
645  }
646  return PARM_UNSUPPORTED;
647  }
648 
649  // Boiler plate to load individual types.
650  static void loadData(UT_IStream &is, int64 &v)
651  { is.bread(&v, 1); }
652  static void loadData(UT_IStream &is, bool &v)
653  { int64 iv; is.bread(&iv, 1); v = iv; }
654  static void loadData(UT_IStream &is, fpreal64 &v)
655  { is.bread<fpreal64>(&v, 1); }
656  static void loadData(UT_IStream &is, UT_Vector2D &v)
657  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
658  static void loadData(UT_IStream &is, UT_Vector3D &v)
659  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
660  is.bread<fpreal64>(&v.z(), 1); }
661  static void loadData(UT_IStream &is, UT_Vector4D &v)
662  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
663  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
664  static void loadData(UT_IStream &is, UT_Matrix2D &v)
665  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
666  static void loadData(UT_IStream &is, UT_Matrix3D &v)
667  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
668  static void loadData(UT_IStream &is, UT_Matrix4D &v)
669  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
670  static void loadData(UT_IStream &is, UT_Vector2I &v)
671  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
672  static void loadData(UT_IStream &is, UT_Vector3I &v)
673  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
674  is.bread<int64>(&v.z(), 1); }
675  static void loadData(UT_IStream &is, UT_Vector4I &v)
676  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
677  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
679  { is.bread(v); }
681  { UT_StringHolder rampdata;
682  loadData(is, rampdata);
683  if (rampdata.isstring())
684  {
685  v.reset(new UT_Ramp());
686  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
687  v->load(istr);
688  }
689  else v.reset();
690  }
693  loadData(is, data);
694  if (data.isstring())
695  {
696  // Find the data type.
697  const char *colon = UT_StringWrap(data).findChar(':');
698  if (colon)
699  {
700  int typelen = colon - data.buffer();
702  type.strncpy(data.buffer(), typelen);
703  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
704 
705  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
706  }
707  }
708  else v.reset();
709  }
710 
711  static void saveData(std::ostream &os, int64 v)
712  { UTwrite(os, &v); }
713  static void saveData(std::ostream &os, bool v)
714  { int64 iv = v; UTwrite(os, &iv); }
715  static void saveData(std::ostream &os, fpreal64 v)
716  { UTwrite<fpreal64>(os, &v); }
717  static void saveData(std::ostream &os, UT_Vector2D v)
718  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
719  static void saveData(std::ostream &os, UT_Vector3D v)
720  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
721  UTwrite<fpreal64>(os, &v.z()); }
722  static void saveData(std::ostream &os, UT_Vector4D v)
723  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
724  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
725  static void saveData(std::ostream &os, UT_Matrix2D v)
727  static void saveData(std::ostream &os, UT_Matrix3D v)
729  static void saveData(std::ostream &os, UT_Matrix4D v)
731  static void saveData(std::ostream &os, UT_StringHolder s)
732  { UT_StringWrap(s).saveBinary(os); }
733  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
735  UT_OStringStream ostr;
736  if (s) s->save(ostr);
737  result = ostr.str();
738  saveData(os, result);
739  }
740  static void saveData(std::ostream &os, PRM_DataItemHandle s)
742  UT_OStringStream ostr;
743  if (s)
744  {
745  ostr << s->getDataTypeToken();
746  ostr << ":";
747  s->saveBinary(ostr);
748  }
749  result = ostr.str();
750  saveData(os, result);
751  }
752 
753 
754  void save(std::ostream &os) const
755  {
756  int32 v = version();
757  UTwrite(os, &v);
758  saveData(os, myKeep);
759  {
760  int64 length = myPoints.entries();
761  UTwrite(os, &length);
762  for (exint i = 0; i < length; i++)
763  {
764  saveData(os, myPoints(i).usept);
765  saveData(os, myPoints(i).pt);
766  saveData(os, myPoints(i).weight);
767 
768  }
769  }
770  saveData(os, myRemove);
771  {
772  int64 length = myPrims.entries();
773  UTwrite(os, &length);
774  for (exint i = 0; i < length; i++)
775  {
776  saveData(os, myPrims(i).prim);
777  saveData(os, myPrims(i).closed);
778 
779  }
780  }
781  saveData(os, mySwitcher);
782  saveData(os, myGroup);
783  saveData(os, myAdd);
784  saveData(os, myInc);
785  saveData(os, myAttrname);
786  saveData(os, myClosedall);
787  saveData(os, myAddparticlesystem);
788  saveData(os, myParticlegroup);
789  saveData(os, myAppendunusedtoparticlesystem);
790 
791  }
792 
793  bool load(UT_IStream &is)
794  {
795  int32 v;
796  is.bread(&v, 1);
797  if (version() != v)
798  {
799  // Fail incompatible versions
800  return false;
801  }
802  loadData(is, myKeep);
803  {
804  int64 length;
805  is.read(&length, 1);
806  myPoints.entries(length);
807  for (exint i = 0; i < length; i++)
808  {
809  loadData(is, myPoints(i).usept);
810  loadData(is, myPoints(i).pt);
811  loadData(is, myPoints(i).weight);
812 
813  }
814  }
815  loadData(is, myRemove);
816  {
817  int64 length;
818  is.read(&length, 1);
819  myPrims.entries(length);
820  for (exint i = 0; i < length; i++)
821  {
822  loadData(is, myPrims(i).prim);
823  loadData(is, myPrims(i).closed);
824 
825  }
826  }
827  loadData(is, mySwitcher);
828  loadData(is, myGroup);
829  loadData(is, myAdd);
830  loadData(is, myInc);
831  loadData(is, myAttrname);
832  loadData(is, myClosedall);
833  loadData(is, myAddparticlesystem);
834  loadData(is, myParticlegroup);
835  loadData(is, myAppendunusedtoparticlesystem);
836 
837  return true;
838  }
839 
840  bool getKeep() const { return myKeep; }
841  void setKeep(bool val) { myKeep = val; }
842  bool opKeep(const SOP_NodeVerb::CookParms &cookparms) const
843  {
844  SOP_Node *thissop = cookparms.getNode();
845  if (!thissop) return getKeep();
846  bool result;
847  OP_Utils::evalOpParm(result, thissop, "keep", cookparms.getCookTime(), 0);
848  return result;
849  }
850  const UT_Array<Points> &getPoints() const { return myPoints; }
851  void setPoints(const UT_Array<Points> &val) { myPoints = val; }
852  exint opPoints(const SOP_NodeVerb::CookParms &cookparms) const
853  {
854  SOP_Node *thissop = cookparms.getNode();
855  if (!thissop) return getPoints().entries();
856  exint result;
857  OP_Utils::evalOpParm(result, thissop, "points", cookparms.getCookTime(), 0);
858  return result;
859  }
860  bool opPoints_usept(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
861  {
862  SOP_Node *thissop = cookparms.getNode();
863  if (!thissop) return (myPoints(_idx).usept);
864  int _parmidx = _idx + 0;
865  bool result;
866  OP_Utils::evalOpParmInst(result, thissop, "usept#", &_parmidx, cookparms.getCookTime(), 0);
867  return (result);
868  }
869  UT_Vector3D opPoints_pt(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
870  {
871  SOP_Node *thissop = cookparms.getNode();
872  if (!thissop) return (myPoints(_idx).pt);
873  int _parmidx = _idx + 0;
875  OP_Utils::evalOpParmInst(result, thissop, "pt#", &_parmidx, cookparms.getCookTime(), 0);
876  return (result);
877  }
879  {
880  SOP_Node *thissop = cookparms.getNode();
881  if (!thissop) return (myPoints(_idx).weight);
882  int _parmidx = _idx + 0;
884  OP_Utils::evalOpParmInst(result, thissop, "weight#", &_parmidx, cookparms.getCookTime(), 0);
885  return (result);
886  }
887 
888  bool getRemove() const { return myRemove; }
889  void setRemove(bool val) { myRemove = val; }
890  bool opRemove(const SOP_NodeVerb::CookParms &cookparms) const
891  {
892  SOP_Node *thissop = cookparms.getNode();
893  if (!thissop) return getRemove();
894  bool result;
895  OP_Utils::evalOpParm(result, thissop, "remove", cookparms.getCookTime(), 0);
896  return result;
897  }
898  const UT_Array<Prims> &getPrims() const { return myPrims; }
899  void setPrims(const UT_Array<Prims> &val) { myPrims = val; }
900  exint opPrims(const SOP_NodeVerb::CookParms &cookparms) const
901  {
902  SOP_Node *thissop = cookparms.getNode();
903  if (!thissop) return getPrims().entries();
904  exint result;
905  OP_Utils::evalOpParm(result, thissop, "prims", cookparms.getCookTime(), 0);
906  return result;
907  }
909  {
910  SOP_Node *thissop = cookparms.getNode();
911  if (!thissop) return (myPrims(_idx).prim);
912  int _parmidx = _idx + 0;
914  OP_Utils::evalOpParmInst(result, thissop, "prim#", &_parmidx, cookparms.getCookTime(), 0);
915  return (result);
916  }
917  bool opPrims_closed(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
918  {
919  SOP_Node *thissop = cookparms.getNode();
920  if (!thissop) return (myPrims(_idx).closed);
921  int _parmidx = _idx + 0;
922  bool result;
923  OP_Utils::evalOpParmInst(result, thissop, "closed#", &_parmidx, cookparms.getCookTime(), 0);
924  return (result);
925  }
926 
927  int64 getSwitcher() const { return mySwitcher; }
928  void setSwitcher(int64 val) { mySwitcher = val; }
929  int64 opSwitcher(const SOP_NodeVerb::CookParms &cookparms) const
930  {
931  SOP_Node *thissop = cookparms.getNode();
932  if (!thissop) return getSwitcher();
933  int64 result;
934  OP_Utils::evalOpParm(result, thissop, "switcher", cookparms.getCookTime(), 0);
935  return result;
936  }
937  const UT_StringHolder & getGroup() const { return myGroup; }
938  void setGroup(const UT_StringHolder & val) { myGroup = val; }
940  {
941  SOP_Node *thissop = cookparms.getNode();
942  if (!thissop) return getGroup();
944  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
945  return result;
946  }
947  Add getAdd() const { return Add(myAdd); }
948  void setAdd(Add val) { myAdd = int64(val); }
949  Add opAdd(const SOP_NodeVerb::CookParms &cookparms) const
950  {
951  SOP_Node *thissop = cookparms.getNode();
952  if (!thissop) return getAdd();
953  int64 result;
954  OP_Utils::evalOpParm(result, thissop, "add", cookparms.getCookTime(), 0);
955  return Add(result);
956  }
957  int64 getInc() const { return myInc; }
958  void setInc(int64 val) { myInc = val; }
959  int64 opInc(const SOP_NodeVerb::CookParms &cookparms) const
960  {
961  SOP_Node *thissop = cookparms.getNode();
962  if (!thissop) return getInc();
963  int64 result;
964  OP_Utils::evalOpParm(result, thissop, "inc", cookparms.getCookTime(), 0);
965  return result;
966  }
967  const UT_StringHolder & getAttrname() const { return myAttrname; }
968  void setAttrname(const UT_StringHolder & val) { myAttrname = val; }
970  {
971  SOP_Node *thissop = cookparms.getNode();
972  if (!thissop) return getAttrname();
974  OP_Utils::evalOpParm(result, thissop, "attrname", cookparms.getCookTime(), 0);
975  return result;
976  }
977  bool getClosedall() const { return myClosedall; }
978  void setClosedall(bool val) { myClosedall = val; }
979  bool opClosedall(const SOP_NodeVerb::CookParms &cookparms) const
980  {
981  SOP_Node *thissop = cookparms.getNode();
982  if (!thissop) return getClosedall();
983  bool result;
984  OP_Utils::evalOpParm(result, thissop, "closedall", cookparms.getCookTime(), 0);
985  return result;
986  }
987  bool getAddparticlesystem() const { return myAddparticlesystem; }
988  void setAddparticlesystem(bool val) { myAddparticlesystem = val; }
989  bool opAddparticlesystem(const SOP_NodeVerb::CookParms &cookparms) const
990  {
991  SOP_Node *thissop = cookparms.getNode();
992  if (!thissop) return getAddparticlesystem();
993  bool result;
994  OP_Utils::evalOpParm(result, thissop, "addparticlesystem", cookparms.getCookTime(), 0);
995  return result;
996  }
997  const UT_StringHolder & getParticlegroup() const { return myParticlegroup; }
998  void setParticlegroup(const UT_StringHolder & val) { myParticlegroup = val; }
1000  {
1001  SOP_Node *thissop = cookparms.getNode();
1002  if (!thissop) return getParticlegroup();
1004  OP_Utils::evalOpParm(result, thissop, "particlegroup", cookparms.getCookTime(), 0);
1005  return result;
1006  }
1007  bool getAppendunusedtoparticlesystem() const { return myAppendunusedtoparticlesystem; }
1008  void setAppendunusedtoparticlesystem(bool val) { myAppendunusedtoparticlesystem = val; }
1010  {
1011  SOP_Node *thissop = cookparms.getNode();
1012  if (!thissop) return getAppendunusedtoparticlesystem();
1013  bool result;
1014  OP_Utils::evalOpParm(result, thissop, "appendunusedtoparticlesystem", cookparms.getCookTime(), 0);
1015  return result;
1016  }
1017 
1018 private:
1019  bool myKeep;
1020  UT_Array<Points> myPoints;
1021  bool myRemove;
1022  UT_Array<Prims> myPrims;
1023  int64 mySwitcher;
1024  UT_StringHolder myGroup;
1025  int64 myAdd;
1026  int64 myInc;
1027  UT_StringHolder myAttrname;
1028  bool myClosedall;
1029  bool myAddparticlesystem;
1030  UT_StringHolder myParticlegroup;
1031  bool myAppendunusedtoparticlesystem;
1032 
1033 };
GLdouble s
Definition: glew.h:1390
const UT_StringHolder & getGroup() const
bool operator==(const SOP_AddParms &src) const
bool opClosedall(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const Prims &src) const
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
Add getAdd() const
const UT_StringHolder & getParticlegroup() const
fpreal64 opPoints_weight(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GLenum src
Definition: glew.h:2410
static void saveData(std::ostream &os, UT_Matrix3D v)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
const UT_StringHolder & getAttrname() const
static void saveData(std::ostream &os, UT_Matrix2D v)
UT_StringHolder prim
Definition: SOP_Add.proto.h:96
const char * getNestParmName(TempIndex fieldnum) const override
bool opKeep(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
bool operator!=(const SOP_AddParms &src) const
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, int *inst, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
virtual NodeIdx getInput(NodeIdx idx, int input, bool markused=false) const =0
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
bool opPoints_usept(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
fpreal getTime() const
Definition: OP_Context.h:60
GLuint const GLfloat * val
Definition: glew.h:2794
GLuint GLuint GLfloat weight
Definition: glew.h:13609
static void loadData(UT_IStream &is, UT_Vector4I &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
void setSwitcher(int64 val)
void setClosedall(bool val)
int64 exint
Definition: SYS_Types.h:125
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, UT_StringHolder &v)
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setPrims(const UT_Array< Prims > &val)
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, UT_Vector4D v)
bool getRemove() const
const GLdouble * v
Definition: glew.h:1391
void setAdd(Add val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void saveData(std::ostream &os, UT_StringHolder s)
void setParticlegroup(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
UT_StringHolder createString(const UT_Array< Prims > &list) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
double fpreal64
Definition: SYS_Types.h:201
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, int64 &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
exint length() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
SYS_FORCE_INLINE const char * buffer() const
bool operator==(const Points &src) const
Definition: SOP_Add.proto.h:55
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
bool getAppendunusedtoparticlesystem() const
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
bool opAddparticlesystem(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
void
Definition: png.h:1083
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
exint opPoints(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
ParmType getNestParmType(TempIndex fieldnum) const override
const GLfloat * c
Definition: glew.h:16296
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
bool getKeep() const
exint opPrims(const SOP_NodeVerb::CookParms &cookparms) const
long long int64
Definition: SYS_Types.h:116
bool getAddparticlesystem() const
UT_Vector3T< fpreal64 > UT_Vector3D
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
~SOP_AddParms() override
bool opRemove(const SOP_NodeVerb::CookParms &cookparms) const
int64 opSwitcher(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector3D v)
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
exint getNestNumParms(TempIndex idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
static void loadData(UT_IStream &is, fpreal64 &v)
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:460
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
bool operator!=(const Points &src) const
Definition: SOP_Add.proto.h:63
void setInc(int64 val)
static void saveData(std::ostream &os, bool v)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
bool load(UT_IStream &is)
UT_StringHolder opAttrname(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const Prims &src) const
int64 getSwitcher() const
bool opPrims_closed(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opInc(const SOP_NodeVerb::CookParms &cookparms) const
void setAppendunusedtoparticlesystem(bool val)
fpreal64 fpreal
Definition: SYS_Types.h:277
void setGroup(const UT_StringHolder &val)
Add opAdd(const SOP_NodeVerb::CookParms &cookparms) const
bool getClosedall() const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, int64 v)
const UT_Array< Points > & getPoints() const
SYS_FORCE_INLINE void append(char character)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, bool &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
int64 getInc() const
#define SOP_API
Definition: SOP_API.h:10
static int version()
Definition: SOP_Add.proto.h:39
const UT_Array< Prims > & getPrims() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void loadData(UT_IStream &is, UT_Vector3I &v)
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
void setPoints(const UT_Array< Points > &val)
void setAttrname(const UT_StringHolder &val)
GLuint64EXT * result
Definition: glew.h:14007
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void copyFrom(const SOP_NodeParms *src) override
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
void setAddparticlesystem(bool val)
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
static void saveData(std::ostream &os, PRM_DataItemHandle s)
UT_StringHolder opParticlegroup(const SOP_NodeVerb::CookParms &cookparms) const
GLsizei const GLfloat * value
Definition: glew.h:1849
UT_StringHolder opPrims_prim(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void save(std::ostream &os) const
bool opAppendunusedtoparticlesystem(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, UT_Vector2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
SYS_FORCE_INLINE bool isstring() const
UT_Vector3D opPoints_pt(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void loadFromOpSubclass(const LoadParms &loadparms) override
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
void setKeep(bool val)
UT_StringHolder createString(const UT_Array< Points > &list) const
Definition: SOP_Add.proto.h:70
void setRemove(bool val)