HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_AttribSwap.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_AttribSwapEnums
24 {
25  enum class Method
26  {
27  SWAP = 0,
28  COPY,
29  MOVE
30  };
31 
33  getToken(Method enum_value)
34  {
35  using namespace UT::Literal;
36  switch (enum_value) {
37  case Method::SWAP: return "swap"_sh;
38  case Method::COPY: return "copy"_sh;
39  case Method::MOVE: return "move"_sh;
40  default: UT_ASSERT(false); return ""_sh;
41  }
42  }
43 
44  enum class Class
45  {
46  DETAIL = 0,
47  PRIMITIVE,
48  POINT,
49  VERTEX
50  };
51 
53  getToken(Class enum_value)
54  {
55  using namespace UT::Literal;
56  switch (enum_value) {
57  case Class::DETAIL: return "detail"_sh;
58  case Class::PRIMITIVE: return "primitive"_sh;
59  case Class::POINT: return "point"_sh;
60  case Class::VERTEX: return "vertex"_sh;
61  default: UT_ASSERT(false); return ""_sh;
62  }
63  }
64 
65  enum class Typeinfo
66  {
67  SOURCE = 0,
68  DEST
69  };
70 
72  getToken(Typeinfo enum_value)
73  {
74  using namespace UT::Literal;
75  switch (enum_value) {
76  case Typeinfo::SOURCE: return "source"_sh;
77  case Typeinfo::DEST: return "dest"_sh;
78  default: UT_ASSERT(false); return ""_sh;
79  }
80  }
81 
82 }
83 
84 
86 {
87 public:
88  static int version() { return 1; }
89  struct Numswaps
90  {
91  bool enable;
97 
98 
100  {
101  enable = true;
102  method = 0;
103  _class = 2;
104  srcattribs = ""_UTsh;
105  dstattribs = ""_UTsh;
106  typeinfo = 1;
107 
108  }
109 
110  bool operator==(const Numswaps &src) const
111  {
112  if (enable != src.enable) return false;
113  if (method != src.method) return false;
114  if (_class != src._class) return false;
115  if (srcattribs != src.srcattribs) return false;
116  if (dstattribs != src.dstattribs) return false;
117  if (typeinfo != src.typeinfo) return false;
118 
119  return true;
120  }
121  bool operator!=(const Numswaps &src) const
122  {
123  return !operator==(src);
124  }
125 
126  };
127 
129  {
131 
132  buf.strcat("[ ");
133  for (int i = 0; i < list.entries(); i++)
134  {
135  if (i)
136  buf.strcat(", ");
137  buf.strcat("( ");
138  buf.append("");
139  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
140  buf.append(", ");
141  buf.appendSprintf("%d", (int) list(i).method);
142  buf.append(", ");
143  buf.appendSprintf("%d", (int) list(i)._class);
144  buf.append(", ");
145  { UT_String tmp; tmp = UT_StringWrap(list(i).srcattribs).makeQuotedString('"'); buf.strcat(tmp); }
146  buf.append(", ");
147  { UT_String tmp; tmp = UT_StringWrap(list(i).dstattribs).makeQuotedString('"'); buf.strcat(tmp); }
148  buf.append(", ");
149  buf.appendSprintf("%d", (int) list(i).typeinfo);
150 
151  buf.strcat(" )");
152  }
153  buf.strcat(" ]");
154 
156  return result;
157  }
158 
160  {
161  myNumswaps.setSize(1);
162 
163  }
164 
165  explicit SOP_AttribSwapParms(const SOP_AttribSwapParms &) = default;
167  SOP_AttribSwapParms(SOP_AttribSwapParms &&) noexcept = default;
168  SOP_AttribSwapParms &operator=(SOP_AttribSwapParms &&) noexcept = default;
169 
170  ~SOP_AttribSwapParms() override {}
171 
172  bool operator==(const SOP_AttribSwapParms &src) const
173  {
174  if (myNumswaps != src.myNumswaps) return false;
175 
176  return true;
177  }
178  bool operator!=(const SOP_AttribSwapParms &src) const
179  {
180  return !operator==(src);
181  }
185 
186 
187 
188  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
189  {
190  if (true)
191  {
192  int64 length = 0;
193  graph->evalOpParm(length, nodeidx, "numswaps", time, 0);
194  if (length < 0) length = 0;
195  myNumswaps.setSize(length);
196  for (exint i = 0; i < length; i++)
197  {
198  int parmidx[1];
199  int offsets[1];
200  parmidx[0] = i+1;
201  offsets[0] = 1;
202  auto && _curentry = myNumswaps(i);
203  (void) _curentry;
204  _curentry.enable = true;
205  if (true)
206  graph->evalOpParmInst(_curentry.enable, nodeidx, "enable#", parmidx, offsets, time, 0, 2-1);
207  _curentry.method = 0;
208  if (true)
209  graph->evalOpParmInst(_curentry.method, nodeidx, "method#", parmidx, offsets, time, 0, 2-1);
210  _curentry._class = 2;
211  if (true)
212  graph->evalOpParmInst(_curentry._class, nodeidx, "class#", parmidx, offsets, time, 0, 2-1);
213  _curentry.srcattribs = ""_UTsh;
214  if (true)
215  graph->evalOpParmInst(_curentry.srcattribs, nodeidx, "srcattribs#", parmidx, offsets, time, 0, 2-1);
216  _curentry.dstattribs = ""_UTsh;
217  if (true)
218  graph->evalOpParmInst(_curentry.dstattribs, nodeidx, "dstattribs#", parmidx, offsets, time, 0, 2-1);
219  _curentry.typeinfo = 1;
220  if (true)
221  graph->evalOpParmInst(_curentry.typeinfo, nodeidx, "typeinfo#", parmidx, offsets, time, 0, 2-1);
222 
223  }
224  }
225  else
226  myNumswaps.clear();
227 
228  }
229 
230 
231  void loadFromOpSubclass(const LoadParms &loadparms) override
232  {
233  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
234  }
235 
236 
237  void copyFrom(const OP_NodeParms *src) override
238  {
239  *this = *((const SOP_AttribSwapParms *)src);
240  }
241 
242  template <typename T>
243  void
244  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
245  {
246  if (idx.size() < 1)
247  return;
248  UT_ASSERT(idx.size() == instance.size()+1);
249  if (idx.size() != instance.size()+1)
250  return;
251  switch (idx[0])
252  {
253  case 0:
254  if (idx.size() == 1)
255  coerceValue(value, myNumswaps.entries());
256  else if (instance[0] < myNumswaps.entries())
257  {
258  auto && _data = myNumswaps(instance[0]);
259  switch (idx[1])
260  {
261  case 0:
262  coerceValue(value, _data.enable);
263  break;
264  case 1:
265  coerceValue(value, _data.method);
266  break;
267  case 2:
268  coerceValue(value, _data._class);
269  break;
270  case 3:
271  coerceValue(value, _data.srcattribs);
272  break;
273  case 4:
274  coerceValue(value, _data.dstattribs);
275  break;
276  case 5:
277  coerceValue(value, _data.typeinfo);
278  break;
279 
280  }
281  }
282  break;
283 
284  }
285  }
286 
287  bool isParmColorRamp(exint idx) const override
288  {
289  switch (idx)
290  {
291 
292  }
293  return false;
294  }
295 
296  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
297  { doGetParmValue(idx, instance, value); }
298  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
299  { doGetParmValue(idx, instance, value); }
300  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
301  { doGetParmValue(idx, instance, value); }
302  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
303  { doGetParmValue(idx, instance, value); }
304  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
305  { doGetParmValue(idx, instance, value); }
306  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
307  { doGetParmValue(idx, instance, value); }
308  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
309  { doGetParmValue(idx, instance, value); }
310  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
311  { doGetParmValue(idx, instance, value); }
312  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
313  { doGetParmValue(idx, instance, value); }
314  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
315  { doGetParmValue(idx, instance, value); }
316  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
317  { doGetParmValue(idx, instance, value); }
318 
319  template <typename T>
320  void
321  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
322  {
323  if (idx.size() < 1)
324  return;
325  UT_ASSERT(idx.size() == instance.size()+1);
326  if (idx.size() != instance.size()+1)
327  return;
328  switch (idx[0])
329  {
330  case 0:
331  if (idx.size() == 1)
332  {
333  exint newsize;
334  coerceValue(newsize, value);
335  if (newsize < 0) newsize = 0;
336  myNumswaps.setSize(newsize);
337  }
338  else
339  {
340  if (instance[0] < 0)
341  return;
342  myNumswaps.setSizeIfNeeded(instance[0]+1);
343  auto && _data = myNumswaps(instance[0]);
344  switch (idx[1])
345  {
346  case 0:
347  coerceValue(_data.enable, value);
348  break;
349  case 1:
350  coerceValue(_data.method, value);
351  break;
352  case 2:
353  coerceValue(_data._class, value);
354  break;
355  case 3:
356  coerceValue(_data.srcattribs, value);
357  break;
358  case 4:
359  coerceValue(_data.dstattribs, value);
360  break;
361  case 5:
362  coerceValue(_data.typeinfo, value);
363  break;
364 
365  }
366  }
367  break;
368 
369  }
370  }
371 
372  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
373  { doSetParmValue(idx, instance, value); }
374  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
375  { doSetParmValue(idx, instance, value); }
376  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
377  { doSetParmValue(idx, instance, value); }
378  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
379  { doSetParmValue(idx, instance, value); }
380  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
381  { doSetParmValue(idx, instance, value); }
382  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
383  { doSetParmValue(idx, instance, value); }
384  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
385  { doSetParmValue(idx, instance, value); }
386  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
387  { doSetParmValue(idx, instance, value); }
388  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
389  { doSetParmValue(idx, instance, value); }
390  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
391  { doSetParmValue(idx, instance, value); }
392  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
393  { doSetParmValue(idx, instance, value); }
394 
395  exint getNestNumParms(TempIndex idx) const override
396  {
397  if (idx.size() == 0)
398  return 1;
399  switch (idx[0])
400  {
401  case 0:
402  return 6;
403 
404  }
405  // Invalid
406  return 0;
407  }
408 
409  const char *getNestParmName(TempIndex fieldnum) const override
410  {
411  if (fieldnum.size() < 1)
412  return 0;
413  switch (fieldnum[0])
414  {
415  case 0:
416  if (fieldnum.size() == 1)
417  return "numswaps";
418  switch (fieldnum[1])
419  {
420  case 0:
421  return "enable#";
422  case 1:
423  return "method#";
424  case 2:
425  return "class#";
426  case 3:
427  return "srcattribs#";
428  case 4:
429  return "dstattribs#";
430  case 5:
431  return "typeinfo#";
432 
433  }
434  return 0;
435 
436  }
437  return 0;
438  }
439 
440  ParmType getNestParmType(TempIndex fieldnum) const override
441  {
442  if (fieldnum.size() < 1)
443  return PARM_UNSUPPORTED;
444  switch (fieldnum[0])
445  {
446  case 0:
447  if (fieldnum.size() == 1)
448  return PARM_MULTIPARM;
449  switch (fieldnum[1])
450  {
451  case 0:
452  return PARM_INTEGER;
453  case 1:
454  return PARM_INTEGER;
455  case 2:
456  return PARM_INTEGER;
457  case 3:
458  return PARM_STRING;
459  case 4:
460  return PARM_STRING;
461  case 5:
462  return PARM_INTEGER;
463 
464  }
465  return PARM_UNSUPPORTED;
466 
467  }
468  return PARM_UNSUPPORTED;
469  }
470 
471  // Boiler plate to load individual types.
472  static void loadData(UT_IStream &is, int64 &v)
473  { is.bread(&v, 1); }
474  static void loadData(UT_IStream &is, bool &v)
475  { int64 iv; is.bread(&iv, 1); v = iv; }
476  static void loadData(UT_IStream &is, fpreal64 &v)
477  { is.bread<fpreal64>(&v, 1); }
478  static void loadData(UT_IStream &is, UT_Vector2D &v)
479  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
480  static void loadData(UT_IStream &is, UT_Vector3D &v)
481  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
482  is.bread<fpreal64>(&v.z(), 1); }
483  static void loadData(UT_IStream &is, UT_Vector4D &v)
484  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
485  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
486  static void loadData(UT_IStream &is, UT_Matrix2D &v)
487  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
488  static void loadData(UT_IStream &is, UT_Matrix3D &v)
489  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
490  static void loadData(UT_IStream &is, UT_Matrix4D &v)
491  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
492  static void loadData(UT_IStream &is, UT_Vector2I &v)
493  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
494  static void loadData(UT_IStream &is, UT_Vector3I &v)
495  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
496  is.bread<int64>(&v.z(), 1); }
497  static void loadData(UT_IStream &is, UT_Vector4I &v)
498  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
499  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
501  { is.bread(v); }
503  { UT_StringHolder rampdata;
504  loadData(is, rampdata);
505  if (rampdata.isstring())
506  {
507  v.reset(new UT_Ramp());
508  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
509  v->load(istr);
510  }
511  else v.reset();
512  }
515  loadData(is, data);
516  if (data.isstring())
517  {
518  // Find the data type.
519  const char *colon = UT_StringWrap(data).findChar(':');
520  if (colon)
521  {
522  int typelen = colon - data.buffer();
524  type.strncpy(data.buffer(), typelen);
525  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
526 
527  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
528  }
529  }
530  else v.reset();
531  }
532 
533  static void saveData(std::ostream &os, int64 v)
534  { UTwrite(os, &v); }
535  static void saveData(std::ostream &os, bool v)
536  { int64 iv = v; UTwrite(os, &iv); }
537  static void saveData(std::ostream &os, fpreal64 v)
538  { UTwrite<fpreal64>(os, &v); }
539  static void saveData(std::ostream &os, UT_Vector2D v)
540  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
541  static void saveData(std::ostream &os, UT_Vector3D v)
542  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
543  UTwrite<fpreal64>(os, &v.z()); }
544  static void saveData(std::ostream &os, UT_Vector4D v)
545  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
546  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
547  static void saveData(std::ostream &os, UT_Matrix2D v)
549  static void saveData(std::ostream &os, UT_Matrix3D v)
551  static void saveData(std::ostream &os, UT_Matrix4D v)
553  static void saveData(std::ostream &os, UT_StringHolder s)
554  { UT_StringWrap(s).saveBinary(os); }
555  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
557  UT_OStringStream ostr;
558  if (s) s->save(ostr);
559  result = ostr.str();
560  saveData(os, result);
561  }
562  static void saveData(std::ostream &os, PRM_DataItemHandle s)
564  UT_OStringStream ostr;
565  if (s)
566  {
567  ostr << s->getDataTypeToken();
568  ostr << ":";
569  s->saveBinary(ostr);
570  }
571  result = ostr.str();
572  saveData(os, result);
573  }
574 
575 
576  void save(std::ostream &os) const
577  {
578  int32 v = version();
579  UTwrite(os, &v);
580  {
581  int64 length = myNumswaps.entries();
582  UTwrite(os, &length);
583  for (exint i = 0; i < length; i++)
584  {
585  auto && _curentry = myNumswaps(i);
586  (void) _curentry;
587  saveData(os, _curentry.enable);
588  saveData(os, _curentry.method);
589  saveData(os, _curentry._class);
590  saveData(os, _curentry.srcattribs);
591  saveData(os, _curentry.dstattribs);
592  saveData(os, _curentry.typeinfo);
593 
594  }
595  }
596 
597  }
598 
599  bool load(UT_IStream &is)
600  {
601  int32 v;
602  is.bread(&v, 1);
603  if (version() != v)
604  {
605  // Fail incompatible versions
606  return false;
607  }
608  {
609  int64 length;
610  is.read(&length, 1);
611  myNumswaps.setSize(length);
612  for (exint i = 0; i < length; i++)
613  {
614  auto && _curentry = myNumswaps(i);
615  (void) _curentry;
616  loadData(is, _curentry.enable);
617  loadData(is, _curentry.method);
618  loadData(is, _curentry._class);
619  loadData(is, _curentry.srcattribs);
620  loadData(is, _curentry.dstattribs);
621  loadData(is, _curentry.typeinfo);
622 
623  }
624  }
625 
626  return true;
627  }
628 
629  const UT_Array<Numswaps> &getNumswaps() const { return myNumswaps; }
630 void setNumswaps(const UT_Array<Numswaps> &val) { myNumswaps = val; }
631  exint opNumswaps(const SOP_NodeVerb::CookParms &cookparms) const
632  {
633  SOP_Node *thissop = cookparms.getNode();
634  if (!thissop) return getNumswaps().entries();
635  exint result;
636  OP_Utils::evalOpParm(result, thissop, "numswaps", cookparms.getCookTime(), 0);
637  return result;
638  }
639  bool opNumswaps_enable(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
640  { return opinstNumswaps_enable(cookparms, &_idx); }
641  bool opinstNumswaps_enable(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
642  {
643  SOP_Node *thissop = cookparms.getNode();
644  if (!thissop) return (myNumswaps(_idx[0]).enable);
645  int _parmidx[2-1];
646  _parmidx[1-1] = _idx[1-1] + 1;
647 
648  bool result;
649  OP_Utils::evalOpParmInst(result, thissop, "enable#", _parmidx, cookparms.getCookTime(), 0, 2-1);
650  return (result);
651  }
652  int64 opNumswaps_method(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
653  { return opinstNumswaps_method(cookparms, &_idx); }
654  int64 opinstNumswaps_method(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
655  {
656  SOP_Node *thissop = cookparms.getNode();
657  if (!thissop) return (myNumswaps(_idx[0]).method);
658  int _parmidx[2-1];
659  _parmidx[1-1] = _idx[1-1] + 1;
660 
661  int64 result;
662  OP_Utils::evalOpParmInst(result, thissop, "method#", _parmidx, cookparms.getCookTime(), 0, 2-1);
663  return (result);
664  }
665  int64 opNumswaps__class(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
666  { return opinstNumswaps__class(cookparms, &_idx); }
667  int64 opinstNumswaps__class(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
668  {
669  SOP_Node *thissop = cookparms.getNode();
670  if (!thissop) return (myNumswaps(_idx[0])._class);
671  int _parmidx[2-1];
672  _parmidx[1-1] = _idx[1-1] + 1;
673 
674  int64 result;
675  OP_Utils::evalOpParmInst(result, thissop, "class#", _parmidx, cookparms.getCookTime(), 0, 2-1);
676  return (result);
677  }
679  { return opinstNumswaps_srcattribs(cookparms, &_idx); }
680  UT_StringHolder opinstNumswaps_srcattribs(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
681  {
682  SOP_Node *thissop = cookparms.getNode();
683  if (!thissop) return (myNumswaps(_idx[0]).srcattribs);
684  int _parmidx[2-1];
685  _parmidx[1-1] = _idx[1-1] + 1;
686 
688  OP_Utils::evalOpParmInst(result, thissop, "srcattribs#", _parmidx, cookparms.getCookTime(), 0, 2-1);
689  return (result);
690  }
692  { return opinstNumswaps_dstattribs(cookparms, &_idx); }
693  UT_StringHolder opinstNumswaps_dstattribs(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
694  {
695  SOP_Node *thissop = cookparms.getNode();
696  if (!thissop) return (myNumswaps(_idx[0]).dstattribs);
697  int _parmidx[2-1];
698  _parmidx[1-1] = _idx[1-1] + 1;
699 
701  OP_Utils::evalOpParmInst(result, thissop, "dstattribs#", _parmidx, cookparms.getCookTime(), 0, 2-1);
702  return (result);
703  }
704  int64 opNumswaps_typeinfo(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
705  { return opinstNumswaps_typeinfo(cookparms, &_idx); }
706  int64 opinstNumswaps_typeinfo(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
707  {
708  SOP_Node *thissop = cookparms.getNode();
709  if (!thissop) return (myNumswaps(_idx[0]).typeinfo);
710  int _parmidx[2-1];
711  _parmidx[1-1] = _idx[1-1] + 1;
712 
713  int64 result;
714  OP_Utils::evalOpParmInst(result, thissop, "typeinfo#", _parmidx, cookparms.getCookTime(), 0, 2-1);
715  return (result);
716  }
717 
718 
719 private:
720  UT_Array<Numswaps> myNumswaps;
721 
722 };
bool opNumswaps_enable(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
bool load(UT_IStream &is)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
static void saveData(std::ostream &os, bool v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &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, int64 v)
void
Definition: png.h:1083
static void loadData(UT_IStream &is, UT_StringHolder &v)
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
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void saveData(std::ostream &os, UT_Matrix2D v)
fpreal getTime() const
Definition: OP_Context.h:62
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
UT_StringHolder createString(const UT_Array< Numswaps > &list) const
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
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
static void saveData(std::ostream &os, UT_Matrix4D v)
GLdouble s
Definition: glad.h:3009
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_Matrix3D &v)
**But if you need a result
Definition: thread.h:613
int64 opinstNumswaps_method(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool operator==(const Numswaps &src) const
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 loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setNumswaps(const UT_Array< Numswaps > &val)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const UT_Array< Numswaps > & getNumswaps() const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
bool operator!=(const Numswaps &src) const
UT_StringHolder opinstNumswaps_srcattribs(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
exint length() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, UT_Vector4D &v)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
const char * getNestParmName(TempIndex fieldnum) const override
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void save(std::ostream &os) const
bool operator==(const SOP_AttribSwapParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) 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 setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
int64 opinstNumswaps_typeinfo(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, fpreal64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
exint getNestNumParms(TempIndex idx) const override
SYS_FORCE_INLINE void strcat(const char *src)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
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)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
ParmType getNestParmType(TempIndex fieldnum) const override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
bool operator!=(const SOP_AttribSwapParms &src) const
static void saveData(std::ostream &os, UT_Vector4D v)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
bool isParmColorRamp(exint idx) const override
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
static void saveData(std::ostream &os, UT_StringHolder s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
int64 opNumswaps__class(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void loadFromOpSubclass(const LoadParms &loadparms) override
GLuint GLfloat * val
Definition: glcorearb.h:1608
static void loadData(UT_IStream &is, UT_Vector2I &v)
#define SOP_API
Definition: SOP_API.h:10
int64 opNumswaps_method(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void saveData(std::ostream &os, UT_Vector2D 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
static void saveData(std::ostream &os, UT_Vector3D v)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
GLboolean r
Definition: glcorearb.h:1222
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
int64 opinstNumswaps__class(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool opinstNumswaps_enable(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_StringHolder opNumswaps_srcattribs(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
UT_StringHolder opinstNumswaps_dstattribs(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
type
Definition: core.h:1059
SYS_FORCE_INLINE UT_StringHolder getToken(Method enum_value)
int64 opNumswaps_typeinfo(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void copyFrom(const OP_NodeParms *src) override
static void loadData(UT_IStream &is, fpreal64 &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
static void loadData(UT_IStream &is, bool &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
exint opNumswaps(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opNumswaps_dstattribs(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663