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