HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_GroupPromote.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_GroupPromoteEnums
24 {
25  enum class Fromtype
26  {
27  AUTO = 0,
28  PRIMS,
29  POINTS,
30  EDGES,
31  VERTICES
32  };
33  enum class Totype
34  {
35  PRIMS = 0,
36  POINTS,
37  EDGES,
38  VERTICES
39  };
40 }
41 
42 
44 {
45 public:
46  static int version() { return 1; }
47  struct Promotions
48  {
49  bool enable;
54  bool preserve;
60  bool onlyfull;
62  bool toattrib;
63 
64 
66  {
67  enable = true;
68  fromtype = 0;
69  totype = 1;
70  group = ""_sh;
71  newname = ""_sh;
72  preserve = false;
73  onlyboundary = false;
74  includeunshared = true;
75  useconnectivityattrib = false;
76  connectivityattrib = "uv"_sh;
77  primsbyattribbndpts = false;
78  onlyfull = false;
79  removedegen = false;
80  toattrib = false;
81 
82  }
83 
84  bool operator==(const Promotions &src) const
85  {
86  if (enable != src.enable) return false;
87  if (fromtype != src.fromtype) return false;
88  if (totype != src.totype) return false;
89  if (group != src.group) return false;
90  if (newname != src.newname) return false;
91  if (preserve != src.preserve) return false;
92  if (onlyboundary != src.onlyboundary) return false;
93  if (includeunshared != src.includeunshared) return false;
94  if (useconnectivityattrib != src.useconnectivityattrib) return false;
95  if (connectivityattrib != src.connectivityattrib) return false;
96  if (primsbyattribbndpts != src.primsbyattribbndpts) return false;
97  if (onlyfull != src.onlyfull) return false;
98  if (removedegen != src.removedegen) return false;
99  if (toattrib != src.toattrib) return false;
100 
101  return true;
102  }
103  bool operator!=(const Promotions &src) const
104  {
105  return !operator==(src);
106  }
107 
108  };
109 
111  {
113 
114  buf.strcat("[ ");
115  for (int i = 0; i < list.entries(); i++)
116  {
117  if (i)
118  buf.strcat(", ");
119  buf.strcat("( ");
120  buf.append("");
121  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
122  buf.append(", ");
123  buf.appendSprintf("%d", (int) list(i).fromtype);
124  buf.append(", ");
125  buf.appendSprintf("%d", (int) list(i).totype);
126  buf.append(", ");
127  { UT_String tmp; tmp = UT_StringWrap(list(i).group).makeQuotedString('"'); buf.strcat(tmp); }
128  buf.append(", ");
129  { UT_String tmp; tmp = UT_StringWrap(list(i).newname).makeQuotedString('"'); buf.strcat(tmp); }
130  buf.append(", ");
131  buf.appendSprintf("%s", (list(i).preserve) ? "true" : "false");
132  buf.append(", ");
133  buf.appendSprintf("%s", (list(i).onlyboundary) ? "true" : "false");
134  buf.append(", ");
135  buf.appendSprintf("%s", (list(i).includeunshared) ? "true" : "false");
136  buf.append(", ");
137  buf.appendSprintf("%s", (list(i).useconnectivityattrib) ? "true" : "false");
138  buf.append(", ");
139  { UT_String tmp; tmp = UT_StringWrap(list(i).connectivityattrib).makeQuotedString('"'); buf.strcat(tmp); }
140  buf.append(", ");
141  buf.appendSprintf("%s", (list(i).primsbyattribbndpts) ? "true" : "false");
142  buf.append(", ");
143  buf.appendSprintf("%s", (list(i).onlyfull) ? "true" : "false");
144  buf.append(", ");
145  buf.appendSprintf("%s", (list(i).removedegen) ? "true" : "false");
146  buf.append(", ");
147  buf.appendSprintf("%s", (list(i).toattrib) ? "true" : "false");
148 
149  buf.strcat(" )");
150  }
151  buf.strcat(" ]");
152 
154  return result;
155  }
156 
158  {
159 
160  }
161 
162  explicit SOP_GroupPromoteParms(const SOP_GroupPromoteParms &) = default;
163 
165 
167  {
168  if (myPromotions != src.myPromotions) return false;
169 
170  return true;
171  }
173  {
174  return !operator==(src);
175  }
178 
179 
180 
181  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
182  {
183  if (true)
184  {
185  int64 length = 0;
186  graph->evalOpParm(length, nodeidx, "promotions", time, 0);
187  myPromotions.entries(length);
188  for (exint i = 0; i < length; i++)
189  {
190  int parmidx = i+1;
191  auto && _curentry = myPromotions(i);
192  (void) _curentry;
193  myPromotions(i).enable = true;
194  if (true)
195  graph->evalOpParmInst(myPromotions(i).enable, nodeidx, "enable#", &parmidx, time, 0);
196  myPromotions(i).fromtype = 0;
197  if (true && ( (!(((_curentry.enable==0)))) ) )
198  graph->evalOpParmInst(myPromotions(i).fromtype, nodeidx, "fromtype#", &parmidx, time, 0);
199  myPromotions(i).totype = 1;
200  if (true && ( (!(((_curentry.enable==0)))) ) )
201  graph->evalOpParmInst(myPromotions(i).totype, nodeidx, "totype#", &parmidx, time, 0);
202  myPromotions(i).group = ""_sh;
203  if (true && ( (!(((_curentry.enable==0)))) ) )
204  graph->evalOpParmInst(myPromotions(i).group, nodeidx, "group#", &parmidx, time, 0);
205  myPromotions(i).newname = ""_sh;
206  if (true && ( (!(((_curentry.enable==0)))) ) )
207  graph->evalOpParmInst(myPromotions(i).newname, nodeidx, "newname#", &parmidx, time, 0);
208  myPromotions(i).preserve = false;
209  if (true && ( (!(((_curentry.enable==0)))) ) )
210  graph->evalOpParmInst(myPromotions(i).preserve, nodeidx, "preserve#", &parmidx, time, 0);
211  myPromotions(i).onlyboundary = false;
212  if (true && ( (!(((_curentry.enable==0)))) ) )
213  graph->evalOpParmInst(myPromotions(i).onlyboundary, nodeidx, "onlyboundary#", &parmidx, time, 0);
214  myPromotions(i).includeunshared = true;
215  if (true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
216  graph->evalOpParmInst(myPromotions(i).includeunshared, nodeidx, "includeunshared#", &parmidx, time, 0);
217  myPromotions(i).useconnectivityattrib = false;
218  if (true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
219  graph->evalOpParmInst(myPromotions(i).useconnectivityattrib, nodeidx, "useconnectivityattrib#", &parmidx, time, 0);
220  myPromotions(i).connectivityattrib = "uv"_sh;
221  if (true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.useconnectivityattrib==0)))) ) )
222  graph->evalOpParmInst(myPromotions(i).connectivityattrib, nodeidx, "connectivityattrib#", &parmidx, time, 0);
223  myPromotions(i).primsbyattribbndpts = false;
224  if (true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.totype!=0)))) ) )
225  graph->evalOpParmInst(myPromotions(i).primsbyattribbndpts, nodeidx, "primsbyattribbndpts#", &parmidx, time, 0);
226  myPromotions(i).onlyfull = false;
227  if (true && ( (!(((_curentry.enable==0))||((_curentry.totype==1))||((_curentry.onlyboundary==1)))) ) )
228  graph->evalOpParmInst(myPromotions(i).onlyfull, nodeidx, "onlyfull#", &parmidx, time, 0);
229  myPromotions(i).removedegen = false;
230  if (true && ( (!(((_curentry.enable==0))||((_curentry.totype==0)))) ) )
231  graph->evalOpParmInst(myPromotions(i).removedegen, nodeidx, "removedegen#", &parmidx, time, 0);
232  myPromotions(i).toattrib = false;
233  if (true && ( (!(((_curentry.enable==0))||((_curentry.totype==2)))) ) )
234  graph->evalOpParmInst(myPromotions(i).toattrib, nodeidx, "toattrib#", &parmidx, time, 0);
235 
236  }
237  }
238  else
239  myPromotions.clear();
240 
241  }
242 
243 
244  void loadFromOpSubclass(const LoadParms &loadparms) override
245  {
246  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
247  }
248 
249 
250  void copyFrom(const SOP_NodeParms *src) override
251  {
252  *this = *((const SOP_GroupPromoteParms *)src);
253  }
254 
255  template <typename T>
256  void
257  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
258  {
259  if (idx.size() < 1)
260  return;
261  UT_ASSERT(idx.size() == instance.size()+1);
262  if (idx.size() != instance.size()+1)
263  return;
264  switch (idx[0])
265  {
266  case 0:
267  if (idx.size() == 1)
268  coerceValue(value, myPromotions.entries());
269  else if (instance[0] < myPromotions.entries())
270  {
271  auto && _data = myPromotions(instance[0]);
272  switch (idx[1])
273  {
274  case 0:
275  coerceValue(value, _data.enable);
276  break;
277  case 1:
278  coerceValue(value, _data.fromtype);
279  break;
280  case 2:
281  coerceValue(value, _data.totype);
282  break;
283  case 3:
284  coerceValue(value, _data.group);
285  break;
286  case 4:
287  coerceValue(value, _data.newname);
288  break;
289  case 5:
290  coerceValue(value, _data.preserve);
291  break;
292  case 6:
293  coerceValue(value, _data.onlyboundary);
294  break;
295  case 7:
296  coerceValue(value, _data.includeunshared);
297  break;
298  case 8:
299  coerceValue(value, _data.useconnectivityattrib);
300  break;
301  case 9:
302  coerceValue(value, _data.connectivityattrib);
303  break;
304  case 10:
305  coerceValue(value, _data.primsbyattribbndpts);
306  break;
307  case 11:
308  coerceValue(value, _data.onlyfull);
309  break;
310  case 12:
311  coerceValue(value, _data.removedegen);
312  break;
313  case 13:
314  coerceValue(value, _data.toattrib);
315  break;
316 
317  }
318  }
319  break;
320 
321  }
322  }
323 
324  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
325  { doGetParmValue(idx, instance, value); }
326  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
327  { doGetParmValue(idx, instance, value); }
328  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
329  { doGetParmValue(idx, instance, value); }
330  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
331  { doGetParmValue(idx, instance, value); }
332  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
333  { doGetParmValue(idx, instance, value); }
334  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
335  { doGetParmValue(idx, instance, value); }
336  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
337  { doGetParmValue(idx, instance, value); }
338  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
339  { doGetParmValue(idx, instance, value); }
340  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
341  { doGetParmValue(idx, instance, value); }
342  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
343  { doGetParmValue(idx, instance, value); }
344  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
345  { doGetParmValue(idx, instance, value); }
346 
347  template <typename T>
348  void
349  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
350  {
351  if (idx.size() < 1)
352  return;
353  UT_ASSERT(idx.size() == instance.size()+1);
354  if (idx.size() != instance.size()+1)
355  return;
356  switch (idx[0])
357  {
358  case 0:
359  if (idx.size() == 1)
360  {
361  exint newsize;
362  coerceValue(newsize, value);
363  myPromotions.setSize(newsize);
364  }
365  else
366  {
367  myPromotions.setSizeIfNeeded(instance[0]+1);
368  auto && _data = myPromotions(instance[0]);
369  switch (idx[1])
370  {
371  case 0:
372  coerceValue(_data.enable, value);
373  break;
374  case 1:
375  coerceValue(_data.fromtype, value);
376  break;
377  case 2:
378  coerceValue(_data.totype, value);
379  break;
380  case 3:
381  coerceValue(_data.group, value);
382  break;
383  case 4:
384  coerceValue(_data.newname, value);
385  break;
386  case 5:
387  coerceValue(_data.preserve, value);
388  break;
389  case 6:
390  coerceValue(_data.onlyboundary, value);
391  break;
392  case 7:
393  coerceValue(_data.includeunshared, value);
394  break;
395  case 8:
396  coerceValue(_data.useconnectivityattrib, value);
397  break;
398  case 9:
399  coerceValue(_data.connectivityattrib, value);
400  break;
401  case 10:
402  coerceValue(_data.primsbyattribbndpts, value);
403  break;
404  case 11:
405  coerceValue(_data.onlyfull, value);
406  break;
407  case 12:
408  coerceValue(_data.removedegen, value);
409  break;
410  case 13:
411  coerceValue(_data.toattrib, value);
412  break;
413 
414  }
415  }
416  break;
417 
418  }
419  }
420 
421  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
422  { doSetParmValue(idx, instance, value); }
423  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
424  { doSetParmValue(idx, instance, value); }
425  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
426  { doSetParmValue(idx, instance, value); }
427  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
428  { doSetParmValue(idx, instance, value); }
429  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
430  { doSetParmValue(idx, instance, value); }
431  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
432  { doSetParmValue(idx, instance, value); }
433  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
434  { doSetParmValue(idx, instance, value); }
435  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
436  { doSetParmValue(idx, instance, value); }
437  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
438  { doSetParmValue(idx, instance, value); }
439  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
440  { doSetParmValue(idx, instance, value); }
441  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
442  { doSetParmValue(idx, instance, value); }
443 
444  exint getNestNumParms(TempIndex idx) const override
445  {
446  if (idx.size() == 0)
447  return 1;
448  switch (idx[0])
449  {
450  case 0:
451  return 14;
452 
453  }
454  // Invalid
455  return 0;
456  }
457 
458  const char *getNestParmName(TempIndex fieldnum) const override
459  {
460  if (fieldnum.size() < 1)
461  return 0;
462  switch (fieldnum[0])
463  {
464  case 0:
465  if (fieldnum.size() == 1)
466  return "promotions";
467  switch (fieldnum[1])
468  {
469  case 0:
470  return "enable#";
471  case 1:
472  return "fromtype#";
473  case 2:
474  return "totype#";
475  case 3:
476  return "group#";
477  case 4:
478  return "newname#";
479  case 5:
480  return "preserve#";
481  case 6:
482  return "onlyboundary#";
483  case 7:
484  return "includeunshared#";
485  case 8:
486  return "useconnectivityattrib#";
487  case 9:
488  return "connectivityattrib#";
489  case 10:
490  return "primsbyattribbndpts#";
491  case 11:
492  return "onlyfull#";
493  case 12:
494  return "removedegen#";
495  case 13:
496  return "toattrib#";
497 
498  }
499  return 0;
500 
501  }
502  return 0;
503  }
504 
505  ParmType getNestParmType(TempIndex fieldnum) const override
506  {
507  if (fieldnum.size() < 1)
508  return PARM_UNSUPPORTED;
509  switch (fieldnum[0])
510  {
511  case 0:
512  if (fieldnum.size() == 1)
513  return PARM_MULTIPARM;
514  switch (fieldnum[1])
515  {
516  case 0:
517  return PARM_INTEGER;
518  case 1:
519  return PARM_INTEGER;
520  case 2:
521  return PARM_INTEGER;
522  case 3:
523  return PARM_STRING;
524  case 4:
525  return PARM_STRING;
526  case 5:
527  return PARM_INTEGER;
528  case 6:
529  return PARM_INTEGER;
530  case 7:
531  return PARM_INTEGER;
532  case 8:
533  return PARM_INTEGER;
534  case 9:
535  return PARM_STRING;
536  case 10:
537  return PARM_INTEGER;
538  case 11:
539  return PARM_INTEGER;
540  case 12:
541  return PARM_INTEGER;
542  case 13:
543  return PARM_INTEGER;
544 
545  }
546  return PARM_UNSUPPORTED;
547 
548  }
549  return PARM_UNSUPPORTED;
550  }
551 
552  // Boiler plate to load individual types.
553  static void loadData(UT_IStream &is, int64 &v)
554  { is.bread(&v, 1); }
555  static void loadData(UT_IStream &is, bool &v)
556  { int64 iv; is.bread(&iv, 1); v = iv; }
557  static void loadData(UT_IStream &is, fpreal64 &v)
558  { is.bread<fpreal64>(&v, 1); }
559  static void loadData(UT_IStream &is, UT_Vector2D &v)
560  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
561  static void loadData(UT_IStream &is, UT_Vector3D &v)
562  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
563  is.bread<fpreal64>(&v.z(), 1); }
564  static void loadData(UT_IStream &is, UT_Vector4D &v)
565  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
566  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
567  static void loadData(UT_IStream &is, UT_Matrix2D &v)
568  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
569  static void loadData(UT_IStream &is, UT_Matrix3D &v)
570  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
571  static void loadData(UT_IStream &is, UT_Matrix4D &v)
572  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
573  static void loadData(UT_IStream &is, UT_Vector2I &v)
574  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
575  static void loadData(UT_IStream &is, UT_Vector3I &v)
576  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
577  is.bread<int64>(&v.z(), 1); }
578  static void loadData(UT_IStream &is, UT_Vector4I &v)
579  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
580  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
582  { is.bread(v); }
584  { UT_StringHolder rampdata;
585  loadData(is, rampdata);
586  if (rampdata.isstring())
587  {
588  v.reset(new UT_Ramp());
589  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
590  v->load(istr);
591  }
592  else v.reset();
593  }
596  loadData(is, data);
597  if (data.isstring())
598  {
599  // Find the data type.
600  const char *colon = UT_StringWrap(data).findChar(':');
601  if (colon)
602  {
603  int typelen = colon - data.buffer();
605  type.strncpy(data.buffer(), typelen);
606  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
607 
608  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
609  }
610  }
611  else v.reset();
612  }
613 
614  static void saveData(std::ostream &os, int64 v)
615  { UTwrite(os, &v); }
616  static void saveData(std::ostream &os, bool v)
617  { int64 iv = v; UTwrite(os, &iv); }
618  static void saveData(std::ostream &os, fpreal64 v)
619  { UTwrite<fpreal64>(os, &v); }
620  static void saveData(std::ostream &os, UT_Vector2D v)
621  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
622  static void saveData(std::ostream &os, UT_Vector3D v)
623  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
624  UTwrite<fpreal64>(os, &v.z()); }
625  static void saveData(std::ostream &os, UT_Vector4D v)
626  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
627  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
628  static void saveData(std::ostream &os, UT_Matrix2D v)
630  static void saveData(std::ostream &os, UT_Matrix3D v)
632  static void saveData(std::ostream &os, UT_Matrix4D v)
634  static void saveData(std::ostream &os, UT_StringHolder s)
635  { UT_StringWrap(s).saveBinary(os); }
636  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
638  UT_OStringStream ostr;
639  if (s) s->save(ostr);
640  result = ostr.str();
641  saveData(os, result);
642  }
643  static void saveData(std::ostream &os, PRM_DataItemHandle s)
645  UT_OStringStream ostr;
646  if (s)
647  {
648  ostr << s->getDataTypeToken();
649  ostr << ":";
650  s->saveBinary(ostr);
651  }
652  result = ostr.str();
653  saveData(os, result);
654  }
655 
656 
657  void save(std::ostream &os) const
658  {
659  int32 v = version();
660  UTwrite(os, &v);
661  {
662  int64 length = myPromotions.entries();
663  UTwrite(os, &length);
664  for (exint i = 0; i < length; i++)
665  {
666  saveData(os, myPromotions(i).enable);
667  saveData(os, myPromotions(i).fromtype);
668  saveData(os, myPromotions(i).totype);
669  saveData(os, myPromotions(i).group);
670  saveData(os, myPromotions(i).newname);
671  saveData(os, myPromotions(i).preserve);
672  saveData(os, myPromotions(i).onlyboundary);
673  saveData(os, myPromotions(i).includeunshared);
674  saveData(os, myPromotions(i).useconnectivityattrib);
675  saveData(os, myPromotions(i).connectivityattrib);
676  saveData(os, myPromotions(i).primsbyattribbndpts);
677  saveData(os, myPromotions(i).onlyfull);
678  saveData(os, myPromotions(i).removedegen);
679  saveData(os, myPromotions(i).toattrib);
680 
681  }
682  }
683 
684  }
685 
686  bool load(UT_IStream &is)
687  {
688  int32 v;
689  is.bread(&v, 1);
690  if (version() != v)
691  {
692  // Fail incompatible versions
693  return false;
694  }
695  {
696  int64 length;
697  is.read(&length, 1);
698  myPromotions.entries(length);
699  for (exint i = 0; i < length; i++)
700  {
701  loadData(is, myPromotions(i).enable);
702  loadData(is, myPromotions(i).fromtype);
703  loadData(is, myPromotions(i).totype);
704  loadData(is, myPromotions(i).group);
705  loadData(is, myPromotions(i).newname);
706  loadData(is, myPromotions(i).preserve);
707  loadData(is, myPromotions(i).onlyboundary);
708  loadData(is, myPromotions(i).includeunshared);
709  loadData(is, myPromotions(i).useconnectivityattrib);
710  loadData(is, myPromotions(i).connectivityattrib);
711  loadData(is, myPromotions(i).primsbyattribbndpts);
712  loadData(is, myPromotions(i).onlyfull);
713  loadData(is, myPromotions(i).removedegen);
714  loadData(is, myPromotions(i).toattrib);
715 
716  }
717  }
718 
719  return true;
720  }
721 
722  const UT_Array<Promotions> &getPromotions() const { return myPromotions; }
723  void setPromotions(const UT_Array<Promotions> &val) { myPromotions = val; }
725  {
726  SOP_Node *thissop = cookparms.getNode();
727  if (!thissop) return getPromotions().entries();
728  exint result;
729  OP_Utils::evalOpParm(result, thissop, "promotions", cookparms.getCookTime(), 0);
730  return result;
731  }
732  bool opPromotions_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
733  {
734  SOP_Node *thissop = cookparms.getNode();
735  if (!thissop) return (myPromotions(_idx).enable);
736  int _parmidx = _idx + 1;
737  bool result;
738  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
739  return (result);
740  }
742  {
743  SOP_Node *thissop = cookparms.getNode();
744  if (!thissop) return (myPromotions(_idx).fromtype);
745  int _parmidx = _idx + 1;
746  int64 result;
747  OP_Utils::evalOpParmInst(result, thissop, "fromtype#", &_parmidx, cookparms.getCookTime(), 0);
748  return (result);
749  }
751  {
752  SOP_Node *thissop = cookparms.getNode();
753  if (!thissop) return (myPromotions(_idx).totype);
754  int _parmidx = _idx + 1;
755  int64 result;
756  OP_Utils::evalOpParmInst(result, thissop, "totype#", &_parmidx, cookparms.getCookTime(), 0);
757  return (result);
758  }
760  {
761  SOP_Node *thissop = cookparms.getNode();
762  if (!thissop) return (myPromotions(_idx).group);
763  int _parmidx = _idx + 1;
765  OP_Utils::evalOpParmInst(result, thissop, "group#", &_parmidx, cookparms.getCookTime(), 0);
766  return (result);
767  }
769  {
770  SOP_Node *thissop = cookparms.getNode();
771  if (!thissop) return (myPromotions(_idx).newname);
772  int _parmidx = _idx + 1;
774  OP_Utils::evalOpParmInst(result, thissop, "newname#", &_parmidx, cookparms.getCookTime(), 0);
775  return (result);
776  }
777  bool opPromotions_preserve(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
778  {
779  SOP_Node *thissop = cookparms.getNode();
780  if (!thissop) return (myPromotions(_idx).preserve);
781  int _parmidx = _idx + 1;
782  bool result;
783  OP_Utils::evalOpParmInst(result, thissop, "preserve#", &_parmidx, cookparms.getCookTime(), 0);
784  return (result);
785  }
786  bool opPromotions_onlyboundary(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
787  {
788  SOP_Node *thissop = cookparms.getNode();
789  if (!thissop) return (myPromotions(_idx).onlyboundary);
790  int _parmidx = _idx + 1;
791  bool result;
792  OP_Utils::evalOpParmInst(result, thissop, "onlyboundary#", &_parmidx, cookparms.getCookTime(), 0);
793  return (result);
794  }
795  bool opPromotions_includeunshared(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
796  {
797  SOP_Node *thissop = cookparms.getNode();
798  if (!thissop) return (myPromotions(_idx).includeunshared);
799  int _parmidx = _idx + 1;
800  bool result;
801  OP_Utils::evalOpParmInst(result, thissop, "includeunshared#", &_parmidx, cookparms.getCookTime(), 0);
802  return (result);
803  }
805  {
806  SOP_Node *thissop = cookparms.getNode();
807  if (!thissop) return (myPromotions(_idx).useconnectivityattrib);
808  int _parmidx = _idx + 1;
809  bool result;
810  OP_Utils::evalOpParmInst(result, thissop, "useconnectivityattrib#", &_parmidx, cookparms.getCookTime(), 0);
811  return (result);
812  }
814  {
815  SOP_Node *thissop = cookparms.getNode();
816  if (!thissop) return (myPromotions(_idx).connectivityattrib);
817  int _parmidx = _idx + 1;
819  OP_Utils::evalOpParmInst(result, thissop, "connectivityattrib#", &_parmidx, cookparms.getCookTime(), 0);
820  return (result);
821  }
823  {
824  SOP_Node *thissop = cookparms.getNode();
825  if (!thissop) return (myPromotions(_idx).primsbyattribbndpts);
826  int _parmidx = _idx + 1;
827  bool result;
828  OP_Utils::evalOpParmInst(result, thissop, "primsbyattribbndpts#", &_parmidx, cookparms.getCookTime(), 0);
829  return (result);
830  }
831  bool opPromotions_onlyfull(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
832  {
833  SOP_Node *thissop = cookparms.getNode();
834  if (!thissop) return (myPromotions(_idx).onlyfull);
835  int _parmidx = _idx + 1;
836  bool result;
837  OP_Utils::evalOpParmInst(result, thissop, "onlyfull#", &_parmidx, cookparms.getCookTime(), 0);
838  return (result);
839  }
840  bool opPromotions_removedegen(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
841  {
842  SOP_Node *thissop = cookparms.getNode();
843  if (!thissop) return (myPromotions(_idx).removedegen);
844  int _parmidx = _idx + 1;
845  bool result;
846  OP_Utils::evalOpParmInst(result, thissop, "removedegen#", &_parmidx, cookparms.getCookTime(), 0);
847  return (result);
848  }
849  bool opPromotions_toattrib(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
850  {
851  SOP_Node *thissop = cookparms.getNode();
852  if (!thissop) return (myPromotions(_idx).toattrib);
853  int _parmidx = _idx + 1;
854  bool result;
855  OP_Utils::evalOpParmInst(result, thissop, "toattrib#", &_parmidx, cookparms.getCookTime(), 0);
856  return (result);
857  }
858 
859 
860 private:
861  UT_Array<Promotions> myPromotions;
862 
863 };
void copyFrom(const SOP_NodeParms *src) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
GLdouble s
Definition: glew.h:1390
static void saveData(std::ostream &os, UT_Matrix4D v)
bool opPromotions_onlyboundary(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
GLuint GLsizei const void GLenum preserve
Definition: glew.h:8474
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, int *inst, fpreal time, DEP_MicroNode *depnode) const =0
bool opPromotions_toattrib(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
UT_StringHolder createString(const UT_Array< Promotions > &list) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
exint bread(int32 *buffer, exint asize=1)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void saveData(std::ostream &os, fpreal64 v)
GT_API const UT_StringHolder time
bool opPromotions_useconnectivityattrib(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
fpreal getTime() const
Definition: OP_Context.h:60
GLuint const GLfloat * val
Definition: glew.h:2794
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
int64 exint
Definition: SYS_Types.h:125
static void loadData(UT_IStream &is, fpreal64 &v)
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
bool opPromotions_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
bool opPromotions_onlyfull(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
An output stream object that owns its own string buffer storage.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
bool opPromotions_primsbyattribbndpts(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
const GLdouble * v
Definition: glew.h:1391
int64 opPromotions_fromtype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &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.
bool opPromotions_preserve(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opPromotions_totype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
UT_StringHolder opPromotions_connectivityattrib(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, bool v)
double fpreal64
Definition: SYS_Types.h:201
UT_StringHolder opPromotions_group(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
bool opPromotions_removedegen(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, int64 &v)
const char * getNestParmName(TempIndex fieldnum) const override
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
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:28
static void saveData(std::ostream &os, UT_StringHolder s)
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
bool operator!=(const Promotions &src) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
exint getNestNumParms(TempIndex idx) const override
void
Definition: png.h:1083
const GLfloat * c
Definition: glew.h:16296
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
void save(std::ostream &os) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
long long int64
Definition: SYS_Types.h:116
bool opPromotions_includeunshared(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, UT_Vector2I &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
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:460
exint opPromotions(const SOP_NodeVerb::CookParms &cookparms) const
void loadFromOpSubclass(const LoadParms &loadparms) override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void saveData(std::ostream &os, UT_Matrix3D v)
fpreal64 fpreal
Definition: SYS_Types.h:277
bool operator!=(const SOP_GroupPromoteParms &src) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setPromotions(const UT_Array< Promotions > &val)
SYS_FORCE_INLINE void append(char character)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
static void loadData(UT_IStream &is, UT_Vector4D &v)
#define SOP_API
Definition: SOP_API.h:10
bool load(UT_IStream &is)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
static void loadData(UT_IStream &is, UT_Vector4I &v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
static void saveData(std::ostream &os, UT_Vector3D v)
bool operator==(const Promotions &src) const
GLuint64EXT * result
Definition: glew.h:14007
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
UT_StringHolder opPromotions_newname(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
ParmType getNestParmType(TempIndex fieldnum) const override
bool operator==(const SOP_GroupPromoteParms &src) const
GLsizei const GLfloat * value
Definition: glew.h:1849
GLboolean enable
Definition: glew.h:2745
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
SYS_FORCE_INLINE bool isstring() const
const UT_Array< Promotions > & getPromotions() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
GLboolean GLuint group
Definition: glew.h:2745
static void saveData(std::ostream &os, UT_Matrix2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override