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