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 <OP/OP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 namespace SOP_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 
192  if (baseGetSignature() != src.baseGetSignature()) return false;
193 
194  return true;
195  }
196  bool operator!=(const SOP_ControlParms &src) const
197  {
198  return !operator==(src);
199  }
203 
204 
205 
206  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
207  {
208  myUseColor = true;
209  if (true)
210  graph->evalOpParm(myUseColor, nodeidx, "usecolor", time, graph->isDirect()?nullptr:depnode);
211  myColor = UT_Vector3D(1,1,1);
212  if (true)
213  graph->evalOpParm(myColor, nodeidx, "color", time, graph->isDirect()?nullptr:depnode);
214  mySize = UT_Vector3D(1,1,1);
215  if (true)
216  graph->evalOpParm(mySize, nodeidx, "size", time, graph->isDirect()?nullptr:depnode);
217  myCenter = UT_Vector3D(0,0,0);
218  if (true)
219  graph->evalOpParm(myCenter, nodeidx, "t", time, graph->isDirect()?nullptr:depnode);
220  myRotate = UT_Vector3D(0,0,0);
221  if (true)
222  graph->evalOpParm(myRotate, nodeidx, "r", time, graph->isDirect()?nullptr:depnode);
223  myUniformScale = 1;
224  if (true)
225  graph->evalOpParm(myUniformScale, nodeidx, "scale", time, graph->isDirect()?nullptr:depnode);
226  myDisplayIcon = 0;
227  if (true)
228  graph->evalOpParm(myDisplayIcon, nodeidx, "displayicon", time, graph->isDirect()?nullptr:depnode);
229  myControlType = 0;
230  if (true && ( (true&&!(((int64(getDisplayIcon())==1)))) ) )
231  graph->evalOpParm(myControlType, nodeidx, "controltype", time, graph->isDirect()?nullptr:depnode);
232  myOrientation = 0;
233  if (true && ( (true&&!(((int64(getDisplayIcon())==1))||((int64(getDisplayIcon())!=1)&&(int64(getControlType())!=1)&&(int64(getControlType())!=3)&&(int64(getControlType())!=4)&&(int64(getControlType())!=6)))) ) )
234  graph->evalOpParm(myOrientation, nodeidx, "orientation", time, graph->isDirect()?nullptr:depnode);
235  myShadedMode = false;
236  if (true)
237  graph->evalOpParm(myShadedMode, nodeidx, "shadedmode", time, graph->isDirect()?nullptr:depnode);
238  myPacked = true;
239  if (true)
240  graph->evalOpParm(myPacked, nodeidx, "packed", time, graph->isDirect()?nullptr:depnode);
241  if (true)
242  {
243  int64 length = 0;
244  graph->evalOpParm(length, nodeidx, "numsnappoints", time, graph->isDirect()?nullptr:depnode);
245  if (length < 0) length = 0;
246  mySnapPoints.setSize(length);
247  for (exint i = 0; i < length; i++)
248  {
249  int parmidx[1];
250  int offsets[1];
251  parmidx[0] = i+1;
252  offsets[0] = 1;
253  auto && _curentry = mySnapPoints(i);
254  (void) _curentry;
255  _curentry.snappos = UT_Vector3D(0,0,0);
256  if (true)
257  graph->evalOpParmInst(_curentry.snappos, nodeidx, "snappos#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
258 
259  }
260  }
261  else
262  mySnapPoints.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_ControlParms *)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, myUseColor);
291  break;
292  case 1:
293  coerceValue(value, myColor);
294  break;
295  case 2:
296  coerceValue(value, mySize);
297  break;
298  case 3:
299  coerceValue(value, myCenter);
300  break;
301  case 4:
302  coerceValue(value, myRotate);
303  break;
304  case 5:
305  coerceValue(value, myUniformScale);
306  break;
307  case 6:
308  coerceValue(value, myDisplayIcon);
309  break;
310  case 7:
311  coerceValue(value, myControlType);
312  break;
313  case 8:
314  coerceValue(value, myOrientation);
315  break;
316  case 9:
317  coerceValue(value, myShadedMode);
318  break;
319  case 10:
320  coerceValue(value, myPacked);
321  break;
322  case 11:
323  if (idx.size() == 1)
324  coerceValue(value, mySnapPoints.entries());
325  else if (instance[0] < mySnapPoints.entries())
326  {
327  auto && _data = mySnapPoints(instance[0]);
328  switch (idx[1])
329  {
330  case 0:
331  coerceValue(value, _data.snappos);
332  break;
333 
334  }
335  }
336  break;
337 
338  }
339  }
340 
341  bool isParmColorRamp(exint idx) const override
342  {
343  switch (idx)
344  {
345 
346  }
347  return false;
348  }
349 
350  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
351  { doGetParmValue(idx, instance, value); }
352  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
353  { doGetParmValue(idx, instance, value); }
354  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
355  { doGetParmValue(idx, instance, value); }
356  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
357  { doGetParmValue(idx, instance, value); }
358  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
359  { doGetParmValue(idx, instance, value); }
360  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
361  { doGetParmValue(idx, instance, value); }
362  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
363  { doGetParmValue(idx, instance, value); }
364  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
365  { doGetParmValue(idx, instance, value); }
366  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
367  { doGetParmValue(idx, instance, value); }
368  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
369  { doGetParmValue(idx, instance, value); }
370  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
371  { doGetParmValue(idx, instance, value); }
372 
373  template <typename T>
374  void
375  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
376  {
377  if (idx.size() < 1)
378  return;
379  UT_ASSERT(idx.size() == instance.size()+1);
380  if (idx.size() != instance.size()+1)
381  return;
382  switch (idx[0])
383  {
384  case 0:
385  coerceValue(myUseColor, ( ( value ) ));
386  break;
387  case 1:
388  coerceValue(myColor, ( ( value ) ));
389  break;
390  case 2:
391  coerceValue(mySize, ( ( value ) ));
392  break;
393  case 3:
394  coerceValue(myCenter, ( ( value ) ));
395  break;
396  case 4:
397  coerceValue(myRotate, ( ( value ) ));
398  break;
399  case 5:
400  coerceValue(myUniformScale, ( ( value ) ));
401  break;
402  case 6:
403  coerceValue(myDisplayIcon, clampMinValue(0, clampMaxValue(2, value ) ));
404  break;
405  case 7:
406  coerceValue(myControlType, clampMinValue(0, clampMaxValue(7, value ) ));
407  break;
408  case 8:
409  coerceValue(myOrientation, clampMinValue(0, clampMaxValue(6, value ) ));
410  break;
411  case 9:
412  coerceValue(myShadedMode, ( ( value ) ));
413  break;
414  case 10:
415  coerceValue(myPacked, ( ( value ) ));
416  break;
417  case 11:
418  if (idx.size() == 1)
419  {
420  exint newsize;
421  coerceValue(newsize, value);
422  if (newsize < 0) newsize = 0;
423  mySnapPoints.setSize(newsize);
424  }
425  else
426  {
427  if (instance[0] < 0)
428  return;
429  mySnapPoints.setSizeIfNeeded(instance[0]+1);
430  auto && _data = mySnapPoints(instance[0]);
431  switch (idx[1])
432  {
433  case 0:
434  coerceValue(_data.snappos, value);
435  break;
436 
437  }
438  }
439  break;
440 
441  }
442  }
443 
444  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
445  { doSetParmValue(idx, instance, value); }
446  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
447  { doSetParmValue(idx, instance, value); }
448  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
449  { doSetParmValue(idx, instance, value); }
450  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
451  { doSetParmValue(idx, instance, value); }
452  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
453  { doSetParmValue(idx, instance, value); }
454  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
455  { doSetParmValue(idx, instance, value); }
456  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
457  { doSetParmValue(idx, instance, value); }
458  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
459  { doSetParmValue(idx, instance, value); }
460  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
461  { doSetParmValue(idx, instance, value); }
462  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
463  { doSetParmValue(idx, instance, value); }
464  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
465  { doSetParmValue(idx, instance, value); }
466 
467  exint getNestNumParms(TempIndex idx) const override
468  {
469  if (idx.size() == 0)
470  return 12;
471  switch (idx[0])
472  {
473  case 11:
474  return 1;
475 
476  }
477  // Invalid
478  return 0;
479  }
480 
481  const char *getNestParmName(TempIndex fieldnum) const override
482  {
483  if (fieldnum.size() < 1)
484  return 0;
485  switch (fieldnum[0])
486  {
487  case 0:
488  return "usecolor";
489  case 1:
490  return "color";
491  case 2:
492  return "size";
493  case 3:
494  return "t";
495  case 4:
496  return "r";
497  case 5:
498  return "scale";
499  case 6:
500  return "displayicon";
501  case 7:
502  return "controltype";
503  case 8:
504  return "orientation";
505  case 9:
506  return "shadedmode";
507  case 10:
508  return "packed";
509  case 11:
510  if (fieldnum.size() == 1)
511  return "numsnappoints";
512  switch (fieldnum[1])
513  {
514  case 0:
515  return "snappos#";
516 
517  }
518  return 0;
519 
520  }
521  return 0;
522  }
523 
524  ParmType getNestParmType(TempIndex fieldnum) const override
525  {
526  if (fieldnum.size() < 1)
527  return PARM_UNSUPPORTED;
528  switch (fieldnum[0])
529  {
530  case 0:
531  return PARM_INTEGER;
532  case 1:
533  return PARM_VECTOR3;
534  case 2:
535  return PARM_VECTOR3;
536  case 3:
537  return PARM_VECTOR3;
538  case 4:
539  return PARM_VECTOR3;
540  case 5:
541  return PARM_FLOAT;
542  case 6:
543  return PARM_INTEGER;
544  case 7:
545  return PARM_INTEGER;
546  case 8:
547  return PARM_INTEGER;
548  case 9:
549  return PARM_INTEGER;
550  case 10:
551  return PARM_INTEGER;
552  case 11:
553  if (fieldnum.size() == 1)
554  return PARM_MULTIPARM;
555  switch (fieldnum[1])
556  {
557  case 0:
558  return PARM_VECTOR3;
559 
560  }
561  return PARM_UNSUPPORTED;
562 
563  }
564  return PARM_UNSUPPORTED;
565  }
566 
567  // Boiler plate to load individual types.
568  static void loadData(UT_IStream &is, int64 &v)
569  { is.bread(&v, 1); }
570  static void loadData(UT_IStream &is, bool &v)
571  { int64 iv; is.bread(&iv, 1); v = iv; }
572  static void loadData(UT_IStream &is, fpreal64 &v)
573  { is.bread<fpreal64>(&v, 1); }
574  static void loadData(UT_IStream &is, UT_Vector2D &v)
575  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
576  static void loadData(UT_IStream &is, UT_Vector3D &v)
577  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
578  is.bread<fpreal64>(&v.z(), 1); }
579  static void loadData(UT_IStream &is, UT_Vector4D &v)
580  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
581  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
582  static void loadData(UT_IStream &is, UT_Matrix2D &v)
583  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
584  static void loadData(UT_IStream &is, UT_Matrix3D &v)
585  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
586  static void loadData(UT_IStream &is, UT_Matrix4D &v)
587  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
588  static void loadData(UT_IStream &is, UT_Vector2I &v)
589  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
590  static void loadData(UT_IStream &is, UT_Vector3I &v)
591  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
592  is.bread<int64>(&v.z(), 1); }
593  static void loadData(UT_IStream &is, UT_Vector4I &v)
594  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
595  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
597  { is.bread(v); }
599  { UT_StringHolder rampdata;
600  loadData(is, rampdata);
601  if (rampdata.isstring())
602  {
603  v.reset(new UT_Ramp());
604  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
605  v->load(istr);
606  }
607  else v.reset();
608  }
611  loadData(is, data);
612  if (data.isstring())
613  {
614  // Find the data type.
615  const char *colon = UT_StringWrap(data).findChar(':');
616  if (colon)
617  {
618  int typelen = colon - data.buffer();
620  type.strncpy(data.buffer(), typelen);
621  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
622 
623  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
624  }
625  }
626  else v.reset();
627  }
628 
629  static void saveData(std::ostream &os, int64 v)
630  { UTwrite(os, &v); }
631  static void saveData(std::ostream &os, bool v)
632  { int64 iv = v; UTwrite(os, &iv); }
633  static void saveData(std::ostream &os, fpreal64 v)
634  { UTwrite<fpreal64>(os, &v); }
635  static void saveData(std::ostream &os, UT_Vector2D v)
636  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
637  static void saveData(std::ostream &os, UT_Vector3D v)
638  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
639  UTwrite<fpreal64>(os, &v.z()); }
640  static void saveData(std::ostream &os, UT_Vector4D v)
641  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
642  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
643  static void saveData(std::ostream &os, UT_Matrix2D v)
645  static void saveData(std::ostream &os, UT_Matrix3D v)
647  static void saveData(std::ostream &os, UT_Matrix4D v)
649  static void saveData(std::ostream &os, UT_StringHolder s)
650  { UT_StringWrap(s).saveBinary(os); }
651  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
653  UT_OStringStream ostr;
654  if (s) s->save(ostr);
655  result = ostr.str();
656  saveData(os, result);
657  }
658  static void saveData(std::ostream &os, PRM_DataItemHandle s)
660  UT_OStringStream ostr;
661  if (s)
662  {
663  ostr << s->getDataTypeToken();
664  ostr << ":";
665  s->saveBinary(ostr);
666  }
667  result = ostr.str();
668  saveData(os, result);
669  }
670 
671 
672  void save(std::ostream &os) const
673  {
674  int32 v = version();
675  UTwrite(os, &v);
676  saveData(os, myUseColor);
677  saveData(os, myColor);
678  saveData(os, mySize);
679  saveData(os, myCenter);
680  saveData(os, myRotate);
681  saveData(os, myUniformScale);
682  saveData(os, myDisplayIcon);
683  saveData(os, myControlType);
684  saveData(os, myOrientation);
685  saveData(os, myShadedMode);
686  saveData(os, myPacked);
687  {
688  int64 length = mySnapPoints.entries();
689  UTwrite(os, &length);
690  for (exint i = 0; i < length; i++)
691  {
692  auto && _curentry = mySnapPoints(i);
693  (void) _curentry;
694  saveData(os, _curentry.snappos);
695 
696  }
697  }
698 
699  }
700 
701  bool load(UT_IStream &is)
702  {
703  int32 v;
704  is.bread(&v, 1);
705  if (version() != v)
706  {
707  // Fail incompatible versions
708  return false;
709  }
710  loadData(is, myUseColor);
711  loadData(is, myColor);
712  loadData(is, mySize);
713  loadData(is, myCenter);
714  loadData(is, myRotate);
715  loadData(is, myUniformScale);
716  loadData(is, myDisplayIcon);
717  loadData(is, myControlType);
718  loadData(is, myOrientation);
719  loadData(is, myShadedMode);
720  loadData(is, myPacked);
721  {
722  int64 length;
723  is.read(&length, 1);
724  mySnapPoints.setSize(length);
725  for (exint i = 0; i < length; i++)
726  {
727  auto && _curentry = mySnapPoints(i);
728  (void) _curentry;
729  loadData(is, _curentry.snappos);
730 
731  }
732  }
733 
734  return true;
735  }
736 
737  bool getUseColor() const { return myUseColor; }
738  void setUseColor(bool val) { myUseColor = val; }
739  bool opUseColor(const SOP_NodeVerb::CookParms &cookparms) const
740  {
741  SOP_Node *thissop = cookparms.getNode();
742  if (!thissop) return getUseColor();
743  bool result;
744  OP_Utils::evalOpParm(result, thissop, "usecolor", cookparms.getCookTime(), 0);
745  return result;
746  }
747  UT_Vector3D getColor() const { return myColor; }
748  void setColor(UT_Vector3D val) { myColor = val; }
750  {
751  SOP_Node *thissop = cookparms.getNode();
752  if (!thissop) return getColor();
754  OP_Utils::evalOpParm(result, thissop, "color", cookparms.getCookTime(), 0);
755  return result;
756  }
757  UT_Vector3D getSize() const { return mySize; }
758  void setSize(UT_Vector3D val) { mySize = val; }
760  {
761  SOP_Node *thissop = cookparms.getNode();
762  if (!thissop) return getSize();
764  OP_Utils::evalOpParm(result, thissop, "size", cookparms.getCookTime(), 0);
765  return result;
766  }
767  UT_Vector3D getCenter() const { return myCenter; }
768  void setCenter(UT_Vector3D val) { myCenter = val; }
770  {
771  SOP_Node *thissop = cookparms.getNode();
772  if (!thissop) return getCenter();
774  OP_Utils::evalOpParm(result, thissop, "t", cookparms.getCookTime(), 0);
775  return result;
776  }
777  UT_Vector3D getRotate() const { return myRotate; }
778  void setRotate(UT_Vector3D val) { myRotate = val; }
780  {
781  SOP_Node *thissop = cookparms.getNode();
782  if (!thissop) return getRotate();
784  OP_Utils::evalOpParm(result, thissop, "r", cookparms.getCookTime(), 0);
785  return result;
786  }
787  fpreal64 getUniformScale() const { return myUniformScale; }
788  void setUniformScale(fpreal64 val) { myUniformScale = val; }
790  {
791  SOP_Node *thissop = cookparms.getNode();
792  if (!thissop) return getUniformScale();
794  OP_Utils::evalOpParm(result, thissop, "scale", cookparms.getCookTime(), 0);
795  return result;
796  }
797  DisplayIcon getDisplayIcon() const { return DisplayIcon(myDisplayIcon); }
798  void setDisplayIcon(DisplayIcon val) { myDisplayIcon = int64(val); }
800  {
801  SOP_Node *thissop = cookparms.getNode();
802  if (!thissop) return getDisplayIcon();
803  int64 result;
804  OP_Utils::evalOpParm(result, thissop, "displayicon", cookparms.getCookTime(), 0);
805  return DisplayIcon(result);
806  }
807  ControlType getControlType() const { return ControlType(myControlType); }
808  void setControlType(ControlType val) { myControlType = int64(val); }
810  {
811  SOP_Node *thissop = cookparms.getNode();
812  if (!thissop) return getControlType();
813  int64 result;
814  OP_Utils::evalOpParm(result, thissop, "controltype", cookparms.getCookTime(), 0);
815  return ControlType(result);
816  }
817  Orientation getOrientation() const { return Orientation(myOrientation); }
818  void setOrientation(Orientation val) { myOrientation = int64(val); }
820  {
821  SOP_Node *thissop = cookparms.getNode();
822  if (!thissop) return getOrientation();
823  int64 result;
824  OP_Utils::evalOpParm(result, thissop, "orientation", cookparms.getCookTime(), 0);
825  return Orientation(result);
826  }
827  bool getShadedMode() const { return myShadedMode; }
828  void setShadedMode(bool val) { myShadedMode = val; }
829  bool opShadedMode(const SOP_NodeVerb::CookParms &cookparms) const
830  {
831  SOP_Node *thissop = cookparms.getNode();
832  if (!thissop) return getShadedMode();
833  bool result;
834  OP_Utils::evalOpParm(result, thissop, "shadedmode", cookparms.getCookTime(), 0);
835  return result;
836  }
837  bool getPacked() const { return myPacked; }
838  void setPacked(bool val) { myPacked = val; }
839  bool opPacked(const SOP_NodeVerb::CookParms &cookparms) const
840  {
841  SOP_Node *thissop = cookparms.getNode();
842  if (!thissop) return getPacked();
843  bool result;
844  OP_Utils::evalOpParm(result, thissop, "packed", cookparms.getCookTime(), 0);
845  return result;
846  }
847  const UT_Array<SnapPoints> &getSnapPoints() const { return mySnapPoints; }
848 void setSnapPoints(const UT_Array<SnapPoints> &val) { mySnapPoints = val; }
850  {
851  SOP_Node *thissop = cookparms.getNode();
852  if (!thissop) return getSnapPoints().entries();
853  exint result;
854  OP_Utils::evalOpParm(result, thissop, "numsnappoints", cookparms.getCookTime(), 0);
855  return result;
856  }
857  UT_Vector3D opSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
858  { return opinstSnapPoints_snappos(cookparms, &_idx); }
859  UT_Vector3D opinstSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
860  {
861  SOP_Node *thissop = cookparms.getNode();
862  if (!thissop) return (mySnapPoints(_idx[0]).snappos);
863  int _parmidx[2-1];
864  _parmidx[1-1] = _idx[1-1] + 1;
865 
867  OP_Utils::evalOpParmInst(result, thissop, "snappos#", _parmidx, cookparms.getCookTime(), 0, 2-1);
868  return (result);
869  }
870 
871 
872 private:
873  bool myUseColor;
874  UT_Vector3D myColor;
875  UT_Vector3D mySize;
876  UT_Vector3D myCenter;
877  UT_Vector3D myRotate;
878  fpreal64 myUniformScale;
879  int64 myDisplayIcon;
880  int64 myControlType;
881  int64 myOrientation;
882  bool myShadedMode;
883  bool myPacked;
884  UT_Array<SnapPoints> mySnapPoints;
885 
886 };
static void loadData(UT_IStream &is, UT_Vector4D &v)
DisplayIcon opDisplayIcon(const SOP_NodeVerb::CookParms &cookparms) const
type
Definition: core.h:556
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:63
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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:622
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
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:303
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:655
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:278
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:96
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
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
#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:372
ParmType getNestParmType(TempIndex fieldnum) const override
const char * findChar(int c) const
Definition: UT_String.h:1401
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
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
static void saveData(std::ostream &os, UT_Vector2D v)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
void setColor(UT_Vector3D val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setDisplayIcon(DisplayIcon val)
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