HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_RawImport.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_RawImportEnums
24 {
25  enum class Endian
26  {
27  LITTLE = 0,
28  BIG
29  };
30  enum class PointCountType
31  {
32  NONE = 0,
33  FIXED,
34  DETAIL,
35  GUESS
36  };
37  enum class Target
38  {
39  NONE = 0,
40  DETAIL,
41  POINT,
42  VOLUME
43  };
44  enum class Type
45  {
46  FLOAT = 0,
47  INT
48  };
49  enum class Precision
50  {
51  _8 = 0,
52  _16,
53  _32,
54  _64
55  };
56  enum class Volorder
57  {
58  ZYX = 0,
59  XYZ
60  };
61 }
62 
63 
65 {
66 public:
67  static int version() { return 1; }
68  struct Blocks
69  {
75  bool bfloat;
76  bool collate;
79 
80 
82  {
83  name = ""_UTsh;
84  target = 1;
85  tuplesize = 1;
86  type = 0;
87  precision = 2;
88  bfloat = false;
89  collate = false;
90  volres = UT_Vector3I(10,10,10);
91  volorder = 0;
92 
93  }
94 
95  bool operator==(const Blocks &src) const
96  {
97  if (name != src.name) return false;
98  if (target != src.target) return false;
99  if (tuplesize != src.tuplesize) return false;
100  if (type != src.type) return false;
101  if (precision != src.precision) return false;
102  if (bfloat != src.bfloat) return false;
103  if (collate != src.collate) return false;
104  if (volres != src.volres) return false;
105  if (volorder != src.volorder) return false;
106 
107  return true;
108  }
109  bool operator!=(const Blocks &src) const
110  {
111  return !operator==(src);
112  }
113 
114  };
115 
117  {
119 
120  buf.strcat("[ ");
121  for (int i = 0; i < list.entries(); i++)
122  {
123  if (i)
124  buf.strcat(", ");
125  buf.strcat("( ");
126  buf.append("");
127  { UT_String tmp; tmp = UT_StringWrap(list(i).name).makeQuotedString('"'); buf.strcat(tmp); }
128  buf.append(", ");
129  buf.appendSprintf("%d", (int) list(i).target);
130  buf.append(", ");
131  buf.appendSprintf("%d", (int) list(i).tuplesize);
132  buf.append(", ");
133  buf.appendSprintf("%d", (int) list(i).type);
134  buf.append(", ");
135  buf.appendSprintf("%d", (int) list(i).precision);
136  buf.append(", ");
137  buf.appendSprintf("%s", (list(i).bfloat) ? "true" : "false");
138  buf.append(", ");
139  buf.appendSprintf("%s", (list(i).collate) ? "true" : "false");
140  buf.append(", ");
141  buf.appendSprintf("(%" SYS_PRId64 ", %" SYS_PRId64 ", %" SYS_PRId64 ")", list(i).volres.x(), list(i).volres.y(), list(i).volres.z());
142  buf.append(", ");
143  buf.appendSprintf("%d", (int) list(i).volorder);
144 
145  buf.strcat(" )");
146  }
147  buf.strcat(" ]");
148 
150  return result;
151  }
152 
154  {
155  myFile = "default.raw"_UTsh;
156  raw_myFile = "default.raw"_UTsh;
157  myEndian = 0;
158  myPointCountType = 0;
159  myPointCount = 100;
160  myPointCountAttrib = "pointcount"_UTsh;
161  myBlocks.setSize(0);
162 
163  }
164 
165  explicit SOP_RawImportParms(const SOP_RawImportParms &) = default;
166  SOP_RawImportParms &operator=(const SOP_RawImportParms &) = default;
167  SOP_RawImportParms(SOP_RawImportParms &&) noexcept = default;
168  SOP_RawImportParms &operator=(SOP_RawImportParms &&) noexcept = default;
169 
170  ~SOP_RawImportParms() override {}
171 
172  bool operator==(const SOP_RawImportParms &src) const
173  {
174  if (myFile != src.myFile) return false;
175  if (raw_myFile != src.raw_myFile) return false;
176  if (myEndian != src.myEndian) return false;
177  if (myPointCountType != src.myPointCountType) return false;
178  if (myPointCount != src.myPointCount) return false;
179  if (myPointCountAttrib != src.myPointCountAttrib) return false;
180  if (myBlocks != src.myBlocks) return false;
181 
182  return true;
183  }
184  bool operator!=(const SOP_RawImportParms &src) const
185  {
186  return !operator==(src);
187  }
194 
195 
196 
197  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
198  {
199  myFile = "default.raw"_UTsh;
200  if (true)
201  graph->evalOpParm(myFile, nodeidx, "file", time, 0);
202  raw_myFile = "default.raw"_UTsh;
203  if (true)
204  graph->evalOpParmRaw(raw_myFile, nodeidx, "file", time, 0);
205  myEndian = 0;
206  if (true)
207  graph->evalOpParm(myEndian, nodeidx, "endian", time, 0);
208  myPointCountType = 0;
209  if (true)
210  graph->evalOpParm(myPointCountType, nodeidx, "pointcounttype", time, 0);
211  myPointCount = 100;
212  if (true && ( (true&&!(((int64(getPointCountType())!=1)))) ) )
213  graph->evalOpParm(myPointCount, nodeidx, "pointcount", time, 0);
214  myPointCountAttrib = "pointcount"_UTsh;
215  if (true && ( (true&&!(((int64(getPointCountType())!=2)))) ) )
216  graph->evalOpParm(myPointCountAttrib, nodeidx, "pointcountattrib", time, 0);
217  if (true)
218  {
219  int64 length = 0;
220  graph->evalOpParm(length, nodeidx, "blocks", time, 0);
221  if (length < 0) length = 0;
222  myBlocks.setSize(length);
223  for (exint i = 0; i < length; i++)
224  {
225  int parmidx[1];
226  int offsets[1];
227  parmidx[0] = i+1;
228  offsets[0] = 1;
229  auto && _curentry = myBlocks(i);
230  (void) _curentry;
231  _curentry.name = ""_UTsh;
232  if (true)
233  graph->evalOpParmInst(_curentry.name, nodeidx, "name#", parmidx, offsets, time, 0, 2-1);
234  _curentry.target = 1;
235  if (true)
236  graph->evalOpParmInst(_curentry.target, nodeidx, "target#", parmidx, offsets, time, 0, 2-1);
237  _curentry.tuplesize = 1;
238  if (true)
239  graph->evalOpParmInst(_curentry.tuplesize, nodeidx, "tuplesize#", parmidx, offsets, time, 0, 2-1);
240  _curentry.type = 0;
241  if (true)
242  graph->evalOpParmInst(_curentry.type, nodeidx, "type#", parmidx, offsets, time, 0, 2-1);
243  _curentry.precision = 2;
244  if (true)
245  graph->evalOpParmInst(_curentry.precision, nodeidx, "precision#", parmidx, offsets, time, 0, 2-1);
246  _curentry.bfloat = false;
247  if (true && ( (true&&!(((_curentry.type!=0))||((_curentry.precision!=1)))) ) )
248  graph->evalOpParmInst(_curentry.bfloat, nodeidx, "bfloat#", parmidx, offsets, time, 0, 2-1);
249  _curentry.collate = false;
250  if (true)
251  graph->evalOpParmInst(_curentry.collate, nodeidx, "collate#", parmidx, offsets, time, 0, 2-1);
252  _curentry.volres = UT_Vector3I(10,10,10);
253  if (true && ( (true&&!(((_curentry.target!=3))||((_curentry.collate==1)))) ) )
254  graph->evalOpParmInst(_curentry.volres, nodeidx, "volres#", parmidx, offsets, time, 0, 2-1);
255  _curentry.volorder = 0;
256  if (true && ( (true&&!(((_curentry.target!=3))||((_curentry.collate==1)))) ) )
257  graph->evalOpParmInst(_curentry.volorder, nodeidx, "volorder#", parmidx, offsets, time, 0, 2-1);
258 
259  }
260  }
261  else
262  myBlocks.clear();
263 
264  }
265 
266 
267  void loadFromOpSubclass(const LoadParms &loadparms) override
268  {
269  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
270  }
271 
272 
273  void copyFrom(const OP_NodeParms *src) override
274  {
275  *this = *((const SOP_RawImportParms *)src);
276  }
277 
278  template <typename T>
279  void
280  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
281  {
282  if (idx.size() < 1)
283  return;
284  UT_ASSERT(idx.size() == instance.size()+1);
285  if (idx.size() != instance.size()+1)
286  return;
287  switch (idx[0])
288  {
289  case 0:
290  coerceValue(value, myFile);
291  break;
292  case 1:
293  coerceValue(value, myEndian);
294  break;
295  case 2:
296  coerceValue(value, myPointCountType);
297  break;
298  case 3:
299  coerceValue(value, myPointCount);
300  break;
301  case 4:
302  coerceValue(value, myPointCountAttrib);
303  break;
304  case 5:
305  if (idx.size() == 1)
306  coerceValue(value, myBlocks.entries());
307  else if (instance[0] < myBlocks.entries())
308  {
309  auto && _data = myBlocks(instance[0]);
310  switch (idx[1])
311  {
312  case 0:
313  coerceValue(value, _data.name);
314  break;
315  case 1:
316  coerceValue(value, _data.target);
317  break;
318  case 2:
319  coerceValue(value, _data.tuplesize);
320  break;
321  case 3:
322  coerceValue(value, _data.type);
323  break;
324  case 4:
325  coerceValue(value, _data.precision);
326  break;
327  case 5:
328  coerceValue(value, _data.bfloat);
329  break;
330  case 6:
331  coerceValue(value, _data.collate);
332  break;
333  case 7:
334  coerceValue(value, _data.volres);
335  break;
336  case 8:
337  coerceValue(value, _data.volorder);
338  break;
339 
340  }
341  }
342  break;
343 
344  }
345  }
346 
347  bool isParmColorRamp(exint idx) const override
348  {
349  switch (idx)
350  {
351 
352  }
353  return false;
354  }
355 
356  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
357  { doGetParmValue(idx, instance, value); }
358  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
359  { doGetParmValue(idx, instance, value); }
360  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
361  { doGetParmValue(idx, instance, value); }
362  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
363  { doGetParmValue(idx, instance, value); }
364  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
365  { doGetParmValue(idx, instance, value); }
366  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
367  { doGetParmValue(idx, instance, value); }
368  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
369  { doGetParmValue(idx, instance, value); }
370  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
371  { doGetParmValue(idx, instance, value); }
372  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
373  { doGetParmValue(idx, instance, value); }
374  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
375  { doGetParmValue(idx, instance, value); }
376  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
377  { doGetParmValue(idx, instance, value); }
378 
379  template <typename T>
380  void
381  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
382  {
383  if (idx.size() < 1)
384  return;
385  UT_ASSERT(idx.size() == instance.size()+1);
386  if (idx.size() != instance.size()+1)
387  return;
388  switch (idx[0])
389  {
390  case 0:
391  coerceValue(myFile, ( ( value ) ));
392  break;
393  case 1:
394  coerceValue(myEndian, clampMinValue(0, clampMaxValue(1, value ) ));
395  break;
396  case 2:
397  coerceValue(myPointCountType, clampMinValue(0, clampMaxValue(3, value ) ));
398  break;
399  case 3:
400  coerceValue(myPointCount, clampMinValue(0, ( value ) ));
401  break;
402  case 4:
403  coerceValue(myPointCountAttrib, ( ( value ) ));
404  break;
405  case 5:
406  if (idx.size() == 1)
407  {
408  exint newsize;
409  coerceValue(newsize, value);
410  if (newsize < 0) newsize = 0;
411  myBlocks.setSize(newsize);
412  }
413  else
414  {
415  if (instance[0] < 0)
416  return;
417  myBlocks.setSizeIfNeeded(instance[0]+1);
418  auto && _data = myBlocks(instance[0]);
419  switch (idx[1])
420  {
421  case 0:
422  coerceValue(_data.name, value);
423  break;
424  case 1:
425  coerceValue(_data.target, value);
426  break;
427  case 2:
428  coerceValue(_data.tuplesize, value);
429  break;
430  case 3:
431  coerceValue(_data.type, value);
432  break;
433  case 4:
434  coerceValue(_data.precision, value);
435  break;
436  case 5:
437  coerceValue(_data.bfloat, value);
438  break;
439  case 6:
440  coerceValue(_data.collate, value);
441  break;
442  case 7:
443  coerceValue(_data.volres, value);
444  break;
445  case 8:
446  coerceValue(_data.volorder, value);
447  break;
448 
449  }
450  }
451  break;
452 
453  }
454  }
455 
456  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
457  { doSetParmValue(idx, instance, value); }
458  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
459  { doSetParmValue(idx, instance, value); }
460  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
461  { doSetParmValue(idx, instance, value); }
462  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
463  { doSetParmValue(idx, instance, value); }
464  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
465  { doSetParmValue(idx, instance, value); }
466  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
467  { doSetParmValue(idx, instance, value); }
468  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
469  { doSetParmValue(idx, instance, value); }
470  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
471  { doSetParmValue(idx, instance, value); }
472  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
473  { doSetParmValue(idx, instance, value); }
474  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
475  { doSetParmValue(idx, instance, value); }
476  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
477  { doSetParmValue(idx, instance, value); }
478 
479  exint getNestNumParms(TempIndex idx) const override
480  {
481  if (idx.size() == 0)
482  return 6;
483  switch (idx[0])
484  {
485  case 5:
486  return 9;
487 
488  }
489  // Invalid
490  return 0;
491  }
492 
493  const char *getNestParmName(TempIndex fieldnum) const override
494  {
495  if (fieldnum.size() < 1)
496  return 0;
497  switch (fieldnum[0])
498  {
499  case 0:
500  return "file";
501  case 1:
502  return "endian";
503  case 2:
504  return "pointcounttype";
505  case 3:
506  return "pointcount";
507  case 4:
508  return "pointcountattrib";
509  case 5:
510  if (fieldnum.size() == 1)
511  return "blocks";
512  switch (fieldnum[1])
513  {
514  case 0:
515  return "name#";
516  case 1:
517  return "target#";
518  case 2:
519  return "tuplesize#";
520  case 3:
521  return "type#";
522  case 4:
523  return "precision#";
524  case 5:
525  return "bfloat#";
526  case 6:
527  return "collate#";
528  case 7:
529  return "volres#";
530  case 8:
531  return "volorder#";
532 
533  }
534  return 0;
535 
536  }
537  return 0;
538  }
539 
540  ParmType getNestParmType(TempIndex fieldnum) const override
541  {
542  if (fieldnum.size() < 1)
543  return PARM_UNSUPPORTED;
544  switch (fieldnum[0])
545  {
546  case 0:
547  return PARM_STRING;
548  case 1:
549  return PARM_INTEGER;
550  case 2:
551  return PARM_INTEGER;
552  case 3:
553  return PARM_INTEGER;
554  case 4:
555  return PARM_STRING;
556  case 5:
557  if (fieldnum.size() == 1)
558  return PARM_MULTIPARM;
559  switch (fieldnum[1])
560  {
561  case 0:
562  return PARM_STRING;
563  case 1:
564  return PARM_INTEGER;
565  case 2:
566  return PARM_INTEGER;
567  case 3:
568  return PARM_INTEGER;
569  case 4:
570  return PARM_INTEGER;
571  case 5:
572  return PARM_INTEGER;
573  case 6:
574  return PARM_INTEGER;
575  case 7:
576  return PARM_VECTOR3;
577  case 8:
578  return PARM_INTEGER;
579 
580  }
581  return PARM_UNSUPPORTED;
582 
583  }
584  return PARM_UNSUPPORTED;
585  }
586 
587  // Boiler plate to load individual types.
588  static void loadData(UT_IStream &is, int64 &v)
589  { is.bread(&v, 1); }
590  static void loadData(UT_IStream &is, bool &v)
591  { int64 iv; is.bread(&iv, 1); v = iv; }
592  static void loadData(UT_IStream &is, fpreal64 &v)
593  { is.bread<fpreal64>(&v, 1); }
594  static void loadData(UT_IStream &is, UT_Vector2D &v)
595  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
596  static void loadData(UT_IStream &is, UT_Vector3D &v)
597  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
598  is.bread<fpreal64>(&v.z(), 1); }
599  static void loadData(UT_IStream &is, UT_Vector4D &v)
600  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
601  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
602  static void loadData(UT_IStream &is, UT_Matrix2D &v)
603  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
604  static void loadData(UT_IStream &is, UT_Matrix3D &v)
605  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
606  static void loadData(UT_IStream &is, UT_Matrix4D &v)
607  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
608  static void loadData(UT_IStream &is, UT_Vector2I &v)
609  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
610  static void loadData(UT_IStream &is, UT_Vector3I &v)
611  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
612  is.bread<int64>(&v.z(), 1); }
613  static void loadData(UT_IStream &is, UT_Vector4I &v)
614  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
615  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
617  { is.bread(v); }
619  { UT_StringHolder rampdata;
620  loadData(is, rampdata);
621  if (rampdata.isstring())
622  {
623  v.reset(new UT_Ramp());
624  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
625  v->load(istr);
626  }
627  else v.reset();
628  }
631  loadData(is, data);
632  if (data.isstring())
633  {
634  // Find the data type.
635  const char *colon = UT_StringWrap(data).findChar(':');
636  if (colon)
637  {
638  int typelen = colon - data.buffer();
640  type.strncpy(data.buffer(), typelen);
641  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
642 
643  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
644  }
645  }
646  else v.reset();
647  }
648 
649  static void saveData(std::ostream &os, int64 v)
650  { UTwrite(os, &v); }
651  static void saveData(std::ostream &os, bool v)
652  { int64 iv = v; UTwrite(os, &iv); }
653  static void saveData(std::ostream &os, fpreal64 v)
654  { UTwrite<fpreal64>(os, &v); }
655  static void saveData(std::ostream &os, UT_Vector2D v)
656  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
657  static void saveData(std::ostream &os, UT_Vector3D v)
658  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
659  UTwrite<fpreal64>(os, &v.z()); }
660  static void saveData(std::ostream &os, UT_Vector4D v)
661  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
662  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
663  static void saveData(std::ostream &os, UT_Matrix2D v)
665  static void saveData(std::ostream &os, UT_Matrix3D v)
667  static void saveData(std::ostream &os, UT_Matrix4D v)
669  static void saveData(std::ostream &os, UT_StringHolder s)
670  { UT_StringWrap(s).saveBinary(os); }
671  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
673  UT_OStringStream ostr;
674  if (s) s->save(ostr);
675  result = ostr.str();
676  saveData(os, result);
677  }
678  static void saveData(std::ostream &os, PRM_DataItemHandle s)
680  UT_OStringStream ostr;
681  if (s)
682  {
683  ostr << s->getDataTypeToken();
684  ostr << ":";
685  s->saveBinary(ostr);
686  }
687  result = ostr.str();
688  saveData(os, result);
689  }
690 
691 
692  void save(std::ostream &os) const
693  {
694  int32 v = version();
695  UTwrite(os, &v);
696  saveData(os, myFile);
697  saveData(os, raw_myFile);
698  saveData(os, myEndian);
699  saveData(os, myPointCountType);
700  saveData(os, myPointCount);
701  saveData(os, myPointCountAttrib);
702  {
703  int64 length = myBlocks.entries();
704  UTwrite(os, &length);
705  for (exint i = 0; i < length; i++)
706  {
707  auto && _curentry = myBlocks(i);
708  (void) _curentry;
709  saveData(os, _curentry.name);
710  saveData(os, _curentry.target);
711  saveData(os, _curentry.tuplesize);
712  saveData(os, _curentry.type);
713  saveData(os, _curentry.precision);
714  saveData(os, _curentry.bfloat);
715  saveData(os, _curentry.collate);
716  saveData(os, _curentry.volres);
717  saveData(os, _curentry.volorder);
718 
719  }
720  }
721 
722  }
723 
724  bool load(UT_IStream &is)
725  {
726  int32 v;
727  is.bread(&v, 1);
728  if (version() != v)
729  {
730  // Fail incompatible versions
731  return false;
732  }
733  loadData(is, myFile);
734  loadData(is, raw_myFile);
735  loadData(is, myEndian);
736  loadData(is, myPointCountType);
737  loadData(is, myPointCount);
738  loadData(is, myPointCountAttrib);
739  {
740  int64 length;
741  is.read(&length, 1);
742  myBlocks.setSize(length);
743  for (exint i = 0; i < length; i++)
744  {
745  auto && _curentry = myBlocks(i);
746  (void) _curentry;
747  loadData(is, _curentry.name);
748  loadData(is, _curentry.target);
749  loadData(is, _curentry.tuplesize);
750  loadData(is, _curentry.type);
751  loadData(is, _curentry.precision);
752  loadData(is, _curentry.bfloat);
753  loadData(is, _curentry.collate);
754  loadData(is, _curentry.volres);
755  loadData(is, _curentry.volorder);
756 
757  }
758  }
759 
760  return true;
761  }
762 
763  const UT_StringHolder & getFile() const { return myFile; }
764  void setFile(const UT_StringHolder & val) { myFile = val; }
766  {
767  SOP_Node *thissop = cookparms.getNode();
768  if (!thissop) return getFile();
770  OP_Utils::evalOpParm(result, thissop, "file", cookparms.getCookTime(), 0);
771  return result;
772  }
773  const UT_StringHolder & raw_getFile() const { return raw_myFile; }
774  void raw_setFile(const UT_StringHolder & val) { raw_myFile = val; }
776  {
777  SOP_Node *thissop = cookparms.getNode();
778  if (!thissop) return raw_getFile();
780  OP_Utils::evalOpParmRaw(result, thissop, "file", cookparms.getCookTime(), 0);
781  return result;
782  }
783  Endian getEndian() const { return Endian(myEndian); }
784  void setEndian(Endian val) { myEndian = int64(val); }
785  Endian opEndian(const SOP_NodeVerb::CookParms &cookparms) const
786  {
787  SOP_Node *thissop = cookparms.getNode();
788  if (!thissop) return getEndian();
789  int64 result;
790  OP_Utils::evalOpParm(result, thissop, "endian", cookparms.getCookTime(), 0);
791  return Endian(result);
792  }
793  PointCountType getPointCountType() const { return PointCountType(myPointCountType); }
794  void setPointCountType(PointCountType val) { myPointCountType = int64(val); }
796  {
797  SOP_Node *thissop = cookparms.getNode();
798  if (!thissop) return getPointCountType();
799  int64 result;
800  OP_Utils::evalOpParm(result, thissop, "pointcounttype", cookparms.getCookTime(), 0);
801  return PointCountType(result);
802  }
803  int64 getPointCount() const { return myPointCount; }
804  void setPointCount(int64 val) { myPointCount = val; }
806  {
807  SOP_Node *thissop = cookparms.getNode();
808  if (!thissop) return getPointCount();
809  int64 result;
810  OP_Utils::evalOpParm(result, thissop, "pointcount", cookparms.getCookTime(), 0);
811  return result;
812  }
813  const UT_StringHolder & getPointCountAttrib() const { return myPointCountAttrib; }
814  void setPointCountAttrib(const UT_StringHolder & val) { myPointCountAttrib = val; }
816  {
817  SOP_Node *thissop = cookparms.getNode();
818  if (!thissop) return getPointCountAttrib();
820  OP_Utils::evalOpParm(result, thissop, "pointcountattrib", cookparms.getCookTime(), 0);
821  return result;
822  }
823  const UT_Array<Blocks> &getBlocks() const { return myBlocks; }
824 void setBlocks(const UT_Array<Blocks> &val) { myBlocks = val; }
825  exint opBlocks(const SOP_NodeVerb::CookParms &cookparms) const
826  {
827  SOP_Node *thissop = cookparms.getNode();
828  if (!thissop) return getBlocks().entries();
829  exint result;
830  OP_Utils::evalOpParm(result, thissop, "blocks", cookparms.getCookTime(), 0);
831  return result;
832  }
833  UT_StringHolder opBlocks_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
834  { return opinstBlocks_name(cookparms, &_idx); }
835  UT_StringHolder opinstBlocks_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
836  {
837  SOP_Node *thissop = cookparms.getNode();
838  if (!thissop) return (myBlocks(_idx[0]).name);
839  int _parmidx[2-1];
840  _parmidx[1-1] = _idx[1-1] + 1;
841 
843  OP_Utils::evalOpParmInst(result, thissop, "name#", _parmidx, cookparms.getCookTime(), 0, 2-1);
844  return (result);
845  }
846  int64 opBlocks_target(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
847  { return opinstBlocks_target(cookparms, &_idx); }
848  int64 opinstBlocks_target(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
849  {
850  SOP_Node *thissop = cookparms.getNode();
851  if (!thissop) return (myBlocks(_idx[0]).target);
852  int _parmidx[2-1];
853  _parmidx[1-1] = _idx[1-1] + 1;
854 
855  int64 result;
856  OP_Utils::evalOpParmInst(result, thissop, "target#", _parmidx, cookparms.getCookTime(), 0, 2-1);
857  return (result);
858  }
859  int64 opBlocks_tuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
860  { return opinstBlocks_tuplesize(cookparms, &_idx); }
861  int64 opinstBlocks_tuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
862  {
863  SOP_Node *thissop = cookparms.getNode();
864  if (!thissop) return (myBlocks(_idx[0]).tuplesize);
865  int _parmidx[2-1];
866  _parmidx[1-1] = _idx[1-1] + 1;
867 
868  int64 result;
869  OP_Utils::evalOpParmInst(result, thissop, "tuplesize#", _parmidx, cookparms.getCookTime(), 0, 2-1);
870  return (result);
871  }
872  int64 opBlocks_type(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
873  { return opinstBlocks_type(cookparms, &_idx); }
874  int64 opinstBlocks_type(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
875  {
876  SOP_Node *thissop = cookparms.getNode();
877  if (!thissop) return (myBlocks(_idx[0]).type);
878  int _parmidx[2-1];
879  _parmidx[1-1] = _idx[1-1] + 1;
880 
881  int64 result;
882  OP_Utils::evalOpParmInst(result, thissop, "type#", _parmidx, cookparms.getCookTime(), 0, 2-1);
883  return (result);
884  }
885  int64 opBlocks_precision(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
886  { return opinstBlocks_precision(cookparms, &_idx); }
887  int64 opinstBlocks_precision(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
888  {
889  SOP_Node *thissop = cookparms.getNode();
890  if (!thissop) return (myBlocks(_idx[0]).precision);
891  int _parmidx[2-1];
892  _parmidx[1-1] = _idx[1-1] + 1;
893 
894  int64 result;
895  OP_Utils::evalOpParmInst(result, thissop, "precision#", _parmidx, cookparms.getCookTime(), 0, 2-1);
896  return (result);
897  }
898  bool opBlocks_bfloat(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
899  { return opinstBlocks_bfloat(cookparms, &_idx); }
900  bool opinstBlocks_bfloat(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
901  {
902  SOP_Node *thissop = cookparms.getNode();
903  if (!thissop) return (myBlocks(_idx[0]).bfloat);
904  int _parmidx[2-1];
905  _parmidx[1-1] = _idx[1-1] + 1;
906 
907  bool result;
908  OP_Utils::evalOpParmInst(result, thissop, "bfloat#", _parmidx, cookparms.getCookTime(), 0, 2-1);
909  return (result);
910  }
911  bool opBlocks_collate(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
912  { return opinstBlocks_collate(cookparms, &_idx); }
913  bool opinstBlocks_collate(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
914  {
915  SOP_Node *thissop = cookparms.getNode();
916  if (!thissop) return (myBlocks(_idx[0]).collate);
917  int _parmidx[2-1];
918  _parmidx[1-1] = _idx[1-1] + 1;
919 
920  bool result;
921  OP_Utils::evalOpParmInst(result, thissop, "collate#", _parmidx, cookparms.getCookTime(), 0, 2-1);
922  return (result);
923  }
924  UT_Vector3I opBlocks_volres(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
925  { return opinstBlocks_volres(cookparms, &_idx); }
926  UT_Vector3I opinstBlocks_volres(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
927  {
928  SOP_Node *thissop = cookparms.getNode();
929  if (!thissop) return (myBlocks(_idx[0]).volres);
930  int _parmidx[2-1];
931  _parmidx[1-1] = _idx[1-1] + 1;
932 
934  OP_Utils::evalOpParmInst(result, thissop, "volres#", _parmidx, cookparms.getCookTime(), 0, 2-1);
935  return (result);
936  }
937  int64 opBlocks_volorder(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
938  { return opinstBlocks_volorder(cookparms, &_idx); }
939  int64 opinstBlocks_volorder(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
940  {
941  SOP_Node *thissop = cookparms.getNode();
942  if (!thissop) return (myBlocks(_idx[0]).volorder);
943  int _parmidx[2-1];
944  _parmidx[1-1] = _idx[1-1] + 1;
945 
946  int64 result;
947  OP_Utils::evalOpParmInst(result, thissop, "volorder#", _parmidx, cookparms.getCookTime(), 0, 2-1);
948  return (result);
949  }
950 
951 
952 private:
953  UT_StringHolder myFile;
954  UT_StringHolder raw_myFile;
955  int64 myEndian;
956  int64 myPointCountType;
957  int64 myPointCount;
958  UT_StringHolder myPointCountAttrib;
959  UT_Array<Blocks> myBlocks;
960 
961 };
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
int64 opBlocks_tuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void saveData(std::ostream &os, int64 v)
bool operator!=(const Blocks &src) const
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
bool operator!=(const SOP_RawImportParms &src) const
static void saveData(std::ostream &os, UT_Matrix2D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
void loadFromOpSubclass(const LoadParms &loadparms) override
PointCountType getPointCountType() const
void copyFrom(const OP_NodeParms *src) override
T clampMaxValue(fpreal maxvalue, const T &src) const
Definition: OP_NodeParms.h:315
void
Definition: png.h:1083
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
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setPointCount(int64 val)
UT_StringHolder opPointCountAttrib(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
const UT_Array< Blocks > & getBlocks() const
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
virtual void evalOpParmRaw(UT_StringHolder &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
static void saveData(std::ostream &os, UT_Matrix3D v)
An output stream object that owns its own string buffer storage.
int64 opinstBlocks_type(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
bool operator==(const SOP_RawImportParms &src) const
static void loadData(UT_IStream &is, int64 &v)
**But if you need a result
Definition: thread.h:613
UT_Vector3T< int64 > UT_Vector3I
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
T clampMinValue(fpreal minvalue, const T &src) const
Definition: OP_NodeParms.h:308
UT_Vector3I opinstBlocks_volres(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
int64 opinstBlocks_target(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
exint getNestNumParms(TempIndex idx) const override
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
bool isParmColorRamp(exint idx) const override
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
PointCountType opPointCountType(const SOP_NodeVerb::CookParms &cookparms) const
int64 opinstBlocks_tuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setFile(const UT_StringHolder &val)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void setPointCountType(PointCountType val)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
const char * getNestParmName(TempIndex fieldnum) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
UT_StringHolder opFile(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, bool &v)
int64 opinstBlocks_precision(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool opinstBlocks_bfloat(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_StringHolder createString(const UT_Array< Blocks > &list) const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
void setBlocks(const UT_Array< Blocks > &val)
void setEndian(Endian val)
static void loadData(UT_IStream &is, UT_StringHolder &v)
const UT_StringHolder & getFile() const
exint length() const
void setPointCountAttrib(const UT_StringHolder &val)
bool opBlocks_collate(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
bool opinstBlocks_collate(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
ParmType getNestParmType(TempIndex fieldnum) const override
int64 opBlocks_volorder(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
int64 opPointCount(const SOP_NodeVerb::CookParms &cookparms) const
const UT_StringHolder & getPointCountAttrib() const
UT_StringHolder opinstBlocks_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool opBlocks_bfloat(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
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
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
long long int64
Definition: SYS_Types.h:116
GLenum target
Definition: glcorearb.h:1667
exint opBlocks(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
int64 opBlocks_type(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
GLuint const GLchar * name
Definition: glcorearb.h:786
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
UT_Vector3I opBlocks_volres(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void raw_setFile(const UT_StringHolder &val)
SYS_FORCE_INLINE void strcat(const char *src)
static void saveData(std::ostream &os, bool v)
UT_StringHolder opBlocks_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
bool operator==(const Blocks &src) const
GT_API const UT_StringHolder version
GLenum GLint GLint * precision
Definition: glcorearb.h:1925
#define SYS_PRId64
Definition: SYS_Types.h:76
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
int64 opBlocks_target(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void coerceValue(T &result, const S &src) const
Definition: OP_NodeParms.h:301
int64 opBlocks_precision(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
bool load(UT_IStream &is)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
static void saveData(std::ostream &os, UT_Matrix4D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:88
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
int64 getPointCount() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void saveData(std::ostream &os, UT_Vector3D v)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
GLuint GLfloat * val
Definition: glcorearb.h:1608
int64 opinstBlocks_volorder(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
#define SOP_API
Definition: SOP_API.h:10
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void loadData(UT_IStream &is, fpreal64 &v)
const UT_StringHolder & raw_getFile() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, UT_Vector4D v)
const char * findChar(int c) const
Definition: UT_String.h:1385
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
GLboolean r
Definition: glcorearb.h:1222
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
type
Definition: core.h:1059
Endian getEndian() const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
void save(std::ostream &os) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, UT_StringHolder s)
UT_StringHolder raw_opFile(const SOP_NodeVerb::CookParms &cookparms) const
OP_NodeParms & operator=(const OP_NodeParms &)=default
Endian opEndian(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
static void saveData(std::ostream &os, fpreal64 v)
static void saveData(std::ostream &os, UT_Vector2D v)
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663