HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Control.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_ControlEnums
24 {
25  enum class DisplayIcon
26  {
27  ICON = 0,
28  AXIS,
30  };
31 
33  getToken(DisplayIcon enum_value)
34  {
35  using namespace UT::Literal;
36  switch (enum_value) {
37  case DisplayIcon::ICON: return "icon"_sh;
38  case DisplayIcon::AXIS: return "axis"_sh;
39  case DisplayIcon::ICONANDAXIS: return "iconandaxis"_sh;
40  default: UT_ASSERT(false); return ""_sh;
41  }
42  }
43 
44  enum class ControlType
45  {
46  NULL_ = 0,
47  CIRCLES,
48  BOX,
49  PLANES,
51  NULLANDBOX,
53  CUSTOM
54  };
55 
57  getToken(ControlType enum_value)
58  {
59  using namespace UT::Literal;
60  switch (enum_value) {
61  case ControlType::NULL_: return "null"_sh;
62  case ControlType::CIRCLES: return "circles"_sh;
63  case ControlType::BOX: return "box"_sh;
64  case ControlType::PLANES: return "planes"_sh;
65  case ControlType::NULLANDCIRCLES: return "nullandcircles"_sh;
66  case ControlType::NULLANDBOX: return "nullandbox"_sh;
67  case ControlType::NULLANDPLANES: return "nullandplanes"_sh;
68  case ControlType::CUSTOM: return "custom"_sh;
69  default: UT_ASSERT(false); return ""_sh;
70  }
71  }
72 
73  enum class Orientation
74  {
75  XYZ = 0,
76  X,
77  Y,
78  Z,
79  XY,
80  XZ,
81  YZ
82  };
83 
85  getToken(Orientation enum_value)
86  {
87  using namespace UT::Literal;
88  switch (enum_value) {
89  case Orientation::XYZ: return "xyz"_sh;
90  case Orientation::X: return "x"_sh;
91  case Orientation::Y: return "y"_sh;
92  case Orientation::Z: return "z"_sh;
93  case Orientation::XY: return "xy"_sh;
94  case Orientation::XZ: return "xz"_sh;
95  case Orientation::YZ: return "yz"_sh;
96  default: UT_ASSERT(false); return ""_sh;
97  }
98  }
99 
100 }
101 
102 
104 {
105 public:
106  static int version() { return 1; }
107  struct SnapPoints
108  {
110 
111 
113  {
114  snappos = UT_Vector3D(0,0,0);
115 
116  }
117 
118  bool operator==(const SnapPoints &src) const
119  {
120  if (snappos != src.snappos) return false;
121 
122  return true;
123  }
124  bool operator!=(const SnapPoints &src) const
125  {
126  return !operator==(src);
127  }
128 
129  };
130 
132  {
134 
135  buf.strcat("[ ");
136  for (int i = 0; i < list.entries(); i++)
137  {
138  if (i)
139  buf.strcat(", ");
140  buf.strcat("( ");
141  buf.append("");
142  buf.appendSprintf("(%f, %f, %f)", list(i).snappos.x(), list(i).snappos.y(), list(i).snappos.z());
143 
144  buf.strcat(" )");
145  }
146  buf.strcat(" ]");
147 
149  return result;
150  }
151 
153  {
154  myUseColor = true;
155  myColor = UT_Vector3D(1,1,1);
156  mySize = UT_Vector3D(1,1,1);
157  myCenter = UT_Vector3D(0,0,0);
158  myRotate = UT_Vector3D(0,0,0);
159  myUniformScale = 1;
160  myDisplayIcon = 0;
161  myControlType = 0;
162  myOrientation = 0;
163  myShadedMode = false;
164  myPacked = true;
165  mySnapPoints.setSize(0);
166 
167  }
168 
169  explicit SOP_ControlParms(const SOP_ControlParms &) = default;
170  SOP_ControlParms &operator=(const SOP_ControlParms &) = default;
171  SOP_ControlParms(SOP_ControlParms &&) noexcept = default;
172  SOP_ControlParms &operator=(SOP_ControlParms &&) noexcept = default;
173 
174  ~SOP_ControlParms() override {}
175 
176  bool operator==(const SOP_ControlParms &src) const
177  {
178  if (myUseColor != src.myUseColor) return false;
179  if (myColor != src.myColor) return false;
180  if (mySize != src.mySize) return false;
181  if (myCenter != src.myCenter) return false;
182  if (myRotate != src.myRotate) return false;
183  if (myUniformScale != src.myUniformScale) return false;
184  if (myDisplayIcon != src.myDisplayIcon) return false;
185  if (myControlType != src.myControlType) return false;
186  if (myOrientation != src.myOrientation) return false;
187  if (myShadedMode != src.myShadedMode) return false;
188  if (myPacked != src.myPacked) return false;
189  if (mySnapPoints != src.mySnapPoints) return false;
190 
191  return true;
192  }
193  bool operator!=(const SOP_ControlParms &src) const
194  {
195  return !operator==(src);
196  }
200 
201 
202 
203  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
204  {
205  myUseColor = true;
206  if (true)
207  graph->evalOpParm(myUseColor, nodeidx, "usecolor", time, 0);
208  myColor = UT_Vector3D(1,1,1);
209  if (true)
210  graph->evalOpParm(myColor, nodeidx, "color", time, 0);
211  mySize = UT_Vector3D(1,1,1);
212  if (true)
213  graph->evalOpParm(mySize, nodeidx, "size", time, 0);
214  myCenter = UT_Vector3D(0,0,0);
215  if (true)
216  graph->evalOpParm(myCenter, nodeidx, "t", time, 0);
217  myRotate = UT_Vector3D(0,0,0);
218  if (true)
219  graph->evalOpParm(myRotate, nodeidx, "r", time, 0);
220  myUniformScale = 1;
221  if (true)
222  graph->evalOpParm(myUniformScale, nodeidx, "scale", time, 0);
223  myDisplayIcon = 0;
224  if (true)
225  graph->evalOpParm(myDisplayIcon, nodeidx, "displayicon", time, 0);
226  myControlType = 0;
227  if (true && ( (true&&!(((int64(getDisplayIcon())==1)))) ) )
228  graph->evalOpParm(myControlType, nodeidx, "controltype", time, 0);
229  myOrientation = 0;
230  if (true && ( (true&&!(((int64(getDisplayIcon())==1))||((int64(getDisplayIcon())!=1)&&(int64(getControlType())!=1)&&(int64(getControlType())!=3)&&(int64(getControlType())!=4)&&(int64(getControlType())!=6)))) ) )
231  graph->evalOpParm(myOrientation, nodeidx, "orientation", time, 0);
232  myShadedMode = false;
233  if (true)
234  graph->evalOpParm(myShadedMode, nodeidx, "shadedmode", time, 0);
235  myPacked = true;
236  if (true)
237  graph->evalOpParm(myPacked, nodeidx, "packed", time, 0);
238  if (true)
239  {
240  int64 length = 0;
241  graph->evalOpParm(length, nodeidx, "numsnappoints", time, 0);
242  if (length < 0) length = 0;
243  mySnapPoints.setSize(length);
244  for (exint i = 0; i < length; i++)
245  {
246  int parmidx[1];
247  int offsets[1];
248  parmidx[0] = i+1;
249  offsets[0] = 1;
250  auto && _curentry = mySnapPoints(i);
251  (void) _curentry;
252  _curentry.snappos = UT_Vector3D(0,0,0);
253  if (true)
254  graph->evalOpParmInst(_curentry.snappos, nodeidx, "snappos#", parmidx, offsets, time, 0, 2-1);
255 
256  }
257  }
258  else
259  mySnapPoints.clear();
260 
261  }
262 
263 
264  void loadFromOpSubclass(const LoadParms &loadparms) override
265  {
266  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
267  }
268 
269 
270  void copyFrom(const OP_NodeParms *src) override
271  {
272  *this = *((const SOP_ControlParms *)src);
273  }
274 
275  template <typename T>
276  void
277  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
278  {
279  if (idx.size() < 1)
280  return;
281  UT_ASSERT(idx.size() == instance.size()+1);
282  if (idx.size() != instance.size()+1)
283  return;
284  switch (idx[0])
285  {
286  case 0:
287  coerceValue(value, myUseColor);
288  break;
289  case 1:
290  coerceValue(value, myColor);
291  break;
292  case 2:
293  coerceValue(value, mySize);
294  break;
295  case 3:
296  coerceValue(value, myCenter);
297  break;
298  case 4:
299  coerceValue(value, myRotate);
300  break;
301  case 5:
302  coerceValue(value, myUniformScale);
303  break;
304  case 6:
305  coerceValue(value, myDisplayIcon);
306  break;
307  case 7:
308  coerceValue(value, myControlType);
309  break;
310  case 8:
311  coerceValue(value, myOrientation);
312  break;
313  case 9:
314  coerceValue(value, myShadedMode);
315  break;
316  case 10:
317  coerceValue(value, myPacked);
318  break;
319  case 11:
320  if (idx.size() == 1)
321  coerceValue(value, mySnapPoints.entries());
322  else if (instance[0] < mySnapPoints.entries())
323  {
324  auto && _data = mySnapPoints(instance[0]);
325  switch (idx[1])
326  {
327  case 0:
328  coerceValue(value, _data.snappos);
329  break;
330 
331  }
332  }
333  break;
334 
335  }
336  }
337 
338  bool isParmColorRamp(exint idx) const override
339  {
340  switch (idx)
341  {
342 
343  }
344  return false;
345  }
346 
347  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
348  { doGetParmValue(idx, instance, value); }
349  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
350  { doGetParmValue(idx, instance, value); }
351  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
352  { doGetParmValue(idx, instance, value); }
353  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
354  { doGetParmValue(idx, instance, value); }
355  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
356  { doGetParmValue(idx, instance, value); }
357  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
358  { doGetParmValue(idx, instance, value); }
359  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
360  { doGetParmValue(idx, instance, value); }
361  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
362  { doGetParmValue(idx, instance, value); }
363  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
364  { doGetParmValue(idx, instance, value); }
365  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
366  { doGetParmValue(idx, instance, value); }
367  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
368  { doGetParmValue(idx, instance, value); }
369 
370  template <typename T>
371  void
372  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
373  {
374  if (idx.size() < 1)
375  return;
376  UT_ASSERT(idx.size() == instance.size()+1);
377  if (idx.size() != instance.size()+1)
378  return;
379  switch (idx[0])
380  {
381  case 0:
382  coerceValue(myUseColor, ( ( value ) ));
383  break;
384  case 1:
385  coerceValue(myColor, ( ( value ) ));
386  break;
387  case 2:
388  coerceValue(mySize, ( ( value ) ));
389  break;
390  case 3:
391  coerceValue(myCenter, ( ( value ) ));
392  break;
393  case 4:
394  coerceValue(myRotate, ( ( value ) ));
395  break;
396  case 5:
397  coerceValue(myUniformScale, ( ( value ) ));
398  break;
399  case 6:
400  coerceValue(myDisplayIcon, clampMinValue(0, clampMaxValue(2, value ) ));
401  break;
402  case 7:
403  coerceValue(myControlType, clampMinValue(0, clampMaxValue(7, value ) ));
404  break;
405  case 8:
406  coerceValue(myOrientation, clampMinValue(0, clampMaxValue(6, value ) ));
407  break;
408  case 9:
409  coerceValue(myShadedMode, ( ( value ) ));
410  break;
411  case 10:
412  coerceValue(myPacked, ( ( value ) ));
413  break;
414  case 11:
415  if (idx.size() == 1)
416  {
417  exint newsize;
418  coerceValue(newsize, value);
419  if (newsize < 0) newsize = 0;
420  mySnapPoints.setSize(newsize);
421  }
422  else
423  {
424  if (instance[0] < 0)
425  return;
426  mySnapPoints.setSizeIfNeeded(instance[0]+1);
427  auto && _data = mySnapPoints(instance[0]);
428  switch (idx[1])
429  {
430  case 0:
431  coerceValue(_data.snappos, value);
432  break;
433 
434  }
435  }
436  break;
437 
438  }
439  }
440 
441  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
442  { doSetParmValue(idx, instance, value); }
443  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
444  { doSetParmValue(idx, instance, value); }
445  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
446  { doSetParmValue(idx, instance, value); }
447  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
448  { doSetParmValue(idx, instance, value); }
449  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
450  { doSetParmValue(idx, instance, value); }
451  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
452  { doSetParmValue(idx, instance, value); }
453  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
454  { doSetParmValue(idx, instance, value); }
455  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
456  { doSetParmValue(idx, instance, value); }
457  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
458  { doSetParmValue(idx, instance, value); }
459  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
460  { doSetParmValue(idx, instance, value); }
461  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
462  { doSetParmValue(idx, instance, value); }
463 
464  exint getNestNumParms(TempIndex idx) const override
465  {
466  if (idx.size() == 0)
467  return 12;
468  switch (idx[0])
469  {
470  case 11:
471  return 1;
472 
473  }
474  // Invalid
475  return 0;
476  }
477 
478  const char *getNestParmName(TempIndex fieldnum) const override
479  {
480  if (fieldnum.size() < 1)
481  return 0;
482  switch (fieldnum[0])
483  {
484  case 0:
485  return "usecolor";
486  case 1:
487  return "color";
488  case 2:
489  return "size";
490  case 3:
491  return "t";
492  case 4:
493  return "r";
494  case 5:
495  return "scale";
496  case 6:
497  return "displayicon";
498  case 7:
499  return "controltype";
500  case 8:
501  return "orientation";
502  case 9:
503  return "shadedmode";
504  case 10:
505  return "packed";
506  case 11:
507  if (fieldnum.size() == 1)
508  return "numsnappoints";
509  switch (fieldnum[1])
510  {
511  case 0:
512  return "snappos#";
513 
514  }
515  return 0;
516 
517  }
518  return 0;
519  }
520 
521  ParmType getNestParmType(TempIndex fieldnum) const override
522  {
523  if (fieldnum.size() < 1)
524  return PARM_UNSUPPORTED;
525  switch (fieldnum[0])
526  {
527  case 0:
528  return PARM_INTEGER;
529  case 1:
530  return PARM_VECTOR3;
531  case 2:
532  return PARM_VECTOR3;
533  case 3:
534  return PARM_VECTOR3;
535  case 4:
536  return PARM_VECTOR3;
537  case 5:
538  return PARM_FLOAT;
539  case 6:
540  return PARM_INTEGER;
541  case 7:
542  return PARM_INTEGER;
543  case 8:
544  return PARM_INTEGER;
545  case 9:
546  return PARM_INTEGER;
547  case 10:
548  return PARM_INTEGER;
549  case 11:
550  if (fieldnum.size() == 1)
551  return PARM_MULTIPARM;
552  switch (fieldnum[1])
553  {
554  case 0:
555  return PARM_VECTOR3;
556 
557  }
558  return PARM_UNSUPPORTED;
559 
560  }
561  return PARM_UNSUPPORTED;
562  }
563 
564  // Boiler plate to load individual types.
565  static void loadData(UT_IStream &is, int64 &v)
566  { is.bread(&v, 1); }
567  static void loadData(UT_IStream &is, bool &v)
568  { int64 iv; is.bread(&iv, 1); v = iv; }
569  static void loadData(UT_IStream &is, fpreal64 &v)
570  { is.bread<fpreal64>(&v, 1); }
571  static void loadData(UT_IStream &is, UT_Vector2D &v)
572  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
573  static void loadData(UT_IStream &is, UT_Vector3D &v)
574  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
575  is.bread<fpreal64>(&v.z(), 1); }
576  static void loadData(UT_IStream &is, UT_Vector4D &v)
577  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
578  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
579  static void loadData(UT_IStream &is, UT_Matrix2D &v)
580  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
581  static void loadData(UT_IStream &is, UT_Matrix3D &v)
582  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
583  static void loadData(UT_IStream &is, UT_Matrix4D &v)
584  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
585  static void loadData(UT_IStream &is, UT_Vector2I &v)
586  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
587  static void loadData(UT_IStream &is, UT_Vector3I &v)
588  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
589  is.bread<int64>(&v.z(), 1); }
590  static void loadData(UT_IStream &is, UT_Vector4I &v)
591  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
592  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
594  { is.bread(v); }
596  { UT_StringHolder rampdata;
597  loadData(is, rampdata);
598  if (rampdata.isstring())
599  {
600  v.reset(new UT_Ramp());
601  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
602  v->load(istr);
603  }
604  else v.reset();
605  }
608  loadData(is, data);
609  if (data.isstring())
610  {
611  // Find the data type.
612  const char *colon = UT_StringWrap(data).findChar(':');
613  if (colon)
614  {
615  int typelen = colon - data.buffer();
617  type.strncpy(data.buffer(), typelen);
618  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
619 
620  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
621  }
622  }
623  else v.reset();
624  }
625 
626  static void saveData(std::ostream &os, int64 v)
627  { UTwrite(os, &v); }
628  static void saveData(std::ostream &os, bool v)
629  { int64 iv = v; UTwrite(os, &iv); }
630  static void saveData(std::ostream &os, fpreal64 v)
631  { UTwrite<fpreal64>(os, &v); }
632  static void saveData(std::ostream &os, UT_Vector2D v)
633  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
634  static void saveData(std::ostream &os, UT_Vector3D v)
635  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
636  UTwrite<fpreal64>(os, &v.z()); }
637  static void saveData(std::ostream &os, UT_Vector4D v)
638  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
639  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
640  static void saveData(std::ostream &os, UT_Matrix2D v)
642  static void saveData(std::ostream &os, UT_Matrix3D v)
644  static void saveData(std::ostream &os, UT_Matrix4D v)
646  static void saveData(std::ostream &os, UT_StringHolder s)
647  { UT_StringWrap(s).saveBinary(os); }
648  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
650  UT_OStringStream ostr;
651  if (s) s->save(ostr);
652  result = ostr.str();
653  saveData(os, result);
654  }
655  static void saveData(std::ostream &os, PRM_DataItemHandle s)
657  UT_OStringStream ostr;
658  if (s)
659  {
660  ostr << s->getDataTypeToken();
661  ostr << ":";
662  s->saveBinary(ostr);
663  }
664  result = ostr.str();
665  saveData(os, result);
666  }
667 
668 
669  void save(std::ostream &os) const
670  {
671  int32 v = version();
672  UTwrite(os, &v);
673  saveData(os, myUseColor);
674  saveData(os, myColor);
675  saveData(os, mySize);
676  saveData(os, myCenter);
677  saveData(os, myRotate);
678  saveData(os, myUniformScale);
679  saveData(os, myDisplayIcon);
680  saveData(os, myControlType);
681  saveData(os, myOrientation);
682  saveData(os, myShadedMode);
683  saveData(os, myPacked);
684  {
685  int64 length = mySnapPoints.entries();
686  UTwrite(os, &length);
687  for (exint i = 0; i < length; i++)
688  {
689  auto && _curentry = mySnapPoints(i);
690  (void) _curentry;
691  saveData(os, _curentry.snappos);
692 
693  }
694  }
695 
696  }
697 
698  bool load(UT_IStream &is)
699  {
700  int32 v;
701  is.bread(&v, 1);
702  if (version() != v)
703  {
704  // Fail incompatible versions
705  return false;
706  }
707  loadData(is, myUseColor);
708  loadData(is, myColor);
709  loadData(is, mySize);
710  loadData(is, myCenter);
711  loadData(is, myRotate);
712  loadData(is, myUniformScale);
713  loadData(is, myDisplayIcon);
714  loadData(is, myControlType);
715  loadData(is, myOrientation);
716  loadData(is, myShadedMode);
717  loadData(is, myPacked);
718  {
719  int64 length;
720  is.read(&length, 1);
721  mySnapPoints.setSize(length);
722  for (exint i = 0; i < length; i++)
723  {
724  auto && _curentry = mySnapPoints(i);
725  (void) _curentry;
726  loadData(is, _curentry.snappos);
727 
728  }
729  }
730 
731  return true;
732  }
733 
734  bool getUseColor() const { return myUseColor; }
735  void setUseColor(bool val) { myUseColor = val; }
736  bool opUseColor(const SOP_NodeVerb::CookParms &cookparms) const
737  {
738  SOP_Node *thissop = cookparms.getNode();
739  if (!thissop) return getUseColor();
740  bool result;
741  OP_Utils::evalOpParm(result, thissop, "usecolor", cookparms.getCookTime(), 0);
742  return result;
743  }
744  UT_Vector3D getColor() const { return myColor; }
745  void setColor(UT_Vector3D val) { myColor = val; }
747  {
748  SOP_Node *thissop = cookparms.getNode();
749  if (!thissop) return getColor();
751  OP_Utils::evalOpParm(result, thissop, "color", cookparms.getCookTime(), 0);
752  return result;
753  }
754  UT_Vector3D getSize() const { return mySize; }
755  void setSize(UT_Vector3D val) { mySize = val; }
757  {
758  SOP_Node *thissop = cookparms.getNode();
759  if (!thissop) return getSize();
761  OP_Utils::evalOpParm(result, thissop, "size", cookparms.getCookTime(), 0);
762  return result;
763  }
764  UT_Vector3D getCenter() const { return myCenter; }
765  void setCenter(UT_Vector3D val) { myCenter = val; }
767  {
768  SOP_Node *thissop = cookparms.getNode();
769  if (!thissop) return getCenter();
771  OP_Utils::evalOpParm(result, thissop, "t", cookparms.getCookTime(), 0);
772  return result;
773  }
774  UT_Vector3D getRotate() const { return myRotate; }
775  void setRotate(UT_Vector3D val) { myRotate = val; }
777  {
778  SOP_Node *thissop = cookparms.getNode();
779  if (!thissop) return getRotate();
781  OP_Utils::evalOpParm(result, thissop, "r", cookparms.getCookTime(), 0);
782  return result;
783  }
784  fpreal64 getUniformScale() const { return myUniformScale; }
785  void setUniformScale(fpreal64 val) { myUniformScale = val; }
787  {
788  SOP_Node *thissop = cookparms.getNode();
789  if (!thissop) return getUniformScale();
791  OP_Utils::evalOpParm(result, thissop, "scale", cookparms.getCookTime(), 0);
792  return result;
793  }
794  DisplayIcon getDisplayIcon() const { return DisplayIcon(myDisplayIcon); }
795  void setDisplayIcon(DisplayIcon val) { myDisplayIcon = int64(val); }
797  {
798  SOP_Node *thissop = cookparms.getNode();
799  if (!thissop) return getDisplayIcon();
800  int64 result;
801  OP_Utils::evalOpParm(result, thissop, "displayicon", cookparms.getCookTime(), 0);
802  return DisplayIcon(result);
803  }
804  ControlType getControlType() const { return ControlType(myControlType); }
805  void setControlType(ControlType val) { myControlType = int64(val); }
807  {
808  SOP_Node *thissop = cookparms.getNode();
809  if (!thissop) return getControlType();
810  int64 result;
811  OP_Utils::evalOpParm(result, thissop, "controltype", cookparms.getCookTime(), 0);
812  return ControlType(result);
813  }
814  Orientation getOrientation() const { return Orientation(myOrientation); }
815  void setOrientation(Orientation val) { myOrientation = int64(val); }
817  {
818  SOP_Node *thissop = cookparms.getNode();
819  if (!thissop) return getOrientation();
820  int64 result;
821  OP_Utils::evalOpParm(result, thissop, "orientation", cookparms.getCookTime(), 0);
822  return Orientation(result);
823  }
824  bool getShadedMode() const { return myShadedMode; }
825  void setShadedMode(bool val) { myShadedMode = val; }
826  bool opShadedMode(const SOP_NodeVerb::CookParms &cookparms) const
827  {
828  SOP_Node *thissop = cookparms.getNode();
829  if (!thissop) return getShadedMode();
830  bool result;
831  OP_Utils::evalOpParm(result, thissop, "shadedmode", cookparms.getCookTime(), 0);
832  return result;
833  }
834  bool getPacked() const { return myPacked; }
835  void setPacked(bool val) { myPacked = val; }
836  bool opPacked(const SOP_NodeVerb::CookParms &cookparms) const
837  {
838  SOP_Node *thissop = cookparms.getNode();
839  if (!thissop) return getPacked();
840  bool result;
841  OP_Utils::evalOpParm(result, thissop, "packed", cookparms.getCookTime(), 0);
842  return result;
843  }
844  const UT_Array<SnapPoints> &getSnapPoints() const { return mySnapPoints; }
845 void setSnapPoints(const UT_Array<SnapPoints> &val) { mySnapPoints = val; }
847  {
848  SOP_Node *thissop = cookparms.getNode();
849  if (!thissop) return getSnapPoints().entries();
850  exint result;
851  OP_Utils::evalOpParm(result, thissop, "numsnappoints", cookparms.getCookTime(), 0);
852  return result;
853  }
854  UT_Vector3D opSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
855  { return opinstSnapPoints_snappos(cookparms, &_idx); }
856  UT_Vector3D opinstSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
857  {
858  SOP_Node *thissop = cookparms.getNode();
859  if (!thissop) return (mySnapPoints(_idx[0]).snappos);
860  int _parmidx[2-1];
861  _parmidx[1-1] = _idx[1-1] + 1;
862 
864  OP_Utils::evalOpParmInst(result, thissop, "snappos#", _parmidx, cookparms.getCookTime(), 0, 2-1);
865  return (result);
866  }
867 
868 
869 private:
870  bool myUseColor;
871  UT_Vector3D myColor;
872  UT_Vector3D mySize;
873  UT_Vector3D myCenter;
874  UT_Vector3D myRotate;
875  fpreal64 myUniformScale;
876  int64 myDisplayIcon;
877  int64 myControlType;
878  int64 myOrientation;
879  bool myShadedMode;
880  bool myPacked;
881  UT_Array<SnapPoints> mySnapPoints;
882 
883 };
static void loadData(UT_IStream &is, UT_Vector4D &v)
DisplayIcon opDisplayIcon(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
bool getPacked() const
void setPacked(bool val)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
static void saveData(std::ostream &os, UT_StringHolder s)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
bool operator!=(const SOP_ControlParms &src) const
UT_Vector3D getRotate() const
void copyFrom(const OP_NodeParms *src) override
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
void setCenter(UT_Vector3D val)
void setSnapPoints(const UT_Array< SnapPoints > &val)
void setUseColor(bool val)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
const OP_Context & context() const
Definition: OP_NodeParms.h:97
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
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
UT_Vector3D getSize() const
GLdouble s
Definition: glad.h:3009
bool isParmColorRamp(exint idx) const override
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
An output stream object that owns its own string buffer storage.
**But if you need a result
Definition: thread.h:613
const char * getNestParmName(TempIndex fieldnum) const override
static void saveData(std::ostream &os, UT_Matrix2D v)
Orientation getOrientation() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &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.
static void saveData(std::ostream &os, UT_Vector4D v)
UT_StringHolder createString(const UT_Array< SnapPoints > &list) const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, int64 &v)
bool opShadedMode(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void loadFromOpSubclass(const LoadParms &loadparms) override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void saveData(std::ostream &os, UT_Matrix4D v)
UT_Vector3D opRotate(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector3D opColor(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const SnapPoints &src) const
static void saveData(std::ostream &os, int64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
bool load(UT_IStream &is)
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
static void loadData(UT_IStream &is, fpreal64 &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
bool operator==(const SnapPoints &src) const
SYS_FORCE_INLINE UT_StringHolder getToken(DisplayIcon enum_value)
const UT_Array< SnapPoints > & getSnapPoints() const
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
static void saveData(std::ostream &os, UT_Matrix3D v)
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
fpreal64 opUniformScale(const SOP_NodeVerb::CookParms &cookparms) const
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
ControlType getControlType() const
void save(std::ostream &os) const
exint opSnapPoints(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setUniformScale(fpreal64 val)
exint getNestNumParms(TempIndex idx) const override
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 getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
UT_Vector3D opinstSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void saveData(std::ostream &os, bool v)
UT_Vector3T< fpreal64 > UT_Vector3D
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
UT_Vector3D opCenter(const SOP_NodeVerb::CookParms &cookparms) const
Orientation opOrientation(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector3D getColor() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static int version()
SYS_FORCE_INLINE void strcat(const char *src)
bool opUseColor(const SOP_NodeVerb::CookParms &cookparms) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
void setSize(UT_Vector3D val)
bool opPacked(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setOrientation(Orientation val)
UT_Vector3D opSize(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, UT_Vector3D &v)
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
bool getUseColor() const
void setControlType(ControlType val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
void setRotate(UT_Vector3D val)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, UT_StringHolder &v)
bool operator==(const SOP_ControlParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
ParmType getNestParmType(TempIndex fieldnum) const override
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void setShadedMode(bool val)
fpreal64 getUniformScale() const
GLboolean r
Definition: glcorearb.h:1222
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, bool &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
type
Definition: core.h:1059
static void saveData(std::ostream &os, UT_Vector2D v)
void setColor(UT_Vector3D val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setDisplayIcon(DisplayIcon val)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
bool getShadedMode() const
DisplayIcon getDisplayIcon() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_Vector3D opSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
UT_Vector3D getCenter() const
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
ControlType opControlType(const SOP_NodeVerb::CookParms &cookparms) const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663