HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_AttribFromVolume.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_AttribFromVolumeEnums
24 {
25  enum class Type
26  {
27  FLOAT = 0,
28  INT,
29  VECTOR
30  };
31 
33  getToken(Type enum_value)
34  {
35  using namespace UT::Literal;
36  switch (enum_value) {
37  case Type::FLOAT: return "float"_sh;
38  case Type::INT: return "int"_sh;
39  case Type::VECTOR: return "vector"_sh;
40  default: UT_ASSERT(false); return ""_sh;
41  }
42  }
43 
44  enum class MonoRampMode
45  {
46  CLAMP = 0,
47  PERIODIC
48  };
49 
51  getToken(MonoRampMode enum_value)
52  {
53  using namespace UT::Literal;
54  switch (enum_value) {
55  case MonoRampMode::CLAMP: return "clamp"_sh;
56  case MonoRampMode::PERIODIC: return "periodic"_sh;
57  default: UT_ASSERT(false); return ""_sh;
58  }
59  }
60 
61  enum class Monopreset
62  {
63  NONE = 0,
64  INCREASING,
66  HILL,
67  VALLEY,
68  STEP,
69  SQUARE
70  };
71 
73  getToken(Monopreset enum_value)
74  {
75  using namespace UT::Literal;
76  switch (enum_value) {
77  case Monopreset::NONE: return "none"_sh;
78  case Monopreset::INCREASING: return "increasing"_sh;
79  case Monopreset::DESCREASING: return "descreasing"_sh;
80  case Monopreset::HILL: return "hill"_sh;
81  case Monopreset::VALLEY: return "valley"_sh;
82  case Monopreset::STEP: return "step"_sh;
83  case Monopreset::SQUARE: return "square"_sh;
84  default: UT_ASSERT(false); return ""_sh;
85  }
86  }
87 
88  enum class VectorRampMode
89  {
90  CLAMP = 0,
91  PERIODIC
92  };
93 
95  getToken(VectorRampMode enum_value)
96  {
97  using namespace UT::Literal;
98  switch (enum_value) {
99  case VectorRampMode::CLAMP: return "clamp"_sh;
100  case VectorRampMode::PERIODIC: return "periodic"_sh;
101  default: UT_ASSERT(false); return ""_sh;
102  }
103  }
104 
105  enum class Vectorpreset
106  {
107  NONE = 0,
108  FALSE_,
109  PINK,
110  MONO,
111  BLACKBODY,
112  BIPARTITE
113  };
114 
116  getToken(Vectorpreset enum_value)
117  {
118  using namespace UT::Literal;
119  switch (enum_value) {
120  case Vectorpreset::NONE: return "none"_sh;
121  case Vectorpreset::FALSE_: return "false"_sh;
122  case Vectorpreset::PINK: return "pink"_sh;
123  case Vectorpreset::MONO: return "mono"_sh;
124  case Vectorpreset::BLACKBODY: return "blackbody"_sh;
125  case Vectorpreset::BIPARTITE: return "bipartite"_sh;
126  default: UT_ASSERT(false); return ""_sh;
127  }
128  }
129 
130 }
131 
132 
134 {
135 public:
136  static int version() { return 1; }
137 
139  {
140  myGroup = ""_UTsh;
141  myField = ""_UTsh;
142  myName = "Cd"_UTsh;
143  myCreateVarMap = false;
144  myVarName = ""_UTsh;
145  myType = 0;
146  mySize = 3;
147  myDefault = UT_Vector4D(0,0,0,0);
148  myRangeIn = UT_Vector2D(0,1);
149  myMonoEnable = false;
150  myMonoRampMode = 0;
151  myMonopreset = 0;
152  myMonoRamp = UT_SharedPtr<UT_Ramp>(0);
153  myVectorEnable = false;
154  myVectorRampMode = 0;
155  myVectorpreset = 0;
156  myVectorRamp = UT_SharedPtr<UT_Ramp>(0);
157  myRangeOut = UT_Vector2D(0,1);
158 
159  }
160 
161  explicit SOP_AttribFromVolumeParms(const SOP_AttribFromVolumeParms &) = default;
164  SOP_AttribFromVolumeParms &operator=(SOP_AttribFromVolumeParms &&) noexcept = default;
165 
167 
169  {
170  if (myGroup != src.myGroup) return false;
171  if (myField != src.myField) return false;
172  if (myName != src.myName) return false;
173  if (myCreateVarMap != src.myCreateVarMap) return false;
174  if (myVarName != src.myVarName) return false;
175  if (myType != src.myType) return false;
176  if (mySize != src.mySize) return false;
177  if (myDefault != src.myDefault) return false;
178  if (myRangeIn != src.myRangeIn) return false;
179  if (myMonoEnable != src.myMonoEnable) return false;
180  if (myMonoRampMode != src.myMonoRampMode) return false;
181  if (myMonopreset != src.myMonopreset) return false;
182  if (myMonoRamp != src.myMonoRamp)
183  { if (!myMonoRamp || !src.myMonoRamp || !(*myMonoRamp == *src.myMonoRamp)) return false; }
184  if (myVectorEnable != src.myVectorEnable) return false;
185  if (myVectorRampMode != src.myVectorRampMode) return false;
186  if (myVectorpreset != src.myVectorpreset) return false;
187  if (myVectorRamp != src.myVectorRamp)
188  { if (!myVectorRamp || !src.myVectorRamp || !(*myVectorRamp == *src.myVectorRamp)) return false; }
189  if (myRangeOut != src.myRangeOut) return false;
190 
191  return true;
192  }
194  {
195  return !operator==(src);
196  }
202 
203 
204 
205  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
206  {
207  myGroup = ""_UTsh;
208  if (true)
209  graph->evalOpParm(myGroup, nodeidx, "group", time, 0);
210  myField = ""_UTsh;
211  if (true)
212  graph->evalOpParm(myField, nodeidx, "field", time, 0);
213  myName = "Cd"_UTsh;
214  if (true)
215  graph->evalOpParm(myName, nodeidx, "name", time, 0);
216  myCreateVarMap = false;
217  if (true)
218  graph->evalOpParm(myCreateVarMap, nodeidx, "createvarmap", time, 0);
219  myVarName = ""_UTsh;
220  if (true && ( (true&&!(((getCreateVarMap()==0)))) ) )
221  graph->evalOpParm(myVarName, nodeidx, "varname", time, 0);
222  myType = 0;
223  if (true)
224  graph->evalOpParm(myType, nodeidx, "type", time, 0);
225  mySize = 3;
226  if (true)
227  graph->evalOpParm(mySize, nodeidx, "size", time, 0);
228  myDefault = UT_Vector4D(0,0,0,0);
229  if (true)
230  graph->evalOpParm(myDefault, nodeidx, "default", time, 0);
231  myRangeIn = UT_Vector2D(0,1);
232  if (true)
233  graph->evalOpParm(myRangeIn, nodeidx, "rangein", time, 0);
234  myMonoEnable = false;
235  if (true)
236  graph->evalOpParm(myMonoEnable, nodeidx, "monoenable", time, 0);
237  myMonoRampMode = 0;
238  if (true && ( (true&&!(((getMonoEnable()==0)))) ) )
239  graph->evalOpParm(myMonoRampMode, nodeidx, "monorampmode", time, 0);
240  myMonopreset = 0;
241  if (true && ( (true&&!(((getMonoEnable()==0)))) ) )
242  graph->evalOpParm(myMonopreset, nodeidx, "monopreset", time, 0);
243  myMonoRamp = UT_SharedPtr<UT_Ramp>(0);
244  if (true && ( (true&&!(((getMonoEnable()==0)))) ) )
245  graph->evalOpParm(myMonoRamp, nodeidx, "monoramp", time, 0);
246  myVectorEnable = false;
247  if (true)
248  graph->evalOpParm(myVectorEnable, nodeidx, "vectorenable", time, 0);
249  myVectorRampMode = 0;
250  if (true && ( (true&&!(((getVectorEnable()==0)))) ) )
251  graph->evalOpParm(myVectorRampMode, nodeidx, "vectorrampmode", time, 0);
252  myVectorpreset = 0;
253  if (true && ( (true&&!(((getVectorEnable()==0)))) ) )
254  graph->evalOpParm(myVectorpreset, nodeidx, "vectorpreset", time, 0);
255  myVectorRamp = UT_SharedPtr<UT_Ramp>(0);
256  if (true && ( (true&&!(((getVectorEnable()==0)))) ) )
257  graph->evalOpParm(myVectorRamp, nodeidx, "vectorramp", time, 0);
258  myRangeOut = UT_Vector2D(0,1);
259  if (true)
260  graph->evalOpParm(myRangeOut, nodeidx, "rangeout", time, 0);
261 
262  }
263 
264 
265  void loadFromOpSubclass(const LoadParms &loadparms) override
266  {
267  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
268  }
269 
270 
271  void copyFrom(const OP_NodeParms *src) override
272  {
273  *this = *((const SOP_AttribFromVolumeParms *)src);
274  }
275 
276  template <typename T>
277  void
278  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
279  {
280  if (idx.size() < 1)
281  return;
282  UT_ASSERT(idx.size() == instance.size()+1);
283  if (idx.size() != instance.size()+1)
284  return;
285  switch (idx[0])
286  {
287  case 0:
288  coerceValue(value, myGroup);
289  break;
290  case 1:
291  coerceValue(value, myField);
292  break;
293  case 2:
294  coerceValue(value, myName);
295  break;
296  case 3:
297  coerceValue(value, myCreateVarMap);
298  break;
299  case 4:
300  coerceValue(value, myVarName);
301  break;
302  case 5:
303  coerceValue(value, myType);
304  break;
305  case 6:
306  coerceValue(value, mySize);
307  break;
308  case 7:
309  coerceValue(value, myDefault);
310  break;
311  case 8:
312  coerceValue(value, myRangeIn);
313  break;
314  case 9:
315  coerceValue(value, myMonoEnable);
316  break;
317  case 10:
318  coerceValue(value, myMonoRampMode);
319  break;
320  case 11:
321  coerceValue(value, myMonopreset);
322  break;
323  case 12:
324  coerceValue(value, myMonoRamp);
325  break;
326  case 13:
327  coerceValue(value, myVectorEnable);
328  break;
329  case 14:
330  coerceValue(value, myVectorRampMode);
331  break;
332  case 15:
333  coerceValue(value, myVectorpreset);
334  break;
335  case 16:
336  coerceValue(value, myVectorRamp);
337  break;
338  case 17:
339  coerceValue(value, myRangeOut);
340  break;
341 
342  }
343  }
344 
345  bool isParmColorRamp(exint idx) const override
346  {
347  switch (idx)
348  {
349  case 16:
350  return true;
351  }
352  return false;
353  }
354 
355  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
356  { doGetParmValue(idx, instance, value); }
357  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
358  { doGetParmValue(idx, instance, value); }
359  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
360  { doGetParmValue(idx, instance, value); }
361  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
362  { doGetParmValue(idx, instance, value); }
363  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
364  { doGetParmValue(idx, instance, value); }
365  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
366  { doGetParmValue(idx, instance, value); }
367  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
368  { doGetParmValue(idx, instance, value); }
369  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
370  { doGetParmValue(idx, instance, value); }
371  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
372  { doGetParmValue(idx, instance, value); }
373  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
374  { doGetParmValue(idx, instance, value); }
375  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
376  { doGetParmValue(idx, instance, value); }
377 
378  template <typename T>
379  void
380  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
381  {
382  if (idx.size() < 1)
383  return;
384  UT_ASSERT(idx.size() == instance.size()+1);
385  if (idx.size() != instance.size()+1)
386  return;
387  switch (idx[0])
388  {
389  case 0:
390  coerceValue(myGroup, ( ( value ) ));
391  break;
392  case 1:
393  coerceValue(myField, ( ( value ) ));
394  break;
395  case 2:
396  coerceValue(myName, ( ( value ) ));
397  break;
398  case 3:
399  coerceValue(myCreateVarMap, ( ( value ) ));
400  break;
401  case 4:
402  coerceValue(myVarName, ( ( value ) ));
403  break;
404  case 5:
405  coerceValue(myType, clampMinValue(0, clampMaxValue(2, value ) ));
406  break;
407  case 6:
408  coerceValue(mySize, clampMinValue(1, ( value ) ));
409  break;
410  case 7:
411  coerceValue(myDefault, ( ( value ) ));
412  break;
413  case 8:
414  coerceValue(myRangeIn, ( ( value ) ));
415  break;
416  case 9:
417  coerceValue(myMonoEnable, ( ( value ) ));
418  break;
419  case 10:
420  coerceValue(myMonoRampMode, clampMinValue(0, clampMaxValue(1, value ) ));
421  break;
422  case 11:
423  coerceValue(myMonopreset, clampMinValue(0, clampMaxValue(6, value ) ));
424  break;
425  case 12:
426  coerceValue(myMonoRamp, clampMinValue(1, ( value ) ));
427  break;
428  case 13:
429  coerceValue(myVectorEnable, ( ( value ) ));
430  break;
431  case 14:
432  coerceValue(myVectorRampMode, clampMinValue(0, clampMaxValue(1, value ) ));
433  break;
434  case 15:
435  coerceValue(myVectorpreset, clampMinValue(0, clampMaxValue(5, value ) ));
436  break;
437  case 16:
438  coerceValue(myVectorRamp, clampMinValue(1, ( value ) ));
439  break;
440  case 17:
441  coerceValue(myRangeOut, ( ( value ) ));
442  break;
443 
444  }
445  }
446 
447  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
448  { doSetParmValue(idx, instance, value); }
449  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
450  { doSetParmValue(idx, instance, value); }
451  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
452  { doSetParmValue(idx, instance, value); }
453  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
454  { doSetParmValue(idx, instance, value); }
455  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
456  { doSetParmValue(idx, instance, value); }
457  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
458  { doSetParmValue(idx, instance, value); }
459  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
460  { doSetParmValue(idx, instance, value); }
461  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
462  { doSetParmValue(idx, instance, value); }
463  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
464  { doSetParmValue(idx, instance, value); }
465  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
466  { doSetParmValue(idx, instance, value); }
467  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
468  { doSetParmValue(idx, instance, value); }
469 
470  exint getNestNumParms(TempIndex idx) const override
471  {
472  if (idx.size() == 0)
473  return 18;
474  switch (idx[0])
475  {
476 
477  }
478  // Invalid
479  return 0;
480  }
481 
482  const char *getNestParmName(TempIndex fieldnum) const override
483  {
484  if (fieldnum.size() < 1)
485  return 0;
486  switch (fieldnum[0])
487  {
488  case 0:
489  return "group";
490  case 1:
491  return "field";
492  case 2:
493  return "name";
494  case 3:
495  return "createvarmap";
496  case 4:
497  return "varname";
498  case 5:
499  return "type";
500  case 6:
501  return "size";
502  case 7:
503  return "default";
504  case 8:
505  return "rangein";
506  case 9:
507  return "monoenable";
508  case 10:
509  return "monorampmode";
510  case 11:
511  return "monopreset";
512  case 12:
513  return "monoramp";
514  case 13:
515  return "vectorenable";
516  case 14:
517  return "vectorrampmode";
518  case 15:
519  return "vectorpreset";
520  case 16:
521  return "vectorramp";
522  case 17:
523  return "rangeout";
524 
525  }
526  return 0;
527  }
528 
529  ParmType getNestParmType(TempIndex fieldnum) const override
530  {
531  if (fieldnum.size() < 1)
532  return PARM_UNSUPPORTED;
533  switch (fieldnum[0])
534  {
535  case 0:
536  return PARM_STRING;
537  case 1:
538  return PARM_STRING;
539  case 2:
540  return PARM_STRING;
541  case 3:
542  return PARM_INTEGER;
543  case 4:
544  return PARM_STRING;
545  case 5:
546  return PARM_INTEGER;
547  case 6:
548  return PARM_INTEGER;
549  case 7:
550  return PARM_VECTOR4;
551  case 8:
552  return PARM_VECTOR2;
553  case 9:
554  return PARM_INTEGER;
555  case 10:
556  return PARM_INTEGER;
557  case 11:
558  return PARM_INTEGER;
559  case 12:
560  return PARM_RAMP;
561  case 13:
562  return PARM_INTEGER;
563  case 14:
564  return PARM_INTEGER;
565  case 15:
566  return PARM_INTEGER;
567  case 16:
568  return PARM_RAMP;
569  case 17:
570  return PARM_VECTOR2;
571 
572  }
573  return PARM_UNSUPPORTED;
574  }
575 
576  // Boiler plate to load individual types.
577  static void loadData(UT_IStream &is, int64 &v)
578  { is.bread(&v, 1); }
579  static void loadData(UT_IStream &is, bool &v)
580  { int64 iv; is.bread(&iv, 1); v = iv; }
581  static void loadData(UT_IStream &is, fpreal64 &v)
582  { is.bread<fpreal64>(&v, 1); }
583  static void loadData(UT_IStream &is, UT_Vector2D &v)
584  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
585  static void loadData(UT_IStream &is, UT_Vector3D &v)
586  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
587  is.bread<fpreal64>(&v.z(), 1); }
588  static void loadData(UT_IStream &is, UT_Vector4D &v)
589  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
590  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
591  static void loadData(UT_IStream &is, UT_Matrix2D &v)
592  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
593  static void loadData(UT_IStream &is, UT_Matrix3D &v)
594  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
595  static void loadData(UT_IStream &is, UT_Matrix4D &v)
596  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
597  static void loadData(UT_IStream &is, UT_Vector2I &v)
598  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
599  static void loadData(UT_IStream &is, UT_Vector3I &v)
600  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
601  is.bread<int64>(&v.z(), 1); }
602  static void loadData(UT_IStream &is, UT_Vector4I &v)
603  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
604  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
606  { is.bread(v); }
608  { UT_StringHolder rampdata;
609  loadData(is, rampdata);
610  if (rampdata.isstring())
611  {
612  v.reset(new UT_Ramp());
613  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
614  v->load(istr);
615  }
616  else v.reset();
617  }
620  loadData(is, data);
621  if (data.isstring())
622  {
623  // Find the data type.
624  const char *colon = UT_StringWrap(data).findChar(':');
625  if (colon)
626  {
627  int typelen = colon - data.buffer();
629  type.strncpy(data.buffer(), typelen);
630  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
631 
632  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
633  }
634  }
635  else v.reset();
636  }
637 
638  static void saveData(std::ostream &os, int64 v)
639  { UTwrite(os, &v); }
640  static void saveData(std::ostream &os, bool v)
641  { int64 iv = v; UTwrite(os, &iv); }
642  static void saveData(std::ostream &os, fpreal64 v)
643  { UTwrite<fpreal64>(os, &v); }
644  static void saveData(std::ostream &os, UT_Vector2D v)
645  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
646  static void saveData(std::ostream &os, UT_Vector3D v)
647  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
648  UTwrite<fpreal64>(os, &v.z()); }
649  static void saveData(std::ostream &os, UT_Vector4D v)
650  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
651  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
652  static void saveData(std::ostream &os, UT_Matrix2D v)
654  static void saveData(std::ostream &os, UT_Matrix3D v)
656  static void saveData(std::ostream &os, UT_Matrix4D v)
658  static void saveData(std::ostream &os, UT_StringHolder s)
659  { UT_StringWrap(s).saveBinary(os); }
660  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
662  UT_OStringStream ostr;
663  if (s) s->save(ostr);
664  result = ostr.str();
665  saveData(os, result);
666  }
667  static void saveData(std::ostream &os, PRM_DataItemHandle s)
669  UT_OStringStream ostr;
670  if (s)
671  {
672  ostr << s->getDataTypeToken();
673  ostr << ":";
674  s->saveBinary(ostr);
675  }
676  result = ostr.str();
677  saveData(os, result);
678  }
679 
680 
681  void save(std::ostream &os) const
682  {
683  int32 v = version();
684  UTwrite(os, &v);
685  saveData(os, myGroup);
686  saveData(os, myField);
687  saveData(os, myName);
688  saveData(os, myCreateVarMap);
689  saveData(os, myVarName);
690  saveData(os, myType);
691  saveData(os, mySize);
692  saveData(os, myDefault);
693  saveData(os, myRangeIn);
694  saveData(os, myMonoEnable);
695  saveData(os, myMonoRampMode);
696  saveData(os, myMonopreset);
697  saveData(os, myMonoRamp);
698  saveData(os, myVectorEnable);
699  saveData(os, myVectorRampMode);
700  saveData(os, myVectorpreset);
701  saveData(os, myVectorRamp);
702  saveData(os, myRangeOut);
703 
704  }
705 
706  bool load(UT_IStream &is)
707  {
708  int32 v;
709  is.bread(&v, 1);
710  if (version() != v)
711  {
712  // Fail incompatible versions
713  return false;
714  }
715  loadData(is, myGroup);
716  loadData(is, myField);
717  loadData(is, myName);
718  loadData(is, myCreateVarMap);
719  loadData(is, myVarName);
720  loadData(is, myType);
721  loadData(is, mySize);
722  loadData(is, myDefault);
723  loadData(is, myRangeIn);
724  loadData(is, myMonoEnable);
725  loadData(is, myMonoRampMode);
726  loadData(is, myMonopreset);
727  loadData(is, myMonoRamp);
728  loadData(is, myVectorEnable);
729  loadData(is, myVectorRampMode);
730  loadData(is, myVectorpreset);
731  loadData(is, myVectorRamp);
732  loadData(is, myRangeOut);
733 
734  return true;
735  }
736 
737  const UT_StringHolder & getGroup() const { return myGroup; }
738  void setGroup(const UT_StringHolder & val) { myGroup = val; }
740  {
741  SOP_Node *thissop = cookparms.getNode();
742  if (!thissop) return getGroup();
744  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
745  return result;
746  }
747  const UT_StringHolder & getField() const { return myField; }
748  void setField(const UT_StringHolder & val) { myField = val; }
750  {
751  SOP_Node *thissop = cookparms.getNode();
752  if (!thissop) return getField();
754  OP_Utils::evalOpParm(result, thissop, "field", cookparms.getCookTime(), 0);
755  return result;
756  }
757  const UT_StringHolder & getName() const { return myName; }
758  void setName(const UT_StringHolder & val) { myName = val; }
760  {
761  SOP_Node *thissop = cookparms.getNode();
762  if (!thissop) return getName();
764  OP_Utils::evalOpParm(result, thissop, "name", cookparms.getCookTime(), 0);
765  return result;
766  }
767  bool getCreateVarMap() const { return myCreateVarMap; }
768  void setCreateVarMap(bool val) { myCreateVarMap = val; }
769  bool opCreateVarMap(const SOP_NodeVerb::CookParms &cookparms) const
770  {
771  SOP_Node *thissop = cookparms.getNode();
772  if (!thissop) return getCreateVarMap();
773  bool result;
774  OP_Utils::evalOpParm(result, thissop, "createvarmap", cookparms.getCookTime(), 0);
775  return result;
776  }
777  const UT_StringHolder & getVarName() const { return myVarName; }
778  void setVarName(const UT_StringHolder & val) { myVarName = val; }
780  {
781  SOP_Node *thissop = cookparms.getNode();
782  if (!thissop) return getVarName();
784  OP_Utils::evalOpParm(result, thissop, "varname", cookparms.getCookTime(), 0);
785  return result;
786  }
787  Type getType() const { return Type(myType); }
788  void setType(Type val) { myType = int64(val); }
789  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
790  {
791  SOP_Node *thissop = cookparms.getNode();
792  if (!thissop) return getType();
793  int64 result;
794  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
795  return Type(result);
796  }
797  int64 getSize() const { return mySize; }
798  void setSize(int64 val) { mySize = val; }
799  int64 opSize(const SOP_NodeVerb::CookParms &cookparms) const
800  {
801  SOP_Node *thissop = cookparms.getNode();
802  if (!thissop) return getSize();
803  int64 result;
804  OP_Utils::evalOpParm(result, thissop, "size", cookparms.getCookTime(), 0);
805  return result;
806  }
807  UT_Vector4D getDefault() const { return myDefault; }
808  void setDefault(UT_Vector4D val) { myDefault = val; }
810  {
811  SOP_Node *thissop = cookparms.getNode();
812  if (!thissop) return getDefault();
814  OP_Utils::evalOpParm(result, thissop, "default", cookparms.getCookTime(), 0);
815  return result;
816  }
817  UT_Vector2D getRangeIn() const { return myRangeIn; }
818  void setRangeIn(UT_Vector2D val) { myRangeIn = val; }
820  {
821  SOP_Node *thissop = cookparms.getNode();
822  if (!thissop) return getRangeIn();
824  OP_Utils::evalOpParm(result, thissop, "rangein", cookparms.getCookTime(), 0);
825  return result;
826  }
827  bool getMonoEnable() const { return myMonoEnable; }
828  void setMonoEnable(bool val) { myMonoEnable = val; }
829  bool opMonoEnable(const SOP_NodeVerb::CookParms &cookparms) const
830  {
831  SOP_Node *thissop = cookparms.getNode();
832  if (!thissop) return getMonoEnable();
833  bool result;
834  OP_Utils::evalOpParm(result, thissop, "monoenable", cookparms.getCookTime(), 0);
835  return result;
836  }
837  MonoRampMode getMonoRampMode() const { return MonoRampMode(myMonoRampMode); }
838  void setMonoRampMode(MonoRampMode val) { myMonoRampMode = int64(val); }
840  {
841  SOP_Node *thissop = cookparms.getNode();
842  if (!thissop) return getMonoRampMode();
843  int64 result;
844  OP_Utils::evalOpParm(result, thissop, "monorampmode", cookparms.getCookTime(), 0);
845  return MonoRampMode(result);
846  }
847  Monopreset getMonopreset() const { return Monopreset(myMonopreset); }
848  void setMonopreset(Monopreset val) { myMonopreset = int64(val); }
850  {
851  SOP_Node *thissop = cookparms.getNode();
852  if (!thissop) return getMonopreset();
853  int64 result;
854  OP_Utils::evalOpParm(result, thissop, "monopreset", cookparms.getCookTime(), 0);
855  return Monopreset(result);
856  }
857  UT_SharedPtr<UT_Ramp> getMonoRamp() const { return myMonoRamp; }
858  void setMonoRamp(UT_SharedPtr<UT_Ramp> val) { myMonoRamp = val; }
860  {
861  SOP_Node *thissop = cookparms.getNode();
862  if (!thissop) return getMonoRamp();
864  OP_Utils::evalOpParm(result, thissop, "monoramp", cookparms.getCookTime(), 0);
865  return result;
866  }
867  bool getVectorEnable() const { return myVectorEnable; }
868  void setVectorEnable(bool val) { myVectorEnable = val; }
869  bool opVectorEnable(const SOP_NodeVerb::CookParms &cookparms) const
870  {
871  SOP_Node *thissop = cookparms.getNode();
872  if (!thissop) return getVectorEnable();
873  bool result;
874  OP_Utils::evalOpParm(result, thissop, "vectorenable", cookparms.getCookTime(), 0);
875  return result;
876  }
877  VectorRampMode getVectorRampMode() const { return VectorRampMode(myVectorRampMode); }
878  void setVectorRampMode(VectorRampMode val) { myVectorRampMode = int64(val); }
880  {
881  SOP_Node *thissop = cookparms.getNode();
882  if (!thissop) return getVectorRampMode();
883  int64 result;
884  OP_Utils::evalOpParm(result, thissop, "vectorrampmode", cookparms.getCookTime(), 0);
885  return VectorRampMode(result);
886  }
887  Vectorpreset getVectorpreset() const { return Vectorpreset(myVectorpreset); }
888  void setVectorpreset(Vectorpreset val) { myVectorpreset = int64(val); }
890  {
891  SOP_Node *thissop = cookparms.getNode();
892  if (!thissop) return getVectorpreset();
893  int64 result;
894  OP_Utils::evalOpParm(result, thissop, "vectorpreset", cookparms.getCookTime(), 0);
895  return Vectorpreset(result);
896  }
897  UT_SharedPtr<UT_Ramp> getVectorRamp() const { return myVectorRamp; }
898  void setVectorRamp(UT_SharedPtr<UT_Ramp> val) { myVectorRamp = val; }
900  {
901  SOP_Node *thissop = cookparms.getNode();
902  if (!thissop) return getVectorRamp();
904  OP_Utils::evalOpParm(result, thissop, "vectorramp", cookparms.getCookTime(), 0);
905  return result;
906  }
907  UT_Vector2D getRangeOut() const { return myRangeOut; }
908  void setRangeOut(UT_Vector2D val) { myRangeOut = val; }
910  {
911  SOP_Node *thissop = cookparms.getNode();
912  if (!thissop) return getRangeOut();
914  OP_Utils::evalOpParm(result, thissop, "rangeout", cookparms.getCookTime(), 0);
915  return result;
916  }
917 
918 private:
919  UT_StringHolder myGroup;
920  UT_StringHolder myField;
921  UT_StringHolder myName;
922  bool myCreateVarMap;
923  UT_StringHolder myVarName;
924  int64 myType;
925  int64 mySize;
926  UT_Vector4D myDefault;
927  UT_Vector2D myRangeIn;
928  bool myMonoEnable;
929  int64 myMonoRampMode;
930  int64 myMonopreset;
931  UT_SharedPtr<UT_Ramp> myMonoRamp;
932  bool myVectorEnable;
933  int64 myVectorRampMode;
934  int64 myVectorpreset;
935  UT_SharedPtr<UT_Ramp> myVectorRamp;
936  UT_Vector2D myRangeOut;
937 
938 };
UT_SharedPtr< UT_Ramp > opVectorRamp(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setVectorRamp(UT_SharedPtr< UT_Ramp > val)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
void save(std::ostream &os) const
void setMonoRamp(UT_SharedPtr< UT_Ramp > val)
exint getNestNumParms(TempIndex idx) const override
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void loadFromOpSubclass(const LoadParms &loadparms) override
static void saveData(std::ostream &os, PRM_DataItemHandle s)
UT_SharedPtr< UT_Ramp > opMonoRamp(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector2D opRangeOut(const SOP_NodeVerb::CookParms &cookparms) const
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
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
UT_Vector2T< fpreal64 > UT_Vector2D
static void saveData(std::ostream &os, UT_Matrix4D v)
UT_StringHolder opVarName(const SOP_NodeVerb::CookParms &cookparms) const
MonoRampMode opMonoRampMode(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
static void loadData(UT_IStream &is, int64 &v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
void setMonoRampMode(MonoRampMode val)
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
UT_SharedPtr< UT_Ramp > getMonoRamp() const
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
**But if you need a result
Definition: thread.h:613
UT_Vector4D opDefault(const SOP_NodeVerb::CookParms &cookparms) const
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Vector4D &v)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const 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_Matrix2D &value) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void setName(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_Vector2D v)
Vectorpreset opVectorpreset(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_StringHolder &v)
UT_Vector2D opRangeIn(const SOP_NodeVerb::CookParms &cookparms) const
bool opCreateVarMap(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
exint length() const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
void copyFrom(const OP_NodeParms *src) override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
static void loadData(UT_IStream &is, fpreal64 &v)
const UT_StringHolder & getName() const
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
void setVectorRampMode(VectorRampMode val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
static void loadData(UT_IStream &is, UT_Matrix2D &v)
const UT_StringHolder & getGroup() const
long long int64
Definition: SYS_Types.h:116
UT_StringHolder opField(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
int64 opSize(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setVarName(const UT_StringHolder &val)
void setGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Matrix2D v)
static void saveData(std::ostream &os, UT_Vector3D v)
bool isParmColorRamp(exint idx) const override
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, int64 v)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
static void saveData(std::ostream &os, UT_Matrix3D v)
GT_API const UT_StringHolder version
ParmType getNestParmType(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
bool operator==(const SOP_AttribFromVolumeParms &src) const
SYS_FORCE_INLINE UT_StringHolder getToken(Type enum_value)
bool opVectorEnable(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
void setField(const UT_StringHolder &val)
UT_StringHolder opName(const SOP_NodeVerb::CookParms &cookparms) const
void setVectorpreset(Vectorpreset val)
static void saveData(std::ostream &os, bool v)
VectorRampMode getVectorRampMode() const
fpreal64 fpreal
Definition: SYS_Types.h:277
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
bool operator!=(const SOP_AttribFromVolumeParms &src) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
const char * getNestParmName(TempIndex fieldnum) const override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void saveData(std::ostream &os, fpreal64 v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void loadData(UT_IStream &is, UT_Matrix3D &v)
bool opMonoEnable(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector4D v)
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
const UT_StringHolder & getVarName() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void loadData(UT_IStream &is, UT_Vector2D &v)
const UT_GeometryPredicates< REAL, false, true > & getDefault()
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_Vector3I &v)
UT_Vector4T< fpreal64 > UT_Vector4D
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
const UT_StringHolder & getField() const
VectorRampMode opVectorRampMode(const SOP_NodeVerb::CookParms &cookparms) const
type
Definition: core.h:1059
UT_SharedPtr< UT_Ramp > getVectorRamp() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
Monopreset opMonopreset(const SOP_NodeVerb::CookParms &cookparms) const
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
static void saveData(std::ostream &os, UT_StringHolder s)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1793
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663