HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MergePacked.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SOP/SOP_API.h>
7 #include <SOP/SOP_NodeVerb.h>
8 #include <SOP/SOP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 namespace SOP_MergePackedEnums
24 {
25  enum class Pivot
26  {
27  ORIGIN = 0,
28  CENTROID
29  };
30 
32  getToken(Pivot enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Pivot::ORIGIN: return "origin"_sh;
37  case Pivot::CENTROID: return "centroid"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42  enum class NamingMethod
43  {
44  NAME = 0,
45  PATH
46  };
47 
49  getToken(NamingMethod enum_value)
50  {
51  using namespace UT::Literal;
52  switch (enum_value) {
53  case NamingMethod::NAME: return "name"_sh;
54  case NamingMethod::PATH: return "path"_sh;
55  default: UT_ASSERT(false); return ""_sh;
56  }
57  }
58 
59  enum class Treatasfolder
60  {
61  DEFAULT = 0,
62  FOLDER
63  };
64 
66  getToken(Treatasfolder enum_value)
67  {
68  using namespace UT::Literal;
69  switch (enum_value) {
70  case Treatasfolder::DEFAULT: return "default"_sh;
71  case Treatasfolder::FOLDER: return "folder"_sh;
72  default: UT_ASSERT(false); return ""_sh;
73  }
74  }
75 
76 }
77 
78 
80 {
81 public:
82  static int version() { return 1; }
83  struct Names
84  {
85  bool useinput;
88 
89 
91  {
92  useinput = true;
93  name = ""_UTsh;
94  treatasfolder = 0;
95 
96  }
97 
98  bool operator==(const Names &src) const
99  {
100  if (useinput != src.useinput) return false;
101  if (name != src.name) return false;
102  if (treatasfolder != src.treatasfolder) return false;
103 
104  return true;
105  }
106  bool operator!=(const Names &src) const
107  {
108  return !operator==(src);
109  }
110 
111  };
112 
114  {
116 
117  buf.strcat("[ ");
118  for (int i = 0; i < list.entries(); i++)
119  {
120  if (i)
121  buf.strcat(", ");
122  buf.strcat("( ");
123  buf.append("");
124  buf.appendSprintf("%s", (list(i).useinput) ? "true" : "false");
125  buf.append(", ");
126  { UT_String tmp; tmp = UT_StringWrap(list(i).name).makeQuotedString('"'); buf.strcat(tmp); }
127  buf.append(", ");
128  buf.appendSprintf("%d", (int) list(i).treatasfolder);
129 
130  buf.strcat(" )");
131  }
132  buf.strcat(" ]");
133 
135  return result;
136  }
137 
139  {
140  mySetPrimName = true;
141  myPrimName = "name"_UTsh;
142  mySetPrimIndex = false;
143  myPrimIndex = "index"_UTsh;
144  myNameOverride = false;
145  myNameOverrideAttrib = "name"_UTsh;
146  myPack = true;
147  myOnlyPackUnpacked = false;
148  myIgnoreEmpty = false;
149  myNamingMethod = 0;
150  mySingleMode = false;
151  mySingleIndex = 0;
152  myNames.setSize(0);
153  myPivot = 0;
154 
155  }
156 
157  explicit SOP_MergePackedParms(const SOP_MergePackedParms &) = default;
159  SOP_MergePackedParms(SOP_MergePackedParms &&) noexcept = default;
160  SOP_MergePackedParms &operator=(SOP_MergePackedParms &&) noexcept = default;
161 
162  ~SOP_MergePackedParms() override {}
163 
165  {
166  if (mySetPrimName != src.mySetPrimName) return false;
167  if (myPrimName != src.myPrimName) return false;
168  if (mySetPrimIndex != src.mySetPrimIndex) return false;
169  if (myPrimIndex != src.myPrimIndex) return false;
170  if (myNameOverride != src.myNameOverride) return false;
171  if (myNameOverrideAttrib != src.myNameOverrideAttrib) return false;
172  if (myPack != src.myPack) return false;
173  if (myOnlyPackUnpacked != src.myOnlyPackUnpacked) return false;
174  if (myIgnoreEmpty != src.myIgnoreEmpty) return false;
175  if (myNamingMethod != src.myNamingMethod) return false;
176  if (mySingleMode != src.mySingleMode) return false;
177  if (mySingleIndex != src.mySingleIndex) return false;
178  if (myNames != src.myNames) return false;
179  if (myPivot != src.myPivot) return false;
180 
181  return true;
182  }
184  {
185  return !operator==(src);
186  }
190 
191 
192 
193  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
194  {
195  mySetPrimName = true;
196  if (true)
197  graph->evalOpParm(mySetPrimName, nodeidx, "setprimname", time, 0);
198  myPrimName = "name"_UTsh;
199  if (true && ( (true&&!(((getSetPrimName()!=1)))) ) )
200  graph->evalOpParm(myPrimName, nodeidx, "primname", time, 0);
201  mySetPrimIndex = false;
202  if (true)
203  graph->evalOpParm(mySetPrimIndex, nodeidx, "setprimindex", time, 0);
204  myPrimIndex = "index"_UTsh;
205  if (true && ( (true&&!(((getSetPrimIndex()!=1)))) ) )
206  graph->evalOpParm(myPrimIndex, nodeidx, "primindex", time, 0);
207  myNameOverride = false;
208  if (true)
209  graph->evalOpParm(myNameOverride, nodeidx, "nameoverride", time, 0);
210  myNameOverrideAttrib = "name"_UTsh;
211  if (true && ( (true&&!(((getNameOverride()!=1)))) ) )
212  graph->evalOpParm(myNameOverrideAttrib, nodeidx, "nameoverrideattrib", time, 0);
213  myPack = true;
214  if (true)
215  graph->evalOpParm(myPack, nodeidx, "pack", time, 0);
216  myOnlyPackUnpacked = false;
217  if (true && ( (true&&!(((getPack()!=1)))) ) )
218  graph->evalOpParm(myOnlyPackUnpacked, nodeidx, "onlypackunpacked", time, 0);
219  myIgnoreEmpty = false;
220  if (true)
221  graph->evalOpParm(myIgnoreEmpty, nodeidx, "ignoreempty", time, 0);
222  myNamingMethod = 0;
223  if (true)
224  graph->evalOpParm(myNamingMethod, nodeidx, "namingmethod", time, 0);
225  mySingleMode = false;
226  if (true)
227  graph->evalOpParm(mySingleMode, nodeidx, "singlemode", time, 0);
228  mySingleIndex = 0;
229  if (true && ( (true&&!(((getSingleMode()!=1)))) ) )
230  graph->evalOpParm(mySingleIndex, nodeidx, "singleindex", time, 0);
231  if (true)
232  {
233  int64 length = 0;
234  graph->evalOpParm(length, nodeidx, "names", time, 0);
235  if (length < 0) length = 0;
236  myNames.setSize(length);
237  for (exint i = 0; i < length; i++)
238  {
239  int parmidx[1];
240  int offsets[1];
241  parmidx[0] = i+1;
242  offsets[0] = 1;
243  auto && _curentry = myNames(i);
244  (void) _curentry;
245  _curentry.useinput = true;
246  if (true)
247  graph->evalOpParmInst(_curentry.useinput, nodeidx, "useinput#", parmidx, offsets, time, 0, 2-1);
248  _curentry.name = ""_UTsh;
249  if (true)
250  graph->evalOpParmInst(_curentry.name, nodeidx, "name#", parmidx, offsets, time, 0, 2-1);
251  _curentry.treatasfolder = 0;
252  if (true)
253  graph->evalOpParmInst(_curentry.treatasfolder, nodeidx, "treatasfolder#", parmidx, offsets, time, 0, 2-1);
254 
255  }
256  }
257  else
258  myNames.clear();
259  myPivot = 0;
260  if (true && ( (true&&!(((getPack()!=1)))) ) )
261  graph->evalOpParm(myPivot, nodeidx, "pivot", time, 0);
262 
263  }
264 
265 
266  void loadFromOpSubclass(const LoadParms &loadparms) override
267  {
268  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
269  }
270 
271 
272  void copyFrom(const OP_NodeParms *src) override
273  {
274  *this = *((const SOP_MergePackedParms *)src);
275  }
276 
277  template <typename T>
278  void
279  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
280  {
281  if (idx.size() < 1)
282  return;
283  UT_ASSERT(idx.size() == instance.size()+1);
284  if (idx.size() != instance.size()+1)
285  return;
286  switch (idx[0])
287  {
288  case 0:
289  coerceValue(value, mySetPrimName);
290  break;
291  case 1:
292  coerceValue(value, myPrimName);
293  break;
294  case 2:
295  coerceValue(value, mySetPrimIndex);
296  break;
297  case 3:
298  coerceValue(value, myPrimIndex);
299  break;
300  case 4:
301  coerceValue(value, myNameOverride);
302  break;
303  case 5:
304  coerceValue(value, myNameOverrideAttrib);
305  break;
306  case 6:
307  coerceValue(value, myPack);
308  break;
309  case 7:
310  coerceValue(value, myOnlyPackUnpacked);
311  break;
312  case 8:
313  coerceValue(value, myIgnoreEmpty);
314  break;
315  case 9:
316  coerceValue(value, myNamingMethod);
317  break;
318  case 10:
319  coerceValue(value, mySingleMode);
320  break;
321  case 11:
322  coerceValue(value, mySingleIndex);
323  break;
324  case 12:
325  if (idx.size() == 1)
326  coerceValue(value, myNames.entries());
327  else if (instance[0] < myNames.entries())
328  {
329  auto && _data = myNames(instance[0]);
330  switch (idx[1])
331  {
332  case 0:
333  coerceValue(value, _data.useinput);
334  break;
335  case 1:
336  coerceValue(value, _data.name);
337  break;
338  case 2:
339  coerceValue(value, _data.treatasfolder);
340  break;
341 
342  }
343  }
344  break;
345  case 13:
346  coerceValue(value, myPivot);
347  break;
348 
349  }
350  }
351 
352  bool isParmColorRamp(exint idx) const override
353  {
354  switch (idx)
355  {
356 
357  }
358  return false;
359  }
360 
361  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
362  { doGetParmValue(idx, instance, value); }
363  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
364  { doGetParmValue(idx, instance, value); }
365  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
366  { doGetParmValue(idx, instance, value); }
367  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
368  { doGetParmValue(idx, instance, value); }
369  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
370  { doGetParmValue(idx, instance, value); }
371  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
372  { doGetParmValue(idx, instance, value); }
373  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
374  { doGetParmValue(idx, instance, value); }
375  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
376  { doGetParmValue(idx, instance, value); }
377  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
378  { doGetParmValue(idx, instance, value); }
379  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
380  { doGetParmValue(idx, instance, value); }
381  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
382  { doGetParmValue(idx, instance, value); }
383 
384  template <typename T>
385  void
386  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
387  {
388  if (idx.size() < 1)
389  return;
390  UT_ASSERT(idx.size() == instance.size()+1);
391  if (idx.size() != instance.size()+1)
392  return;
393  switch (idx[0])
394  {
395  case 0:
396  coerceValue(mySetPrimName, ( ( value ) ));
397  break;
398  case 1:
399  coerceValue(myPrimName, ( ( value ) ));
400  break;
401  case 2:
402  coerceValue(mySetPrimIndex, ( ( value ) ));
403  break;
404  case 3:
405  coerceValue(myPrimIndex, ( ( value ) ));
406  break;
407  case 4:
408  coerceValue(myNameOverride, ( ( value ) ));
409  break;
410  case 5:
411  coerceValue(myNameOverrideAttrib, ( ( value ) ));
412  break;
413  case 6:
414  coerceValue(myPack, ( ( value ) ));
415  break;
416  case 7:
417  coerceValue(myOnlyPackUnpacked, ( ( value ) ));
418  break;
419  case 8:
420  coerceValue(myIgnoreEmpty, ( ( value ) ));
421  break;
422  case 9:
423  coerceValue(myNamingMethod, clampMinValue(0, clampMaxValue(1, value ) ));
424  break;
425  case 10:
426  coerceValue(mySingleMode, ( ( value ) ));
427  break;
428  case 11:
429  coerceValue(mySingleIndex, clampMinValue(1, ( value ) ));
430  break;
431  case 12:
432  if (idx.size() == 1)
433  {
434  exint newsize;
435  coerceValue(newsize, value);
436  if (newsize < 0) newsize = 0;
437  myNames.setSize(newsize);
438  }
439  else
440  {
441  if (instance[0] < 0)
442  return;
443  myNames.setSizeIfNeeded(instance[0]+1);
444  auto && _data = myNames(instance[0]);
445  switch (idx[1])
446  {
447  case 0:
448  coerceValue(_data.useinput, value);
449  break;
450  case 1:
451  coerceValue(_data.name, value);
452  break;
453  case 2:
454  coerceValue(_data.treatasfolder, value);
455  break;
456 
457  }
458  }
459  break;
460  case 13:
461  coerceValue(myPivot, clampMinValue(0, clampMaxValue(1, value ) ));
462  break;
463 
464  }
465  }
466 
467  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
468  { doSetParmValue(idx, instance, value); }
469  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
470  { doSetParmValue(idx, instance, value); }
471  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
472  { doSetParmValue(idx, instance, value); }
473  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
474  { doSetParmValue(idx, instance, value); }
475  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
476  { doSetParmValue(idx, instance, value); }
477  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
478  { doSetParmValue(idx, instance, value); }
479  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
480  { doSetParmValue(idx, instance, value); }
481  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
482  { doSetParmValue(idx, instance, value); }
483  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
484  { doSetParmValue(idx, instance, value); }
485  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
486  { doSetParmValue(idx, instance, value); }
487  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
488  { doSetParmValue(idx, instance, value); }
489 
490  exint getNestNumParms(TempIndex idx) const override
491  {
492  if (idx.size() == 0)
493  return 14;
494  switch (idx[0])
495  {
496  case 12:
497  return 3;
498 
499  }
500  // Invalid
501  return 0;
502  }
503 
504  const char *getNestParmName(TempIndex fieldnum) const override
505  {
506  if (fieldnum.size() < 1)
507  return 0;
508  switch (fieldnum[0])
509  {
510  case 0:
511  return "setprimname";
512  case 1:
513  return "primname";
514  case 2:
515  return "setprimindex";
516  case 3:
517  return "primindex";
518  case 4:
519  return "nameoverride";
520  case 5:
521  return "nameoverrideattrib";
522  case 6:
523  return "pack";
524  case 7:
525  return "onlypackunpacked";
526  case 8:
527  return "ignoreempty";
528  case 9:
529  return "namingmethod";
530  case 10:
531  return "singlemode";
532  case 11:
533  return "singleindex";
534  case 12:
535  if (fieldnum.size() == 1)
536  return "names";
537  switch (fieldnum[1])
538  {
539  case 0:
540  return "useinput#";
541  case 1:
542  return "name#";
543  case 2:
544  return "treatasfolder#";
545 
546  }
547  return 0;
548  case 13:
549  return "pivot";
550 
551  }
552  return 0;
553  }
554 
555  ParmType getNestParmType(TempIndex fieldnum) const override
556  {
557  if (fieldnum.size() < 1)
558  return PARM_UNSUPPORTED;
559  switch (fieldnum[0])
560  {
561  case 0:
562  return PARM_INTEGER;
563  case 1:
564  return PARM_STRING;
565  case 2:
566  return PARM_INTEGER;
567  case 3:
568  return PARM_STRING;
569  case 4:
570  return PARM_INTEGER;
571  case 5:
572  return PARM_STRING;
573  case 6:
574  return PARM_INTEGER;
575  case 7:
576  return PARM_INTEGER;
577  case 8:
578  return PARM_INTEGER;
579  case 9:
580  return PARM_INTEGER;
581  case 10:
582  return PARM_INTEGER;
583  case 11:
584  return PARM_INTEGER;
585  case 12:
586  if (fieldnum.size() == 1)
587  return PARM_MULTIPARM;
588  switch (fieldnum[1])
589  {
590  case 0:
591  return PARM_INTEGER;
592  case 1:
593  return PARM_STRING;
594  case 2:
595  return PARM_INTEGER;
596 
597  }
598  return PARM_UNSUPPORTED;
599  case 13:
600  return PARM_INTEGER;
601 
602  }
603  return PARM_UNSUPPORTED;
604  }
605 
606  // Boiler plate to load individual types.
607  static void loadData(UT_IStream &is, int64 &v)
608  { is.bread(&v, 1); }
609  static void loadData(UT_IStream &is, bool &v)
610  { int64 iv; is.bread(&iv, 1); v = iv; }
611  static void loadData(UT_IStream &is, fpreal64 &v)
612  { is.bread<fpreal64>(&v, 1); }
613  static void loadData(UT_IStream &is, UT_Vector2D &v)
614  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
615  static void loadData(UT_IStream &is, UT_Vector3D &v)
616  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
617  is.bread<fpreal64>(&v.z(), 1); }
618  static void loadData(UT_IStream &is, UT_Vector4D &v)
619  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
620  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
621  static void loadData(UT_IStream &is, UT_Matrix2D &v)
622  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
623  static void loadData(UT_IStream &is, UT_Matrix3D &v)
624  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
625  static void loadData(UT_IStream &is, UT_Matrix4D &v)
626  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
627  static void loadData(UT_IStream &is, UT_Vector2I &v)
628  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
629  static void loadData(UT_IStream &is, UT_Vector3I &v)
630  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
631  is.bread<int64>(&v.z(), 1); }
632  static void loadData(UT_IStream &is, UT_Vector4I &v)
633  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
634  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
636  { is.bread(v); }
638  { UT_StringHolder rampdata;
639  loadData(is, rampdata);
640  if (rampdata.isstring())
641  {
642  v.reset(new UT_Ramp());
643  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
644  v->load(istr);
645  }
646  else v.reset();
647  }
650  loadData(is, data);
651  if (data.isstring())
652  {
653  // Find the data type.
654  const char *colon = UT_StringWrap(data).findChar(':');
655  if (colon)
656  {
657  int typelen = colon - data.buffer();
659  type.strncpy(data.buffer(), typelen);
660  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
661 
662  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
663  }
664  }
665  else v.reset();
666  }
667 
668  static void saveData(std::ostream &os, int64 v)
669  { UTwrite(os, &v); }
670  static void saveData(std::ostream &os, bool v)
671  { int64 iv = v; UTwrite(os, &iv); }
672  static void saveData(std::ostream &os, fpreal64 v)
673  { UTwrite<fpreal64>(os, &v); }
674  static void saveData(std::ostream &os, UT_Vector2D v)
675  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
676  static void saveData(std::ostream &os, UT_Vector3D v)
677  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
678  UTwrite<fpreal64>(os, &v.z()); }
679  static void saveData(std::ostream &os, UT_Vector4D v)
680  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
681  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
682  static void saveData(std::ostream &os, UT_Matrix2D v)
684  static void saveData(std::ostream &os, UT_Matrix3D v)
686  static void saveData(std::ostream &os, UT_Matrix4D v)
688  static void saveData(std::ostream &os, UT_StringHolder s)
689  { UT_StringWrap(s).saveBinary(os); }
690  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
692  UT_OStringStream ostr;
693  if (s) s->save(ostr);
694  result = ostr.str();
695  saveData(os, result);
696  }
697  static void saveData(std::ostream &os, PRM_DataItemHandle s)
699  UT_OStringStream ostr;
700  if (s)
701  {
702  ostr << s->getDataTypeToken();
703  ostr << ":";
704  s->saveBinary(ostr);
705  }
706  result = ostr.str();
707  saveData(os, result);
708  }
709 
710 
711  void save(std::ostream &os) const
712  {
713  int32 v = version();
714  UTwrite(os, &v);
715  saveData(os, mySetPrimName);
716  saveData(os, myPrimName);
717  saveData(os, mySetPrimIndex);
718  saveData(os, myPrimIndex);
719  saveData(os, myNameOverride);
720  saveData(os, myNameOverrideAttrib);
721  saveData(os, myPack);
722  saveData(os, myOnlyPackUnpacked);
723  saveData(os, myIgnoreEmpty);
724  saveData(os, myNamingMethod);
725  saveData(os, mySingleMode);
726  saveData(os, mySingleIndex);
727  {
728  int64 length = myNames.entries();
729  UTwrite(os, &length);
730  for (exint i = 0; i < length; i++)
731  {
732  auto && _curentry = myNames(i);
733  (void) _curentry;
734  saveData(os, _curentry.useinput);
735  saveData(os, _curentry.name);
736  saveData(os, _curentry.treatasfolder);
737 
738  }
739  }
740  saveData(os, myPivot);
741 
742  }
743 
744  bool load(UT_IStream &is)
745  {
746  int32 v;
747  is.bread(&v, 1);
748  if (version() != v)
749  {
750  // Fail incompatible versions
751  return false;
752  }
753  loadData(is, mySetPrimName);
754  loadData(is, myPrimName);
755  loadData(is, mySetPrimIndex);
756  loadData(is, myPrimIndex);
757  loadData(is, myNameOverride);
758  loadData(is, myNameOverrideAttrib);
759  loadData(is, myPack);
760  loadData(is, myOnlyPackUnpacked);
761  loadData(is, myIgnoreEmpty);
762  loadData(is, myNamingMethod);
763  loadData(is, mySingleMode);
764  loadData(is, mySingleIndex);
765  {
766  int64 length;
767  is.read(&length, 1);
768  myNames.setSize(length);
769  for (exint i = 0; i < length; i++)
770  {
771  auto && _curentry = myNames(i);
772  (void) _curentry;
773  loadData(is, _curentry.useinput);
774  loadData(is, _curentry.name);
775  loadData(is, _curentry.treatasfolder);
776 
777  }
778  }
779  loadData(is, myPivot);
780 
781  return true;
782  }
783 
784  bool getSetPrimName() const { return mySetPrimName; }
785  void setSetPrimName(bool val) { mySetPrimName = val; }
786  bool opSetPrimName(const SOP_NodeVerb::CookParms &cookparms) const
787  {
788  SOP_Node *thissop = cookparms.getNode();
789  if (!thissop) return getSetPrimName();
790  bool result;
791  OP_Utils::evalOpParm(result, thissop, "setprimname", cookparms.getCookTime(), 0);
792  return result;
793  }
794  const UT_StringHolder & getPrimName() const { return myPrimName; }
795  void setPrimName(const UT_StringHolder & val) { myPrimName = val; }
797  {
798  SOP_Node *thissop = cookparms.getNode();
799  if (!thissop) return getPrimName();
801  OP_Utils::evalOpParm(result, thissop, "primname", cookparms.getCookTime(), 0);
802  return result;
803  }
804  bool getSetPrimIndex() const { return mySetPrimIndex; }
805  void setSetPrimIndex(bool val) { mySetPrimIndex = val; }
806  bool opSetPrimIndex(const SOP_NodeVerb::CookParms &cookparms) const
807  {
808  SOP_Node *thissop = cookparms.getNode();
809  if (!thissop) return getSetPrimIndex();
810  bool result;
811  OP_Utils::evalOpParm(result, thissop, "setprimindex", cookparms.getCookTime(), 0);
812  return result;
813  }
814  const UT_StringHolder & getPrimIndex() const { return myPrimIndex; }
815  void setPrimIndex(const UT_StringHolder & val) { myPrimIndex = val; }
817  {
818  SOP_Node *thissop = cookparms.getNode();
819  if (!thissop) return getPrimIndex();
821  OP_Utils::evalOpParm(result, thissop, "primindex", cookparms.getCookTime(), 0);
822  return result;
823  }
824  bool getNameOverride() const { return myNameOverride; }
825  void setNameOverride(bool val) { myNameOverride = val; }
826  bool opNameOverride(const SOP_NodeVerb::CookParms &cookparms) const
827  {
828  SOP_Node *thissop = cookparms.getNode();
829  if (!thissop) return getNameOverride();
830  bool result;
831  OP_Utils::evalOpParm(result, thissop, "nameoverride", cookparms.getCookTime(), 0);
832  return result;
833  }
834  const UT_StringHolder & getNameOverrideAttrib() const { return myNameOverrideAttrib; }
835  void setNameOverrideAttrib(const UT_StringHolder & val) { myNameOverrideAttrib = val; }
837  {
838  SOP_Node *thissop = cookparms.getNode();
839  if (!thissop) return getNameOverrideAttrib();
841  OP_Utils::evalOpParm(result, thissop, "nameoverrideattrib", cookparms.getCookTime(), 0);
842  return result;
843  }
844  bool getPack() const { return myPack; }
845  void setPack(bool val) { myPack = val; }
846  bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
847  {
848  SOP_Node *thissop = cookparms.getNode();
849  if (!thissop) return getPack();
850  bool result;
851  OP_Utils::evalOpParm(result, thissop, "pack", cookparms.getCookTime(), 0);
852  return result;
853  }
854  bool getOnlyPackUnpacked() const { return myOnlyPackUnpacked; }
855  void setOnlyPackUnpacked(bool val) { myOnlyPackUnpacked = val; }
856  bool opOnlyPackUnpacked(const SOP_NodeVerb::CookParms &cookparms) const
857  {
858  SOP_Node *thissop = cookparms.getNode();
859  if (!thissop) return getOnlyPackUnpacked();
860  bool result;
861  OP_Utils::evalOpParm(result, thissop, "onlypackunpacked", cookparms.getCookTime(), 0);
862  return result;
863  }
864  bool getIgnoreEmpty() const { return myIgnoreEmpty; }
865  void setIgnoreEmpty(bool val) { myIgnoreEmpty = val; }
866  bool opIgnoreEmpty(const SOP_NodeVerb::CookParms &cookparms) const
867  {
868  SOP_Node *thissop = cookparms.getNode();
869  if (!thissop) return getIgnoreEmpty();
870  bool result;
871  OP_Utils::evalOpParm(result, thissop, "ignoreempty", cookparms.getCookTime(), 0);
872  return result;
873  }
874  NamingMethod getNamingMethod() const { return NamingMethod(myNamingMethod); }
875  void setNamingMethod(NamingMethod val) { myNamingMethod = int64(val); }
877  {
878  SOP_Node *thissop = cookparms.getNode();
879  if (!thissop) return getNamingMethod();
880  int64 result;
881  OP_Utils::evalOpParm(result, thissop, "namingmethod", cookparms.getCookTime(), 0);
882  return NamingMethod(result);
883  }
884  bool getSingleMode() const { return mySingleMode; }
885  void setSingleMode(bool val) { mySingleMode = val; }
886  bool opSingleMode(const SOP_NodeVerb::CookParms &cookparms) const
887  {
888  SOP_Node *thissop = cookparms.getNode();
889  if (!thissop) return getSingleMode();
890  bool result;
891  OP_Utils::evalOpParm(result, thissop, "singlemode", cookparms.getCookTime(), 0);
892  return result;
893  }
894  int64 getSingleIndex() const { return mySingleIndex; }
895  void setSingleIndex(int64 val) { mySingleIndex = val; }
897  {
898  SOP_Node *thissop = cookparms.getNode();
899  if (!thissop) return getSingleIndex();
900  int64 result;
901  OP_Utils::evalOpParm(result, thissop, "singleindex", cookparms.getCookTime(), 0);
902  return result;
903  }
904  const UT_Array<Names> &getNames() const { return myNames; }
905 void setNames(const UT_Array<Names> &val) { myNames = val; }
906  exint opNames(const SOP_NodeVerb::CookParms &cookparms) const
907  {
908  SOP_Node *thissop = cookparms.getNode();
909  if (!thissop) return getNames().entries();
910  exint result;
911  OP_Utils::evalOpParm(result, thissop, "names", cookparms.getCookTime(), 0);
912  return result;
913  }
914  bool opNames_useinput(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
915  { return opinstNames_useinput(cookparms, &_idx); }
916  bool opinstNames_useinput(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
917  {
918  SOP_Node *thissop = cookparms.getNode();
919  if (!thissop) return (myNames(_idx[0]).useinput);
920  int _parmidx[2-1];
921  _parmidx[1-1] = _idx[1-1] + 1;
922 
923  bool result;
924  OP_Utils::evalOpParmInst(result, thissop, "useinput#", _parmidx, cookparms.getCookTime(), 0, 2-1);
925  return (result);
926  }
927  UT_StringHolder opNames_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
928  { return opinstNames_name(cookparms, &_idx); }
929  UT_StringHolder opinstNames_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
930  {
931  SOP_Node *thissop = cookparms.getNode();
932  if (!thissop) return (myNames(_idx[0]).name);
933  int _parmidx[2-1];
934  _parmidx[1-1] = _idx[1-1] + 1;
935 
937  OP_Utils::evalOpParmInst(result, thissop, "name#", _parmidx, cookparms.getCookTime(), 0, 2-1);
938  return (result);
939  }
940  int64 opNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
941  { return opinstNames_treatasfolder(cookparms, &_idx); }
942  int64 opinstNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
943  {
944  SOP_Node *thissop = cookparms.getNode();
945  if (!thissop) return (myNames(_idx[0]).treatasfolder);
946  int _parmidx[2-1];
947  _parmidx[1-1] = _idx[1-1] + 1;
948 
949  int64 result;
950  OP_Utils::evalOpParmInst(result, thissop, "treatasfolder#", _parmidx, cookparms.getCookTime(), 0, 2-1);
951  return (result);
952  }
953 
954  Pivot getPivot() const { return Pivot(myPivot); }
955  void setPivot(Pivot val) { myPivot = int64(val); }
956  Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
957  {
958  SOP_Node *thissop = cookparms.getNode();
959  if (!thissop) return getPivot();
960  int64 result;
961  OP_Utils::evalOpParm(result, thissop, "pivot", cookparms.getCookTime(), 0);
962  return Pivot(result);
963  }
964 
965 private:
966  bool mySetPrimName;
967  UT_StringHolder myPrimName;
968  bool mySetPrimIndex;
969  UT_StringHolder myPrimIndex;
970  bool myNameOverride;
971  UT_StringHolder myNameOverrideAttrib;
972  bool myPack;
973  bool myOnlyPackUnpacked;
974  bool myIgnoreEmpty;
975  int64 myNamingMethod;
976  bool mySingleMode;
977  int64 mySingleIndex;
978  UT_Array<Names> myNames;
979  int64 myPivot;
980 
981 };
const UT_StringHolder & getNameOverrideAttrib() const
UT_StringHolder opPrimIndex(const SOP_NodeVerb::CookParms &cookparms) const
bool opNames_useinput(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
bool opIgnoreEmpty(const SOP_NodeVerb::CookParms &cookparms) const
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
static void saveData(std::ostream &os, UT_Matrix4D v)
int int32
Definition: SYS_Types.h:39
static void loadData(UT_IStream &is, UT_Matrix3D &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
int64 opinstNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, bool &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
const char * getNestParmName(TempIndex fieldnum) const override
void
Definition: png.h:1083
UT_StringHolder opinstNames_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:62
bool load(UT_IStream &is)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, UT_Vector3D &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
static void loadData(UT_IStream &is, UT_Vector4D &v)
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
void setNameOverrideAttrib(const UT_StringHolder &val)
GLdouble s
Definition: glad.h:3009
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
**But if you need a result
Definition: thread.h:613
bool opSetPrimName(const SOP_NodeVerb::CookParms &cookparms) const
exint opNames(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const SOP_MergePackedParms &src) const
static void saveData(std::ostream &os, UT_Matrix3D v)
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.
int64 opSingleIndex(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setPrimIndex(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
int64 opNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
SYS_FORCE_INLINE UT_StringHolder getToken(Pivot enum_value)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, bool v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, UT_Vector2D v)
NamingMethod opNamingMethod(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opNameOverrideAttrib(const SOP_NodeVerb::CookParms &cookparms) 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
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_Vector3D v)
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
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setNames(const UT_Array< Names > &val)
bool operator==(const SOP_MergePackedParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
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
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opPrimName(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
GLuint const GLchar * name
Definition: glcorearb.h:786
bool operator!=(const Names &src) const
exint getNestNumParms(TempIndex idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
void setPrimName(const UT_StringHolder &val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool opOnlyPackUnpacked(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
bool operator==(const Names &src) const
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
static void saveData(std::ostream &os, UT_Vector4D v)
void setNamingMethod(NamingMethod val)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void loadData(UT_IStream &is, UT_Vector3I &v)
bool opNameOverride(const SOP_NodeVerb::CookParms &cookparms) const
ParmType getNestParmType(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
bool isParmColorRamp(exint idx) const override
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void loadFromOpSubclass(const LoadParms &loadparms) override
static void loadData(UT_IStream &is, fpreal64 &v)
LeafData & operator=(const LeafData &)=delete
UT_StringHolder createString(const UT_Array< Names > &list) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
GLuint GLfloat * val
Definition: glcorearb.h:1608
static void saveData(std::ostream &os, fpreal64 v)
const UT_StringHolder & getPrimName() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
#define SOP_API
Definition: SOP_API.h:10
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
void save(std::ostream &os) const
NamingMethod getNamingMethod() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
bool opSingleMode(const SOP_NodeVerb::CookParms &cookparms) const
void setSingleIndex(int64 val)
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setOnlyPackUnpacked(bool val)
Definition: core.h:1131
const UT_Array< Names > & getNames() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_StringHolder & getPrimIndex() const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
type
Definition: core.h:1059
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_StringHolder s)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
static void saveData(std::ostream &os, UT_Matrix2D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
bool opSetPrimIndex(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE bool isstring() const
bool opinstNames_useinput(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_StringHolder opNames_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
void copyFrom(const OP_NodeParms *src) override