HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_AttribCreate-2.0.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SOP/SOP_NodeVerb.h>
7 #include <OP/OP_Utils.h>
8 #include <PRM/PRM_Parm.h>
9 #include <UT/UT_IStream.h>
10 #include <UT/UT_NTStreamUtil.h>
11 #include <UT/UT_Ramp.h>
12 #include <UT/UT_SharedPtr.h>
13 #include <UT/UT_StringHolder.h>
14 #include <UT/UT_StringStream.h>
15 #include <UT/UT_VectorTypes.h>
16 #include <SYS/SYS_Types.h>
17 
18 using namespace UT::Literal;
19 
20 class DEP_MicroNode;
21 namespace SOP_AttribCreate_2_0Enums
22 {
23  enum class Grouptype
24  {
25  GUESS = 0,
26  VERTICES,
27  EDGES,
28  POINTS,
29  PRIMS
30  };
31  enum class Existing
32  {
33  ERROR = 0,
34  WARN,
35  REPLACE,
36  BETTER
37  };
38  enum class Class
39  {
40  DETAIL = 0,
41  PRIMITIVE,
42  POINT,
43  VERTEX
44  };
45  enum class Type
46  {
47  FLOAT = 0,
48  INT,
49  VECTOR,
50  INDEX,
51  FLOATARRAY,
52  INTARRAY,
54  };
55  enum class Typeinfo
56  {
57  GUESS = 0,
58  NONE,
59  POINT,
60  VECTOR,
61  NORMAL,
62  COLOR,
63  QUATERNION,
64  TRANFORM,
66  };
67  enum class Precision
68  {
69  _8 = 0,
70  _16,
71  _32,
72  _64,
73  AUTO
74  };
75 }
76 
77 
79 {
80 public:
81  static int version() { return 1; }
82  struct Numattr
83  {
84  bool enable;
90  bool savetoinfo;
97  bool uselocal;
100 
101 
103  {
104  enable = true;
105  name = "attribute#"_sh;
106  existing = 3;
107  createvarmap = false;
108  varname = ""_sh;
109  _class = 2;
110  savetoinfo = false;
111  type = 0;
112  typeinfo = 0;
113  precision = 4;
114  size = 1;
115  defaultv = UT_Vector4D(0,0,0,0);
116  writevalues = true;
117  uselocal = true;
118  valuev = UT_Vector4D(0,0,0,0);
119  string = ""_sh;
120 
121  }
122 
123  bool operator==(const Numattr &src) const
124  {
125  if (enable != src.enable) return false;
126  if (name != src.name) return false;
127  if (existing != src.existing) return false;
128  if (createvarmap != src.createvarmap) return false;
129  if (varname != src.varname) return false;
130  if (_class != src._class) return false;
131  if (savetoinfo != src.savetoinfo) return false;
132  if (type != src.type) return false;
133  if (typeinfo != src.typeinfo) return false;
134  if (precision != src.precision) return false;
135  if (size != src.size) return false;
136  if (defaultv != src.defaultv) return false;
137  if (writevalues != src.writevalues) return false;
138  if (uselocal != src.uselocal) return false;
139  if (valuev != src.valuev) return false;
140  if (string != src.string) return false;
141 
142  return true;
143  }
144  bool operator!=(const Numattr &src) const
145  {
146  return !operator==(src);
147  }
148 
149  };
150 
152  {
154 
155  buf.strcat("[ ");
156  for (int i = 0; i < list.entries(); i++)
157  {
158  if (i)
159  buf.strcat(", ");
160  buf.strcat("( ");
161  buf.append("");
162  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
163  buf.append(", ");
164  { UT_String tmp; tmp = UT_StringWrap(list(i).name).makeQuotedString('"'); buf.strcat(tmp); }
165  buf.append(", ");
166  buf.appendSprintf("%d", (int) list(i).existing);
167  buf.append(", ");
168  buf.appendSprintf("%s", (list(i).createvarmap) ? "true" : "false");
169  buf.append(", ");
170  { UT_String tmp; tmp = UT_StringWrap(list(i).varname).makeQuotedString('"'); buf.strcat(tmp); }
171  buf.append(", ");
172  buf.appendSprintf("%d", (int) list(i)._class);
173  buf.append(", ");
174  buf.appendSprintf("%s", (list(i).savetoinfo) ? "true" : "false");
175  buf.append(", ");
176  buf.appendSprintf("%d", (int) list(i).type);
177  buf.append(", ");
178  buf.appendSprintf("%d", (int) list(i).typeinfo);
179  buf.append(", ");
180  buf.appendSprintf("%d", (int) list(i).precision);
181  buf.append(", ");
182  buf.appendSprintf("%d", (int) list(i).size);
183  buf.append(", ");
184  buf.appendSprintf("(%f, %f, %f, %f)", list(i).defaultv.x(), list(i).defaultv.y(), list(i).defaultv.z(), list(i).defaultv.w());
185  buf.append(", ");
186  buf.appendSprintf("%s", (list(i).writevalues) ? "true" : "false");
187  buf.append(", ");
188  buf.appendSprintf("%s", (list(i).uselocal) ? "true" : "false");
189  buf.append(", ");
190  buf.appendSprintf("(%f, %f, %f, %f)", list(i).valuev.x(), list(i).valuev.y(), list(i).valuev.z(), list(i).valuev.w());
191  buf.append(", ");
192  { UT_String tmp; tmp = UT_StringWrap(list(i).string).makeQuotedString('"'); buf.strcat(tmp); }
193 
194  buf.strcat(" )");
195  }
196  buf.strcat(" ]");
197 
199  return result;
200  }
201 
203  {
204  myGroup = ""_sh;
205  myGrouptype = 0;
206  myEncodenames = false;
207 
208  }
209 
210  explicit SOP_AttribCreate_2_0Parms(const SOP_AttribCreate_2_0Parms &) = default;
211 
213 
215  {
216  if (myGroup != src.myGroup) return false;
217  if (myGrouptype != src.myGrouptype) return false;
218  if (myEncodenames != src.myEncodenames) return false;
219  if (myNumattr != src.myNumattr) return false;
220 
221  return true;
222  }
224  {
225  return !operator==(src);
226  }
233 
234 
235 
236  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
237  {
238  if (true)
239  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
240  else myGroup = ""_sh;
241  if (true)
242  OP_Utils::evalOpParm(myGrouptype, node, "grouptype", time, 0);
243  else myGrouptype = 0;
244  if (true)
245  OP_Utils::evalOpParm(myEncodenames, node, "encodenames", time, 0);
246  else myEncodenames = false;
247  if (true)
248  {
249  int64 length;
250  OP_Utils::evalOpParm(length, node, "numattr", time, 0);
251  myNumattr.entries(length);
252  for (exint i = 0; i < length; i++)
253  {
254  int parmidx = i+1;
255  auto && _curentry = myNumattr(i);
256  (void) _curentry;
257  if (true)
258  OP_Utils::evalOpParmInst(myNumattr(i).enable, node, "enable#", &parmidx, time, 0);
259  else myNumattr(i).enable = true;
260  if (true && ( (!(((_curentry.enable==0)))) ) )
261  OP_Utils::evalOpParmInst(myNumattr(i).name, node, "name#", &parmidx, time, 0);
262  else myNumattr(i).name = "attribute#"_sh;
263  if (true && ( (!(((_curentry.enable==0)))) ) )
264  OP_Utils::evalOpParmInst(myNumattr(i).existing, node, "existing#", &parmidx, time, 0);
265  else myNumattr(i).existing = 3;
266  if (true && ( (!(((_curentry.enable==0)))) ) )
267  OP_Utils::evalOpParmInst(myNumattr(i).createvarmap, node, "createvarmap#", &parmidx, time, 0);
268  else myNumattr(i).createvarmap = false;
269  if (true && ( (!(((_curentry.enable==0))||((_curentry.createvarmap==0)))) ) )
270  OP_Utils::evalOpParmInst(myNumattr(i).varname, node, "varname#", &parmidx, time, 0);
271  else myNumattr(i).varname = ""_sh;
272  if (true && ( (!(((_curentry.enable==0)))) ) )
273  OP_Utils::evalOpParmInst(myNumattr(i)._class, node, "class#", &parmidx, time, 0);
274  else myNumattr(i)._class = 2;
275  if (true && ( (!(((_curentry.enable==0))||((_curentry._class!=0)))) ) )
276  OP_Utils::evalOpParmInst(myNumattr(i).savetoinfo, node, "savetoinfo#", &parmidx, time, 0);
277  else myNumattr(i).savetoinfo = false;
278  if (true && ( (!(((_curentry.enable==0)))) ) )
279  OP_Utils::evalOpParmInst(myNumattr(i).type, node, "type#", &parmidx, time, 0);
280  else myNumattr(i).type = 0;
281  if (true && ( (!(((_curentry.enable==0))||((_curentry.type!=0)))) ) )
282  OP_Utils::evalOpParmInst(myNumattr(i).typeinfo, node, "typeinfo#", &parmidx, time, 0);
283  else myNumattr(i).typeinfo = 0;
284  if (true && ( (!(((_curentry.enable==0))||((_curentry.type==3))||((_curentry.type==6)))) ) )
285  OP_Utils::evalOpParmInst(myNumattr(i).precision, node, "precision#", &parmidx, time, 0);
286  else myNumattr(i).precision = 4;
287  if (true && ( (!(((_curentry.enable==0))||((_curentry.type==2))||((_curentry.type==3)))) ) )
288  OP_Utils::evalOpParmInst(myNumattr(i).size, node, "size#", &parmidx, time, 0);
289  else myNumattr(i).size = 1;
290  if (true && ( (!(((_curentry.enable==0))||((_curentry.type==3))||((_curentry.type==4))||((_curentry.type==5))||((_curentry.type==6)))) ) )
291  OP_Utils::evalOpParmInst(myNumattr(i).defaultv, node, "default#v", &parmidx, time, 0);
292  else myNumattr(i).defaultv = UT_Vector4D(0,0,0,0);
293  if (true && ( (!(((_curentry.enable==0))||((_curentry.type==4))||((_curentry.type==5))||((_curentry.type==6)))) ) )
294  OP_Utils::evalOpParmInst(myNumattr(i).writevalues, node, "writevalues#", &parmidx, time, 0);
295  else myNumattr(i).writevalues = true;
296  if (true && ( (!(((_curentry.enable==0))||((_curentry.writevalues==0))||((_curentry.type==4))||((_curentry.type==5))||((_curentry.type==6)))) ) )
297  OP_Utils::evalOpParmInst(myNumattr(i).uselocal, node, "uselocal#", &parmidx, time, 0);
298  else myNumattr(i).uselocal = true;
299  if (true && ( (!(((_curentry.enable==0))||((_curentry.writevalues==0))||((_curentry.type!=0)&&(_curentry.type!=1)&&(_curentry.type!=2)))) ) )
300  OP_Utils::evalOpParmInst(myNumattr(i).valuev, node, "value#v", &parmidx, time, 0);
301  else myNumattr(i).valuev = UT_Vector4D(0,0,0,0);
302  if (true && ( (!(((_curentry.enable==0))||((_curentry.writevalues==0))||((_curentry.type!=3)))) ) )
303  OP_Utils::evalOpParmInst(myNumattr(i).string, node, "string#", &parmidx, time, 0);
304  else myNumattr(i).string = ""_sh;
305 
306  }
307  }
308  else
309  myNumattr.clear();
310 
311  }
312 
313 
314  virtual void loadFromOpSubclass(const LoadParms &loadparms)
315  {
316  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
317  }
318 
319 
320  virtual void copyFrom(const SOP_NodeParms *src)
321  {
322  *this = *((const SOP_AttribCreate_2_0Parms *)src);
323  }
324 
325  template <typename T>
326  void
327  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
328  {
329  if (idx.size() < 1)
330  return;
331  UT_ASSERT(idx.size() == instance.size()+1);
332  if (idx.size() != instance.size()+1)
333  return;
334  switch (idx[0])
335  {
336  case 0:
337  coerceValue(value, myGroup);
338  break;
339  case 1:
340  coerceValue(value, myGrouptype);
341  break;
342  case 2:
343  coerceValue(value, myEncodenames);
344  break;
345  case 3:
346  if (idx.size() == 1)
347  coerceValue(value, myNumattr.entries());
348  else if (instance[0] < myNumattr.entries())
349  {
350  auto && _data = myNumattr(instance[0]);
351  switch (idx[1])
352  {
353  case 0:
354  coerceValue(value, _data.enable);
355  break;
356  case 1:
357  coerceValue(value, _data.name);
358  break;
359  case 2:
360  coerceValue(value, _data.existing);
361  break;
362  case 3:
363  coerceValue(value, _data.createvarmap);
364  break;
365  case 4:
366  coerceValue(value, _data.varname);
367  break;
368  case 5:
369  coerceValue(value, _data._class);
370  break;
371  case 6:
372  coerceValue(value, _data.savetoinfo);
373  break;
374  case 7:
375  coerceValue(value, _data.type);
376  break;
377  case 8:
378  coerceValue(value, _data.typeinfo);
379  break;
380  case 9:
381  coerceValue(value, _data.precision);
382  break;
383  case 10:
384  coerceValue(value, _data.size);
385  break;
386  case 11:
387  coerceValue(value, _data.defaultv);
388  break;
389  case 12:
390  coerceValue(value, _data.writevalues);
391  break;
392  case 13:
393  coerceValue(value, _data.uselocal);
394  break;
395  case 14:
396  coerceValue(value, _data.valuev);
397  break;
398  case 15:
399  coerceValue(value, _data.string);
400  break;
401 
402  }
403  }
404  break;
405 
406  }
407  }
408 
409  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const
410  { doGetParmValue(idx, instance, value); }
411  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const
412  { doGetParmValue(idx, instance, value); }
414  { doGetParmValue(idx, instance, value); }
416  { doGetParmValue(idx, instance, value); }
418  { doGetParmValue(idx, instance, value); }
420  { doGetParmValue(idx, instance, value); }
422  { doGetParmValue(idx, instance, value); }
424  { doGetParmValue(idx, instance, value); }
426  { doGetParmValue(idx, instance, value); }
428  { doGetParmValue(idx, instance, value); }
430  { doGetParmValue(idx, instance, value); }
431 
432  template <typename T>
433  void
434  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
435  {
436  if (idx.size() < 1)
437  return;
438  UT_ASSERT(idx.size() == instance.size()+1);
439  if (idx.size() != instance.size()+1)
440  return;
441  switch (idx[0])
442  {
443  case 0:
444  coerceValue(myGroup, value);
445  break;
446  case 1:
447  coerceValue(myGrouptype, value);
448  break;
449  case 2:
450  coerceValue(myEncodenames, value);
451  break;
452  case 3:
453  if (idx.size() == 1)
454  {
455  exint newsize;
456  coerceValue(newsize, value);
457  myNumattr.setSize(newsize);
458  }
459  else
460  {
461  myNumattr.setSizeIfNeeded(instance[0]+1);
462  auto && _data = myNumattr(instance[0]);
463  switch (idx[1])
464  {
465  case 0:
466  coerceValue(_data.enable, value);
467  break;
468  case 1:
469  coerceValue(_data.name, value);
470  break;
471  case 2:
472  coerceValue(_data.existing, value);
473  break;
474  case 3:
475  coerceValue(_data.createvarmap, value);
476  break;
477  case 4:
478  coerceValue(_data.varname, value);
479  break;
480  case 5:
481  coerceValue(_data._class, value);
482  break;
483  case 6:
484  coerceValue(_data.savetoinfo, value);
485  break;
486  case 7:
487  coerceValue(_data.type, value);
488  break;
489  case 8:
490  coerceValue(_data.typeinfo, value);
491  break;
492  case 9:
493  coerceValue(_data.precision, value);
494  break;
495  case 10:
496  coerceValue(_data.size, value);
497  break;
498  case 11:
499  coerceValue(_data.defaultv, value);
500  break;
501  case 12:
502  coerceValue(_data.writevalues, value);
503  break;
504  case 13:
505  coerceValue(_data.uselocal, value);
506  break;
507  case 14:
508  coerceValue(_data.valuev, value);
509  break;
510  case 15:
511  coerceValue(_data.string, value);
512  break;
513 
514  }
515  }
516  break;
517 
518  }
519  }
520 
521  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value)
522  { doSetParmValue(idx, instance, value); }
523  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value)
524  { doSetParmValue(idx, instance, value); }
525  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value)
526  { doSetParmValue(idx, instance, value); }
527  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value)
528  { doSetParmValue(idx, instance, value); }
529  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value)
530  { doSetParmValue(idx, instance, value); }
531  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value)
532  { doSetParmValue(idx, instance, value); }
533  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value)
534  { doSetParmValue(idx, instance, value); }
535  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value)
536  { doSetParmValue(idx, instance, value); }
538  { doSetParmValue(idx, instance, value); }
540  { doSetParmValue(idx, instance, value); }
542  { doSetParmValue(idx, instance, value); }
543 
544  virtual exint getNestNumParms(TempIndex idx) const
545  {
546  if (idx.size() == 0)
547  return 4;
548  switch (idx[0])
549  {
550  case 3:
551  return 16;
552 
553  }
554  // Invalid
555  return 0;
556  }
557 
558  virtual const char *getNestParmName(TempIndex fieldnum) const
559  {
560  if (fieldnum.size() < 1)
561  return 0;
562  switch (fieldnum[0])
563  {
564  case 0:
565  return "group";
566  case 1:
567  return "grouptype";
568  case 2:
569  return "encodenames";
570  case 3:
571  if (fieldnum.size() == 1)
572  return "numattr";
573  switch (fieldnum[1])
574  {
575  case 0:
576  return "enable#";
577  case 1:
578  return "name#";
579  case 2:
580  return "existing#";
581  case 3:
582  return "createvarmap#";
583  case 4:
584  return "varname#";
585  case 5:
586  return "class#";
587  case 6:
588  return "savetoinfo#";
589  case 7:
590  return "type#";
591  case 8:
592  return "typeinfo#";
593  case 9:
594  return "precision#";
595  case 10:
596  return "size#";
597  case 11:
598  return "default#v";
599  case 12:
600  return "writevalues#";
601  case 13:
602  return "uselocal#";
603  case 14:
604  return "value#v";
605  case 15:
606  return "string#";
607 
608  }
609  return 0;
610 
611  }
612  return 0;
613  }
614 
615  virtual ParmType getNestParmType(TempIndex fieldnum) const
616  {
617  if (fieldnum.size() < 1)
618  return PARM_UNSUPPORTED;
619  switch (fieldnum[0])
620  {
621  case 0:
622  return PARM_STRING;
623  case 1:
624  return PARM_INTEGER;
625  case 2:
626  return PARM_INTEGER;
627  case 3:
628  if (fieldnum.size() == 1)
629  return PARM_MULTIPARM;
630  switch (fieldnum[1])
631  {
632  case 0:
633  return PARM_INTEGER;
634  case 1:
635  return PARM_STRING;
636  case 2:
637  return PARM_INTEGER;
638  case 3:
639  return PARM_INTEGER;
640  case 4:
641  return PARM_STRING;
642  case 5:
643  return PARM_INTEGER;
644  case 6:
645  return PARM_INTEGER;
646  case 7:
647  return PARM_INTEGER;
648  case 8:
649  return PARM_INTEGER;
650  case 9:
651  return PARM_INTEGER;
652  case 10:
653  return PARM_INTEGER;
654  case 11:
655  return PARM_VECTOR4;
656  case 12:
657  return PARM_INTEGER;
658  case 13:
659  return PARM_INTEGER;
660  case 14:
661  return PARM_VECTOR4;
662  case 15:
663  return PARM_STRING;
664 
665  }
666  return PARM_UNSUPPORTED;
667 
668  }
669  return PARM_UNSUPPORTED;
670  }
671 
672  // Boiler plate to load individual types.
673  static void loadData(UT_IStream &is, int64 &v)
674  { is.bread(&v, 1); }
675  static void loadData(UT_IStream &is, bool &v)
676  { int64 iv; is.bread(&iv, 1); v = iv; }
677  static void loadData(UT_IStream &is, fpreal64 &v)
678  { is.bread<fpreal64>(&v, 1); }
679  static void loadData(UT_IStream &is, UT_Vector2D &v)
680  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
681  static void loadData(UT_IStream &is, UT_Vector3D &v)
682  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
683  is.bread<fpreal64>(&v.z(), 1); }
684  static void loadData(UT_IStream &is, UT_Vector4D &v)
685  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
686  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
687  static void loadData(UT_IStream &is, UT_Matrix2D &v)
688  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
689  static void loadData(UT_IStream &is, UT_Matrix3D &v)
690  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
691  static void loadData(UT_IStream &is, UT_Matrix4D &v)
692  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
693  static void loadData(UT_IStream &is, UT_Vector2I &v)
694  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
695  static void loadData(UT_IStream &is, UT_Vector3I &v)
696  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
697  is.bread<int64>(&v.z(), 1); }
698  static void loadData(UT_IStream &is, UT_Vector4I &v)
699  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
700  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
702  { is.bread(v); }
704  { UT_StringHolder rampdata;
705  loadData(is, rampdata);
706  if (rampdata.isstring())
707  {
708  v.reset(new UT_Ramp());
709  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
710  v->load(istr);
711  }
712  else v.reset();
713  }
716  loadData(is, data);
717  if (data.isstring())
718  {
719  // Find the data type.
720  const char *colon = UT_StringWrap(data).findChar(':');
721  if (colon)
722  {
723  int typelen = colon - data.buffer();
725  type.strncpy(data.buffer(), typelen);
726  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
727 
728  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
729  }
730  }
731  else v.reset();
732  }
733 
734  static void saveData(std::ostream &os, int64 v)
735  { UTwrite(os, &v); }
736  static void saveData(std::ostream &os, bool v)
737  { int64 iv = v; UTwrite(os, &iv); }
738  static void saveData(std::ostream &os, fpreal64 v)
739  { UTwrite<fpreal64>(os, &v); }
740  static void saveData(std::ostream &os, UT_Vector2D v)
741  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
742  static void saveData(std::ostream &os, UT_Vector3D v)
743  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
744  UTwrite<fpreal64>(os, &v.z()); }
745  static void saveData(std::ostream &os, UT_Vector4D v)
746  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
747  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
748  static void saveData(std::ostream &os, UT_Matrix2D v)
750  static void saveData(std::ostream &os, UT_Matrix3D v)
752  static void saveData(std::ostream &os, UT_Matrix4D v)
754  static void saveData(std::ostream &os, UT_StringHolder s)
755  { UT_StringWrap(s).saveBinary(os); }
756  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
758  UT_OStringStream ostr;
759  if (s) s->save(ostr);
760  result = ostr.str();
761  saveData(os, result);
762  }
763  static void saveData(std::ostream &os, PRM_DataItemHandle s)
765  UT_OStringStream ostr;
766  if (s)
767  {
768  ostr << s->getDataTypeToken();
769  ostr << ":";
770  s->saveBinary(ostr);
771  }
772  result = ostr.str();
773  saveData(os, result);
774  }
775 
776 
777  void save(std::ostream &os) const
778  {
779  int32 v = version();
780  UTwrite(os, &v);
781  saveData(os, myGroup);
782  saveData(os, myGrouptype);
783  saveData(os, myEncodenames);
784  {
785  int64 length = myNumattr.entries();
786  UTwrite(os, &length);
787  for (exint i = 0; i < length; i++)
788  {
789  saveData(os, myNumattr(i).enable);
790  saveData(os, myNumattr(i).name);
791  saveData(os, myNumattr(i).existing);
792  saveData(os, myNumattr(i).createvarmap);
793  saveData(os, myNumattr(i).varname);
794  saveData(os, myNumattr(i)._class);
795  saveData(os, myNumattr(i).savetoinfo);
796  saveData(os, myNumattr(i).type);
797  saveData(os, myNumattr(i).typeinfo);
798  saveData(os, myNumattr(i).precision);
799  saveData(os, myNumattr(i).size);
800  saveData(os, myNumattr(i).defaultv);
801  saveData(os, myNumattr(i).writevalues);
802  saveData(os, myNumattr(i).uselocal);
803  saveData(os, myNumattr(i).valuev);
804  saveData(os, myNumattr(i).string);
805 
806  }
807  }
808 
809  }
810 
811  bool load(UT_IStream &is)
812  {
813  int32 v;
814  is.bread(&v, 1);
815  if (version() != v)
816  {
817  // Fail incompatible versions
818  return false;
819  }
820  loadData(is, myGroup);
821  loadData(is, myGrouptype);
822  loadData(is, myEncodenames);
823  {
824  int64 length;
825  is.read(&length, 1);
826  myNumattr.entries(length);
827  for (exint i = 0; i < length; i++)
828  {
829  loadData(is, myNumattr(i).enable);
830  loadData(is, myNumattr(i).name);
831  loadData(is, myNumattr(i).existing);
832  loadData(is, myNumattr(i).createvarmap);
833  loadData(is, myNumattr(i).varname);
834  loadData(is, myNumattr(i)._class);
835  loadData(is, myNumattr(i).savetoinfo);
836  loadData(is, myNumattr(i).type);
837  loadData(is, myNumattr(i).typeinfo);
838  loadData(is, myNumattr(i).precision);
839  loadData(is, myNumattr(i).size);
840  loadData(is, myNumattr(i).defaultv);
841  loadData(is, myNumattr(i).writevalues);
842  loadData(is, myNumattr(i).uselocal);
843  loadData(is, myNumattr(i).valuev);
844  loadData(is, myNumattr(i).string);
845 
846  }
847  }
848 
849  return true;
850  }
851 
852  const UT_StringHolder & getGroup() const { return myGroup; }
853  void setGroup(const UT_StringHolder & val) { myGroup = val; }
855  {
856  SOP_Node *thissop = cookparms.getNode();
857  if (!thissop) return getGroup();
859  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
860  return result;
861  }
862  Grouptype getGrouptype() const { return Grouptype(myGrouptype); }
863  void setGrouptype(Grouptype val) { myGrouptype = int64(val); }
865  {
866  SOP_Node *thissop = cookparms.getNode();
867  if (!thissop) return getGrouptype();
868  int64 result;
869  OP_Utils::evalOpParm(result, thissop, "grouptype", cookparms.getCookTime(), 0);
870  return Grouptype(result);
871  }
872  bool getEncodenames() const { return myEncodenames; }
873  void setEncodenames(bool val) { myEncodenames = val; }
874  bool opEncodenames(const SOP_NodeVerb::CookParms &cookparms) const
875  {
876  SOP_Node *thissop = cookparms.getNode();
877  if (!thissop) return getEncodenames();
878  bool result;
879  OP_Utils::evalOpParm(result, thissop, "encodenames", cookparms.getCookTime(), 0);
880  return result;
881  }
882  const UT_Array<Numattr> &getNumattr() const { return myNumattr; }
883  void setNumattr(const UT_Array<Numattr> &val) { myNumattr = val; }
884  exint opNumattr(const SOP_NodeVerb::CookParms &cookparms) const
885  {
886  SOP_Node *thissop = cookparms.getNode();
887  if (!thissop) return getNumattr().entries();
888  exint result;
889  OP_Utils::evalOpParm(result, thissop, "numattr", cookparms.getCookTime(), 0);
890  return result;
891  }
892  bool opNumattr_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
893  {
894  SOP_Node *thissop = cookparms.getNode();
895  if (!thissop) return (myNumattr(_idx).enable);
896  int _parmidx = _idx + 1;
897  bool result;
898  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
899  return (result);
900  }
902  {
903  SOP_Node *thissop = cookparms.getNode();
904  if (!thissop) return (myNumattr(_idx).name);
905  int _parmidx = _idx + 1;
907  OP_Utils::evalOpParmInst(result, thissop, "name#", &_parmidx, cookparms.getCookTime(), 0);
908  return (result);
909  }
911  {
912  SOP_Node *thissop = cookparms.getNode();
913  if (!thissop) return (myNumattr(_idx).existing);
914  int _parmidx = _idx + 1;
915  int64 result;
916  OP_Utils::evalOpParmInst(result, thissop, "existing#", &_parmidx, cookparms.getCookTime(), 0);
917  return (result);
918  }
919  bool opNumattr_createvarmap(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
920  {
921  SOP_Node *thissop = cookparms.getNode();
922  if (!thissop) return (myNumattr(_idx).createvarmap);
923  int _parmidx = _idx + 1;
924  bool result;
925  OP_Utils::evalOpParmInst(result, thissop, "createvarmap#", &_parmidx, cookparms.getCookTime(), 0);
926  return (result);
927  }
929  {
930  SOP_Node *thissop = cookparms.getNode();
931  if (!thissop) return (myNumattr(_idx).varname);
932  int _parmidx = _idx + 1;
934  OP_Utils::evalOpParmInst(result, thissop, "varname#", &_parmidx, cookparms.getCookTime(), 0);
935  return (result);
936  }
937  int64 opNumattr__class(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
938  {
939  SOP_Node *thissop = cookparms.getNode();
940  if (!thissop) return (myNumattr(_idx)._class);
941  int _parmidx = _idx + 1;
942  int64 result;
943  OP_Utils::evalOpParmInst(result, thissop, "class#", &_parmidx, cookparms.getCookTime(), 0);
944  return (result);
945  }
946  bool opNumattr_savetoinfo(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
947  {
948  SOP_Node *thissop = cookparms.getNode();
949  if (!thissop) return (myNumattr(_idx).savetoinfo);
950  int _parmidx = _idx + 1;
951  bool result;
952  OP_Utils::evalOpParmInst(result, thissop, "savetoinfo#", &_parmidx, cookparms.getCookTime(), 0);
953  return (result);
954  }
955  int64 opNumattr_type(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
956  {
957  SOP_Node *thissop = cookparms.getNode();
958  if (!thissop) return (myNumattr(_idx).type);
959  int _parmidx = _idx + 1;
960  int64 result;
961  OP_Utils::evalOpParmInst(result, thissop, "type#", &_parmidx, cookparms.getCookTime(), 0);
962  return (result);
963  }
965  {
966  SOP_Node *thissop = cookparms.getNode();
967  if (!thissop) return (myNumattr(_idx).typeinfo);
968  int _parmidx = _idx + 1;
969  int64 result;
970  OP_Utils::evalOpParmInst(result, thissop, "typeinfo#", &_parmidx, cookparms.getCookTime(), 0);
971  return (result);
972  }
974  {
975  SOP_Node *thissop = cookparms.getNode();
976  if (!thissop) return (myNumattr(_idx).precision);
977  int _parmidx = _idx + 1;
978  int64 result;
979  OP_Utils::evalOpParmInst(result, thissop, "precision#", &_parmidx, cookparms.getCookTime(), 0);
980  return (result);
981  }
982  int64 opNumattr_size(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
983  {
984  SOP_Node *thissop = cookparms.getNode();
985  if (!thissop) return (myNumattr(_idx).size);
986  int _parmidx = _idx + 1;
987  int64 result;
988  OP_Utils::evalOpParmInst(result, thissop, "size#", &_parmidx, cookparms.getCookTime(), 0);
989  return (result);
990  }
992  {
993  SOP_Node *thissop = cookparms.getNode();
994  if (!thissop) return (myNumattr(_idx).defaultv);
995  int _parmidx = _idx + 1;
997  OP_Utils::evalOpParmInst(result, thissop, "default#v", &_parmidx, cookparms.getCookTime(), 0);
998  return (result);
999  }
1000  bool opNumattr_writevalues(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
1001  {
1002  SOP_Node *thissop = cookparms.getNode();
1003  if (!thissop) return (myNumattr(_idx).writevalues);
1004  int _parmidx = _idx + 1;
1005  bool result;
1006  OP_Utils::evalOpParmInst(result, thissop, "writevalues#", &_parmidx, cookparms.getCookTime(), 0);
1007  return (result);
1008  }
1009  bool opNumattr_uselocal(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
1010  {
1011  SOP_Node *thissop = cookparms.getNode();
1012  if (!thissop) return (myNumattr(_idx).uselocal);
1013  int _parmidx = _idx + 1;
1014  bool result;
1015  OP_Utils::evalOpParmInst(result, thissop, "uselocal#", &_parmidx, cookparms.getCookTime(), 0);
1016  return (result);
1017  }
1019  {
1020  SOP_Node *thissop = cookparms.getNode();
1021  if (!thissop) return (myNumattr(_idx).valuev);
1022  int _parmidx = _idx + 1;
1024  OP_Utils::evalOpParmInst(result, thissop, "value#v", &_parmidx, cookparms.getCookTime(), 0);
1025  return (result);
1026  }
1028  {
1029  SOP_Node *thissop = cookparms.getNode();
1030  if (!thissop) return (myNumattr(_idx).string);
1031  int _parmidx = _idx + 1;
1033  OP_Utils::evalOpParmInst(result, thissop, "string#", &_parmidx, cookparms.getCookTime(), 0);
1034  return (result);
1035  }
1036 
1037 
1038 private:
1039  UT_StringHolder myGroup;
1040  int64 myGrouptype;
1041  bool myEncodenames;
1042  UT_Array<Numattr> myNumattr;
1043 
1044 };
static void loadData(UT_IStream &is, UT_Vector4D &v)
GLdouble s
Definition: glew.h:1390
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const
bool opNumattr_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
virtual exint getNestNumParms(TempIndex idx) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_StringHolder s)
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:638
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const
T & z(void)
Definition: UT_Vector4.h:387
GLuint const GLchar * name
Definition: glew.h:1814
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const
void setNumattr(const UT_Array< Numattr > &val)
exint bread(int32 *buffer, exint asize=1)
static void saveData(std::ostream &os, UT_Vector4D v)
GT_API const UT_StringHolder time
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
fpreal getTime() const
Definition: OP_Context.h:60
GLuint const GLfloat * val
Definition: glew.h:2794
UT_StringHolder opNumattr_string(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, fpreal64 &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
UT_Vector4D opNumattr_defaultv(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool opNumattr_writevalues(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:292
const UT_StringHolder & getGroup() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool operator==(const Numattr &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value)
An output stream object that owns its own string buffer storage.
bool operator==(const SOP_AttribCreate_2_0Parms &src) const
bool operator!=(const SOP_AttribCreate_2_0Parms &src) const
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
const GLdouble * v
Definition: glew.h:1391
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:507
int64 opNumattr_existing(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value)
virtual void copyFrom(const SOP_NodeParms *src)
int64 opNumattr_type(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool opNumattr_savetoinfo(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const
static void saveData(std::ostream &os, bool v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:511
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:111
virtual ParmType getNestParmType(TempIndex fieldnum) const
int64 opNumattr_typeinfo(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
typedef INT(WINAPI *PFNWGLGETGPUINFOAMDPROC)(UINT id
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
exint length() const
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value)
int64 exint
Definition: SYS_Types.h:120
bool opNumattr_uselocal(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
void setGroup(const UT_StringHolder &val)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:108
static void saveData(std::ostream &os, PRM_DataItemHandle s)
double fpreal64
Definition: SYS_Types.h:196
int64 opNumattr_precision(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
void
Definition: png.h:1083
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value)
const GLfloat * c
Definition: glew.h:16296
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
UT_Vector4D opNumattr_valuev(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opNumattr__class(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value)
bool opNumattr_createvarmap(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
exint opNumattr(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const
UT_StringHolder opNumattr_varname(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void saveData(std::ostream &os, int64 v)
int int32
Definition: SYS_Types.h:39
static void saveData(std::ostream &os, UT_Matrix2D v)
T & y(void)
Definition: UT_Vector4.h:385
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
UT_StringHolder opNumattr_name(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void save(std::ostream &os) const
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
static void saveData(std::ostream &os, UT_Matrix4D v)
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:115
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:453
UT_StringHolder createString(const UT_Array< Numattr > &list) const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:509
double fpreal
Definition: SYS_Types.h:276
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
const UT_Array< Numattr > & getNumattr() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const
bool operator!=(const Numattr &src) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE void append(char character)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
#define SOP_API
Definition: SOP_API.h:10
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value)
static void saveData(std::ostream &os, fpreal64 v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:652
T & x(void)
Definition: UT_Vector4.h:383
int64 opNumattr_size(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GLuint64EXT * result
Definition: glew.h:14007
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
virtual const char * getNestParmName(TempIndex fieldnum) const
T & y(void)
Definition: UT_Vector2.h:294
const char * findChar(int c) const
Definition: UT_String.h:1350
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
static void loadData(UT_IStream &is, UT_Vector2D &v)
UT_Vector4T< fpreal64 > UT_Vector4D
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const
T & w(void)
Definition: UT_Vector4.h:389
static void loadData(UT_IStream &is, int64 &v)
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
GLenum GLint GLint * precision
Definition: glew.h:3500
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const
GLsizei const GLfloat * value
Definition: glew.h:1849
static void loadData(UT_IStream &is, bool &v)
GLboolean enable
Definition: glew.h:2745
const OP_Context & context() const
Definition: SOP_NodeVerb.h:113
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value)
SYS_FORCE_INLINE bool isstring() const
Grouptype opGrouptype(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
bool opEncodenames(const SOP_NodeVerb::CookParms &cookparms) const