HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_TextureOpticalFlow.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_TextureOpticalFlowEnums
24 {
25  enum class Method
26  {
27  FARNEBACK = 0,
28  DIS
29  };
30 
32  getToken(Method enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Method::FARNEBACK: return "farneback"_sh;
37  case Method::DIS: return "dis"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42 }
43 
44 
46 {
47 public:
48  static int version() { return 1; }
49 
51  {
52  mySourceGroup = ""_UTsh;
53  myGoalGroup = ""_UTsh;
54  myOutputName = "flow"_UTsh;
55  myMethod = 0;
56  myBlurringWindowRadius = 7;
57  myUseGaussianFilter = false;
58  myPyramidLevels = 3;
59  myPyramidScale = 0.5;
60  myIterations = 3;
61  myApproximationWindowRadius = 2;
62  mySmoothnessDegree = 3;
63  myPatchSize = 8;
64  myPatchStride = 3;
65  myFinestScale = 1;
66  myGradientDescentIterations = 25;
67  mySmoothnessWeight = 20;
68  myColorConstancyWeight = 5;
69  myGradientConstancyWeight = 10;
70  myVariationalRefinementIterations = 5;
71  myUseMeanNormalization = true;
72  myUseSpatialPropagation = true;
73 
74  }
75 
76  explicit SOP_TextureOpticalFlowParms(const SOP_TextureOpticalFlowParms &) = default;
79  SOP_TextureOpticalFlowParms &operator=(SOP_TextureOpticalFlowParms &&) noexcept = default;
80 
82 
84  {
85  if (mySourceGroup != src.mySourceGroup) return false;
86  if (myGoalGroup != src.myGoalGroup) return false;
87  if (myOutputName != src.myOutputName) return false;
88  if (myMethod != src.myMethod) return false;
89  if (myBlurringWindowRadius != src.myBlurringWindowRadius) return false;
90  if (myUseGaussianFilter != src.myUseGaussianFilter) return false;
91  if (myPyramidLevels != src.myPyramidLevels) return false;
92  if (myPyramidScale != src.myPyramidScale) return false;
93  if (myIterations != src.myIterations) return false;
94  if (myApproximationWindowRadius != src.myApproximationWindowRadius) return false;
95  if (mySmoothnessDegree != src.mySmoothnessDegree) return false;
96  if (myPatchSize != src.myPatchSize) return false;
97  if (myPatchStride != src.myPatchStride) return false;
98  if (myFinestScale != src.myFinestScale) return false;
99  if (myGradientDescentIterations != src.myGradientDescentIterations) return false;
100  if (mySmoothnessWeight != src.mySmoothnessWeight) return false;
101  if (myColorConstancyWeight != src.myColorConstancyWeight) return false;
102  if (myGradientConstancyWeight != src.myGradientConstancyWeight) return false;
103  if (myVariationalRefinementIterations != src.myVariationalRefinementIterations) return false;
104  if (myUseMeanNormalization != src.myUseMeanNormalization) return false;
105  if (myUseSpatialPropagation != src.myUseSpatialPropagation) return false;
106 
107 
108  if (baseGetSignature() != src.baseGetSignature()) return false;
109 
110  return true;
111  }
113  {
114  return !operator==(src);
115  }
117 
118 
119 
120  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
121  {
122  mySourceGroup = ""_UTsh;
123  if (true)
124  graph->evalOpParm(mySourceGroup, nodeidx, "sourcegroup", time, graph->isDirect()?nullptr:depnode);
125  myGoalGroup = ""_UTsh;
126  if (true)
127  graph->evalOpParm(myGoalGroup, nodeidx, "goalgroup", time, graph->isDirect()?nullptr:depnode);
128  myOutputName = "flow"_UTsh;
129  if (true)
130  graph->evalOpParm(myOutputName, nodeidx, "outputname", time, graph->isDirect()?nullptr:depnode);
131  myMethod = 0;
132  if (true)
133  graph->evalOpParm(myMethod, nodeidx, "method", time, graph->isDirect()?nullptr:depnode);
134  myBlurringWindowRadius = 7;
135  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
136  graph->evalOpParm(myBlurringWindowRadius, nodeidx, "blurringwindowradius", time, graph->isDirect()?nullptr:depnode);
137  myUseGaussianFilter = false;
138  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
139  graph->evalOpParm(myUseGaussianFilter, nodeidx, "usegaussianfilter", time, graph->isDirect()?nullptr:depnode);
140  myPyramidLevels = 3;
141  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
142  graph->evalOpParm(myPyramidLevels, nodeidx, "pyramidlevels", time, graph->isDirect()?nullptr:depnode);
143  myPyramidScale = 0.5;
144  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
145  graph->evalOpParm(myPyramidScale, nodeidx, "pyramidscale", time, graph->isDirect()?nullptr:depnode);
146  myIterations = 3;
147  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
148  graph->evalOpParm(myIterations, nodeidx, "iterations", time, graph->isDirect()?nullptr:depnode);
149  myApproximationWindowRadius = 2;
150  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
151  graph->evalOpParm(myApproximationWindowRadius, nodeidx, "approximationwindowradius", time, graph->isDirect()?nullptr:depnode);
152  mySmoothnessDegree = 3;
153  if (true && ( (true&&!(((int64(getMethod())!=0)))) ) )
154  graph->evalOpParm(mySmoothnessDegree, nodeidx, "smoothnessdegree", time, graph->isDirect()?nullptr:depnode);
155  myPatchSize = 8;
156  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
157  graph->evalOpParm(myPatchSize, nodeidx, "patchsize", time, graph->isDirect()?nullptr:depnode);
158  myPatchStride = 3;
159  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
160  graph->evalOpParm(myPatchStride, nodeidx, "patchstride", time, graph->isDirect()?nullptr:depnode);
161  myFinestScale = 1;
162  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
163  graph->evalOpParm(myFinestScale, nodeidx, "finestscale", time, graph->isDirect()?nullptr:depnode);
164  myGradientDescentIterations = 25;
165  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
166  graph->evalOpParm(myGradientDescentIterations, nodeidx, "gradientdescentiterations", time, graph->isDirect()?nullptr:depnode);
167  mySmoothnessWeight = 20;
168  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
169  graph->evalOpParm(mySmoothnessWeight, nodeidx, "smoothnessweight", time, graph->isDirect()?nullptr:depnode);
170  myColorConstancyWeight = 5;
171  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
172  graph->evalOpParm(myColorConstancyWeight, nodeidx, "colorconstancyweight", time, graph->isDirect()?nullptr:depnode);
173  myGradientConstancyWeight = 10;
174  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
175  graph->evalOpParm(myGradientConstancyWeight, nodeidx, "gradientconstancyweight", time, graph->isDirect()?nullptr:depnode);
176  myVariationalRefinementIterations = 5;
177  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
178  graph->evalOpParm(myVariationalRefinementIterations, nodeidx, "variationalrefinementiterations", time, graph->isDirect()?nullptr:depnode);
179  myUseMeanNormalization = true;
180  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
181  graph->evalOpParm(myUseMeanNormalization, nodeidx, "usemeannormalization", time, graph->isDirect()?nullptr:depnode);
182  myUseSpatialPropagation = true;
183  if (true && ( (true&&!(((int64(getMethod())!=1)))) ) )
184  graph->evalOpParm(myUseSpatialPropagation, nodeidx, "usespatialpropagation", time, graph->isDirect()?nullptr:depnode);
185 
186  }
187 
188 
189  void loadFromOpSubclass(const LoadParms &loadparms) override
190  {
191  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
192  }
193 
194 
195  void copyFrom(const OP_NodeParms *src) override
196  {
197  *this = *((const SOP_TextureOpticalFlowParms *)src);
198  }
199 
200  template <typename T>
201  void
202  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
203  {
204  if (idx.size() < 1)
205  return;
206  UT_ASSERT(idx.size() == instance.size()+1);
207  if (idx.size() != instance.size()+1)
208  return;
209  switch (idx[0])
210  {
211  case 0:
212  coerceValue(value, mySourceGroup);
213  break;
214  case 1:
215  coerceValue(value, myGoalGroup);
216  break;
217  case 2:
218  coerceValue(value, myOutputName);
219  break;
220  case 3:
221  coerceValue(value, myMethod);
222  break;
223  case 4:
224  coerceValue(value, myBlurringWindowRadius);
225  break;
226  case 5:
227  coerceValue(value, myUseGaussianFilter);
228  break;
229  case 6:
230  coerceValue(value, myPyramidLevels);
231  break;
232  case 7:
233  coerceValue(value, myPyramidScale);
234  break;
235  case 8:
236  coerceValue(value, myIterations);
237  break;
238  case 9:
239  coerceValue(value, myApproximationWindowRadius);
240  break;
241  case 10:
242  coerceValue(value, mySmoothnessDegree);
243  break;
244  case 11:
245  coerceValue(value, myPatchSize);
246  break;
247  case 12:
248  coerceValue(value, myPatchStride);
249  break;
250  case 13:
251  coerceValue(value, myFinestScale);
252  break;
253  case 14:
254  coerceValue(value, myGradientDescentIterations);
255  break;
256  case 15:
257  coerceValue(value, mySmoothnessWeight);
258  break;
259  case 16:
260  coerceValue(value, myColorConstancyWeight);
261  break;
262  case 17:
263  coerceValue(value, myGradientConstancyWeight);
264  break;
265  case 18:
266  coerceValue(value, myVariationalRefinementIterations);
267  break;
268  case 19:
269  coerceValue(value, myUseMeanNormalization);
270  break;
271  case 20:
272  coerceValue(value, myUseSpatialPropagation);
273  break;
274 
275  }
276  }
277 
278  bool isParmColorRamp(exint idx) const override
279  {
280  switch (idx)
281  {
282 
283  }
284  return false;
285  }
286 
287  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
288  { doGetParmValue(idx, instance, value); }
289  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
290  { doGetParmValue(idx, instance, value); }
291  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
292  { doGetParmValue(idx, instance, value); }
293  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
294  { doGetParmValue(idx, instance, value); }
295  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
296  { doGetParmValue(idx, instance, value); }
297  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
298  { doGetParmValue(idx, instance, value); }
299  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
300  { doGetParmValue(idx, instance, value); }
301  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
302  { doGetParmValue(idx, instance, value); }
303  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
304  { doGetParmValue(idx, instance, value); }
305  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
306  { doGetParmValue(idx, instance, value); }
307  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
308  { doGetParmValue(idx, instance, value); }
309 
310  template <typename T>
311  void
312  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
313  {
314  if (idx.size() < 1)
315  return;
316  UT_ASSERT(idx.size() == instance.size()+1);
317  if (idx.size() != instance.size()+1)
318  return;
319  switch (idx[0])
320  {
321  case 0:
322  coerceValue(mySourceGroup, ( ( value ) ));
323  break;
324  case 1:
325  coerceValue(myGoalGroup, ( ( value ) ));
326  break;
327  case 2:
328  coerceValue(myOutputName, ( ( value ) ));
329  break;
330  case 3:
331  coerceValue(myMethod, clampMinValue(0, clampMaxValue(1, value ) ));
332  break;
333  case 4:
334  coerceValue(myBlurringWindowRadius, clampMinValue(0, ( value ) ));
335  break;
336  case 5:
337  coerceValue(myUseGaussianFilter, ( ( value ) ));
338  break;
339  case 6:
340  coerceValue(myPyramidLevels, clampMinValue(1, ( value ) ));
341  break;
342  case 7:
343  coerceValue(myPyramidScale, clampMinValue(0.1, clampMaxValue(0.9, value ) ));
344  break;
345  case 8:
346  coerceValue(myIterations, clampMinValue(1, ( value ) ));
347  break;
348  case 9:
349  coerceValue(myApproximationWindowRadius, clampMinValue(0.25, ( value ) ));
350  break;
351  case 10:
352  coerceValue(mySmoothnessDegree, clampMinValue(1, ( value ) ));
353  break;
354  case 11:
355  coerceValue(myPatchSize, clampMinValue(1, ( value ) ));
356  break;
357  case 12:
358  coerceValue(myPatchStride, clampMinValue(1, ( value ) ));
359  break;
360  case 13:
361  coerceValue(myFinestScale, clampMinValue(0, ( value ) ));
362  break;
363  case 14:
364  coerceValue(myGradientDescentIterations, clampMinValue(1, ( value ) ));
365  break;
366  case 15:
367  coerceValue(mySmoothnessWeight, clampMinValue(0, ( value ) ));
368  break;
369  case 16:
370  coerceValue(myColorConstancyWeight, clampMinValue(0, ( value ) ));
371  break;
372  case 17:
373  coerceValue(myGradientConstancyWeight, clampMinValue(0, ( value ) ));
374  break;
375  case 18:
376  coerceValue(myVariationalRefinementIterations, clampMinValue(0, ( value ) ));
377  break;
378  case 19:
379  coerceValue(myUseMeanNormalization, ( ( value ) ));
380  break;
381  case 20:
382  coerceValue(myUseSpatialPropagation, ( ( value ) ));
383  break;
384 
385  }
386  }
387 
388  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
389  { doSetParmValue(idx, instance, value); }
390  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
391  { doSetParmValue(idx, instance, value); }
392  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
393  { doSetParmValue(idx, instance, value); }
394  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
395  { doSetParmValue(idx, instance, value); }
396  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
397  { doSetParmValue(idx, instance, value); }
398  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
399  { doSetParmValue(idx, instance, value); }
400  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
401  { doSetParmValue(idx, instance, value); }
402  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
403  { doSetParmValue(idx, instance, value); }
404  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
405  { doSetParmValue(idx, instance, value); }
406  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
407  { doSetParmValue(idx, instance, value); }
408  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
409  { doSetParmValue(idx, instance, value); }
410 
411  exint getNestNumParms(TempIndex idx) const override
412  {
413  if (idx.size() == 0)
414  return 21;
415  switch (idx[0])
416  {
417 
418  }
419  // Invalid
420  return 0;
421  }
422 
423  const char *getNestParmName(TempIndex fieldnum) const override
424  {
425  if (fieldnum.size() < 1)
426  return 0;
427  switch (fieldnum[0])
428  {
429  case 0:
430  return "sourcegroup";
431  case 1:
432  return "goalgroup";
433  case 2:
434  return "outputname";
435  case 3:
436  return "method";
437  case 4:
438  return "blurringwindowradius";
439  case 5:
440  return "usegaussianfilter";
441  case 6:
442  return "pyramidlevels";
443  case 7:
444  return "pyramidscale";
445  case 8:
446  return "iterations";
447  case 9:
448  return "approximationwindowradius";
449  case 10:
450  return "smoothnessdegree";
451  case 11:
452  return "patchsize";
453  case 12:
454  return "patchstride";
455  case 13:
456  return "finestscale";
457  case 14:
458  return "gradientdescentiterations";
459  case 15:
460  return "smoothnessweight";
461  case 16:
462  return "colorconstancyweight";
463  case 17:
464  return "gradientconstancyweight";
465  case 18:
466  return "variationalrefinementiterations";
467  case 19:
468  return "usemeannormalization";
469  case 20:
470  return "usespatialpropagation";
471 
472  }
473  return 0;
474  }
475 
476  ParmType getNestParmType(TempIndex fieldnum) const override
477  {
478  if (fieldnum.size() < 1)
479  return PARM_UNSUPPORTED;
480  switch (fieldnum[0])
481  {
482  case 0:
483  return PARM_STRING;
484  case 1:
485  return PARM_STRING;
486  case 2:
487  return PARM_STRING;
488  case 3:
489  return PARM_INTEGER;
490  case 4:
491  return PARM_INTEGER;
492  case 5:
493  return PARM_INTEGER;
494  case 6:
495  return PARM_INTEGER;
496  case 7:
497  return PARM_FLOAT;
498  case 8:
499  return PARM_INTEGER;
500  case 9:
501  return PARM_FLOAT;
502  case 10:
503  return PARM_INTEGER;
504  case 11:
505  return PARM_INTEGER;
506  case 12:
507  return PARM_INTEGER;
508  case 13:
509  return PARM_INTEGER;
510  case 14:
511  return PARM_INTEGER;
512  case 15:
513  return PARM_FLOAT;
514  case 16:
515  return PARM_FLOAT;
516  case 17:
517  return PARM_FLOAT;
518  case 18:
519  return PARM_INTEGER;
520  case 19:
521  return PARM_INTEGER;
522  case 20:
523  return PARM_INTEGER;
524 
525  }
526  return PARM_UNSUPPORTED;
527  }
528 
529  // Boiler plate to load individual types.
530  static void loadData(UT_IStream &is, int64 &v)
531  { is.bread(&v, 1); }
532  static void loadData(UT_IStream &is, bool &v)
533  { int64 iv; is.bread(&iv, 1); v = iv; }
534  static void loadData(UT_IStream &is, fpreal64 &v)
535  { is.bread<fpreal64>(&v, 1); }
536  static void loadData(UT_IStream &is, UT_Vector2D &v)
537  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
538  static void loadData(UT_IStream &is, UT_Vector3D &v)
539  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
540  is.bread<fpreal64>(&v.z(), 1); }
541  static void loadData(UT_IStream &is, UT_Vector4D &v)
542  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
543  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
544  static void loadData(UT_IStream &is, UT_Matrix2D &v)
545  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
546  static void loadData(UT_IStream &is, UT_Matrix3D &v)
547  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
548  static void loadData(UT_IStream &is, UT_Matrix4D &v)
549  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
550  static void loadData(UT_IStream &is, UT_Vector2I &v)
551  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
552  static void loadData(UT_IStream &is, UT_Vector3I &v)
553  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
554  is.bread<int64>(&v.z(), 1); }
555  static void loadData(UT_IStream &is, UT_Vector4I &v)
556  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
557  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
559  { is.bread(v); }
561  { UT_StringHolder rampdata;
562  loadData(is, rampdata);
563  if (rampdata.isstring())
564  {
565  v.reset(new UT_Ramp());
566  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
567  v->load(istr);
568  }
569  else v.reset();
570  }
573  loadData(is, data);
574  if (data.isstring())
575  {
576  // Find the data type.
577  const char *colon = UT_StringWrap(data).findChar(':');
578  if (colon)
579  {
580  int typelen = colon - data.buffer();
582  type.strncpy(data.buffer(), typelen);
583  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
584 
585  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
586  }
587  }
588  else v.reset();
589  }
590 
591  static void saveData(std::ostream &os, int64 v)
592  { UTwrite(os, &v); }
593  static void saveData(std::ostream &os, bool v)
594  { int64 iv = v; UTwrite(os, &iv); }
595  static void saveData(std::ostream &os, fpreal64 v)
596  { UTwrite<fpreal64>(os, &v); }
597  static void saveData(std::ostream &os, UT_Vector2D v)
598  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
599  static void saveData(std::ostream &os, UT_Vector3D v)
600  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
601  UTwrite<fpreal64>(os, &v.z()); }
602  static void saveData(std::ostream &os, UT_Vector4D v)
603  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
604  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
605  static void saveData(std::ostream &os, UT_Matrix2D v)
607  static void saveData(std::ostream &os, UT_Matrix3D v)
609  static void saveData(std::ostream &os, UT_Matrix4D v)
611  static void saveData(std::ostream &os, UT_StringHolder s)
612  { UT_StringWrap(s).saveBinary(os); }
613  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
615  UT_OStringStream ostr;
616  if (s) s->save(ostr);
617  result = ostr.str();
618  saveData(os, result);
619  }
620  static void saveData(std::ostream &os, PRM_DataItemHandle s)
622  UT_OStringStream ostr;
623  if (s)
624  {
625  ostr << s->getDataTypeToken();
626  ostr << ":";
627  s->saveBinary(ostr);
628  }
629  result = ostr.str();
630  saveData(os, result);
631  }
632 
633 
634  void save(std::ostream &os) const
635  {
636  int32 v = version();
637  UTwrite(os, &v);
638  saveData(os, mySourceGroup);
639  saveData(os, myGoalGroup);
640  saveData(os, myOutputName);
641  saveData(os, myMethod);
642  saveData(os, myBlurringWindowRadius);
643  saveData(os, myUseGaussianFilter);
644  saveData(os, myPyramidLevels);
645  saveData(os, myPyramidScale);
646  saveData(os, myIterations);
647  saveData(os, myApproximationWindowRadius);
648  saveData(os, mySmoothnessDegree);
649  saveData(os, myPatchSize);
650  saveData(os, myPatchStride);
651  saveData(os, myFinestScale);
652  saveData(os, myGradientDescentIterations);
653  saveData(os, mySmoothnessWeight);
654  saveData(os, myColorConstancyWeight);
655  saveData(os, myGradientConstancyWeight);
656  saveData(os, myVariationalRefinementIterations);
657  saveData(os, myUseMeanNormalization);
658  saveData(os, myUseSpatialPropagation);
659 
660  }
661 
662  bool load(UT_IStream &is)
663  {
664  int32 v;
665  is.bread(&v, 1);
666  if (version() != v)
667  {
668  // Fail incompatible versions
669  return false;
670  }
671  loadData(is, mySourceGroup);
672  loadData(is, myGoalGroup);
673  loadData(is, myOutputName);
674  loadData(is, myMethod);
675  loadData(is, myBlurringWindowRadius);
676  loadData(is, myUseGaussianFilter);
677  loadData(is, myPyramidLevels);
678  loadData(is, myPyramidScale);
679  loadData(is, myIterations);
680  loadData(is, myApproximationWindowRadius);
681  loadData(is, mySmoothnessDegree);
682  loadData(is, myPatchSize);
683  loadData(is, myPatchStride);
684  loadData(is, myFinestScale);
685  loadData(is, myGradientDescentIterations);
686  loadData(is, mySmoothnessWeight);
687  loadData(is, myColorConstancyWeight);
688  loadData(is, myGradientConstancyWeight);
689  loadData(is, myVariationalRefinementIterations);
690  loadData(is, myUseMeanNormalization);
691  loadData(is, myUseSpatialPropagation);
692 
693  return true;
694  }
695 
696  const UT_StringHolder & getSourceGroup() const { return mySourceGroup; }
697  void setSourceGroup(const UT_StringHolder & val) { mySourceGroup = val; }
699  {
700  SOP_Node *thissop = cookparms.getNode();
701  if (!thissop) return getSourceGroup();
703  OP_Utils::evalOpParm(result, thissop, "sourcegroup", cookparms.getCookTime(), 0);
704  return result;
705  }
706  const UT_StringHolder & getGoalGroup() const { return myGoalGroup; }
707  void setGoalGroup(const UT_StringHolder & val) { myGoalGroup = val; }
709  {
710  SOP_Node *thissop = cookparms.getNode();
711  if (!thissop) return getGoalGroup();
713  OP_Utils::evalOpParm(result, thissop, "goalgroup", cookparms.getCookTime(), 0);
714  return result;
715  }
716  const UT_StringHolder & getOutputName() const { return myOutputName; }
717  void setOutputName(const UT_StringHolder & val) { myOutputName = val; }
719  {
720  SOP_Node *thissop = cookparms.getNode();
721  if (!thissop) return getOutputName();
723  OP_Utils::evalOpParm(result, thissop, "outputname", cookparms.getCookTime(), 0);
724  return result;
725  }
726  Method getMethod() const { return Method(myMethod); }
727  void setMethod(Method val) { myMethod = int64(val); }
728  Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
729  {
730  SOP_Node *thissop = cookparms.getNode();
731  if (!thissop) return getMethod();
732  int64 result;
733  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
734  return Method(result);
735  }
736  int64 getBlurringWindowRadius() const { return myBlurringWindowRadius; }
737  void setBlurringWindowRadius(int64 val) { myBlurringWindowRadius = val; }
739  {
740  SOP_Node *thissop = cookparms.getNode();
741  if (!thissop) return getBlurringWindowRadius();
742  int64 result;
743  OP_Utils::evalOpParm(result, thissop, "blurringwindowradius", cookparms.getCookTime(), 0);
744  return result;
745  }
746  bool getUseGaussianFilter() const { return myUseGaussianFilter; }
747  void setUseGaussianFilter(bool val) { myUseGaussianFilter = val; }
748  bool opUseGaussianFilter(const SOP_NodeVerb::CookParms &cookparms) const
749  {
750  SOP_Node *thissop = cookparms.getNode();
751  if (!thissop) return getUseGaussianFilter();
752  bool result;
753  OP_Utils::evalOpParm(result, thissop, "usegaussianfilter", cookparms.getCookTime(), 0);
754  return result;
755  }
756  int64 getPyramidLevels() const { return myPyramidLevels; }
757  void setPyramidLevels(int64 val) { myPyramidLevels = val; }
759  {
760  SOP_Node *thissop = cookparms.getNode();
761  if (!thissop) return getPyramidLevels();
762  int64 result;
763  OP_Utils::evalOpParm(result, thissop, "pyramidlevels", cookparms.getCookTime(), 0);
764  return result;
765  }
766  fpreal64 getPyramidScale() const { return myPyramidScale; }
767  void setPyramidScale(fpreal64 val) { myPyramidScale = val; }
769  {
770  SOP_Node *thissop = cookparms.getNode();
771  if (!thissop) return getPyramidScale();
773  OP_Utils::evalOpParm(result, thissop, "pyramidscale", cookparms.getCookTime(), 0);
774  return result;
775  }
776  int64 getIterations() const { return myIterations; }
777  void setIterations(int64 val) { myIterations = val; }
779  {
780  SOP_Node *thissop = cookparms.getNode();
781  if (!thissop) return getIterations();
782  int64 result;
783  OP_Utils::evalOpParm(result, thissop, "iterations", cookparms.getCookTime(), 0);
784  return result;
785  }
786  fpreal64 getApproximationWindowRadius() const { return myApproximationWindowRadius; }
787  void setApproximationWindowRadius(fpreal64 val) { myApproximationWindowRadius = val; }
789  {
790  SOP_Node *thissop = cookparms.getNode();
791  if (!thissop) return getApproximationWindowRadius();
793  OP_Utils::evalOpParm(result, thissop, "approximationwindowradius", cookparms.getCookTime(), 0);
794  return result;
795  }
796  int64 getSmoothnessDegree() const { return mySmoothnessDegree; }
797  void setSmoothnessDegree(int64 val) { mySmoothnessDegree = val; }
799  {
800  SOP_Node *thissop = cookparms.getNode();
801  if (!thissop) return getSmoothnessDegree();
802  int64 result;
803  OP_Utils::evalOpParm(result, thissop, "smoothnessdegree", cookparms.getCookTime(), 0);
804  return result;
805  }
806  int64 getPatchSize() const { return myPatchSize; }
807  void setPatchSize(int64 val) { myPatchSize = val; }
808  int64 opPatchSize(const SOP_NodeVerb::CookParms &cookparms) const
809  {
810  SOP_Node *thissop = cookparms.getNode();
811  if (!thissop) return getPatchSize();
812  int64 result;
813  OP_Utils::evalOpParm(result, thissop, "patchsize", cookparms.getCookTime(), 0);
814  return result;
815  }
816  int64 getPatchStride() const { return myPatchStride; }
817  void setPatchStride(int64 val) { myPatchStride = val; }
819  {
820  SOP_Node *thissop = cookparms.getNode();
821  if (!thissop) return getPatchStride();
822  int64 result;
823  OP_Utils::evalOpParm(result, thissop, "patchstride", cookparms.getCookTime(), 0);
824  return result;
825  }
826  int64 getFinestScale() const { return myFinestScale; }
827  void setFinestScale(int64 val) { myFinestScale = val; }
829  {
830  SOP_Node *thissop = cookparms.getNode();
831  if (!thissop) return getFinestScale();
832  int64 result;
833  OP_Utils::evalOpParm(result, thissop, "finestscale", cookparms.getCookTime(), 0);
834  return result;
835  }
836  int64 getGradientDescentIterations() const { return myGradientDescentIterations; }
837  void setGradientDescentIterations(int64 val) { myGradientDescentIterations = val; }
839  {
840  SOP_Node *thissop = cookparms.getNode();
841  if (!thissop) return getGradientDescentIterations();
842  int64 result;
843  OP_Utils::evalOpParm(result, thissop, "gradientdescentiterations", cookparms.getCookTime(), 0);
844  return result;
845  }
846  fpreal64 getSmoothnessWeight() const { return mySmoothnessWeight; }
847  void setSmoothnessWeight(fpreal64 val) { mySmoothnessWeight = val; }
849  {
850  SOP_Node *thissop = cookparms.getNode();
851  if (!thissop) return getSmoothnessWeight();
853  OP_Utils::evalOpParm(result, thissop, "smoothnessweight", cookparms.getCookTime(), 0);
854  return result;
855  }
856  fpreal64 getColorConstancyWeight() const { return myColorConstancyWeight; }
857  void setColorConstancyWeight(fpreal64 val) { myColorConstancyWeight = val; }
859  {
860  SOP_Node *thissop = cookparms.getNode();
861  if (!thissop) return getColorConstancyWeight();
863  OP_Utils::evalOpParm(result, thissop, "colorconstancyweight", cookparms.getCookTime(), 0);
864  return result;
865  }
866  fpreal64 getGradientConstancyWeight() const { return myGradientConstancyWeight; }
867  void setGradientConstancyWeight(fpreal64 val) { myGradientConstancyWeight = val; }
869  {
870  SOP_Node *thissop = cookparms.getNode();
871  if (!thissop) return getGradientConstancyWeight();
873  OP_Utils::evalOpParm(result, thissop, "gradientconstancyweight", cookparms.getCookTime(), 0);
874  return result;
875  }
876  int64 getVariationalRefinementIterations() const { return myVariationalRefinementIterations; }
877  void setVariationalRefinementIterations(int64 val) { myVariationalRefinementIterations = val; }
879  {
880  SOP_Node *thissop = cookparms.getNode();
881  if (!thissop) return getVariationalRefinementIterations();
882  int64 result;
883  OP_Utils::evalOpParm(result, thissop, "variationalrefinementiterations", cookparms.getCookTime(), 0);
884  return result;
885  }
886  bool getUseMeanNormalization() const { return myUseMeanNormalization; }
887  void setUseMeanNormalization(bool val) { myUseMeanNormalization = val; }
888  bool opUseMeanNormalization(const SOP_NodeVerb::CookParms &cookparms) const
889  {
890  SOP_Node *thissop = cookparms.getNode();
891  if (!thissop) return getUseMeanNormalization();
892  bool result;
893  OP_Utils::evalOpParm(result, thissop, "usemeannormalization", cookparms.getCookTime(), 0);
894  return result;
895  }
896  bool getUseSpatialPropagation() const { return myUseSpatialPropagation; }
897  void setUseSpatialPropagation(bool val) { myUseSpatialPropagation = val; }
899  {
900  SOP_Node *thissop = cookparms.getNode();
901  if (!thissop) return getUseSpatialPropagation();
902  bool result;
903  OP_Utils::evalOpParm(result, thissop, "usespatialpropagation", cookparms.getCookTime(), 0);
904  return result;
905  }
906 
907 private:
908  UT_StringHolder mySourceGroup;
909  UT_StringHolder myGoalGroup;
910  UT_StringHolder myOutputName;
911  int64 myMethod;
912  int64 myBlurringWindowRadius;
913  bool myUseGaussianFilter;
914  int64 myPyramidLevels;
915  fpreal64 myPyramidScale;
916  int64 myIterations;
917  fpreal64 myApproximationWindowRadius;
918  int64 mySmoothnessDegree;
919  int64 myPatchSize;
920  int64 myPatchStride;
921  int64 myFinestScale;
922  int64 myGradientDescentIterations;
923  fpreal64 mySmoothnessWeight;
924  fpreal64 myColorConstancyWeight;
925  fpreal64 myGradientConstancyWeight;
926  int64 myVariationalRefinementIterations;
927  bool myUseMeanNormalization;
928  bool myUseSpatialPropagation;
929 
930 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
type
Definition: core.h:556
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void save(std::ostream &os) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
UT_StringHolder opSourceGroup(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 opGradientConstancyWeight(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
const UT_StringHolder & getGoalGroup() const
static void saveData(std::ostream &os, UT_Matrix2D v)
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:63
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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
GLdouble s
Definition: glad.h:3009
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
int64 opVariationalRefinementIterations(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
**But if you need a result
Definition: thread.h:622
UT_StringHolder opOutputName(const SOP_NodeVerb::CookParms &cookparms) 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 saveData(std::ostream &os, fpreal64 v)
UT_StringHolder opGoalGroup(const SOP_NodeVerb::CookParms &cookparms) const
void copyFrom(const OP_NodeParms *src) override
SYS_FORCE_INLINE UT_StringHolder getToken(Method enum_value)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void loadData(UT_IStream &is, UT_Vector4D &v)
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
int64 opGradientDescentIterations(const SOP_NodeVerb::CookParms &cookparms) const
int64 opPatchSize(const SOP_NodeVerb::CookParms &cookparms) const
int64 opPyramidLevels(const SOP_NodeVerb::CookParms &cookparms) const
bool opUseMeanNormalization(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void saveData(std::ostream &os, UT_Matrix4D v)
static void saveData(std::ostream &os, UT_Vector2D v)
bool operator!=(const SOP_TextureOpticalFlowParms &src) const
exint length() const
fpreal64 opColorConstancyWeight(const SOP_NodeVerb::CookParms &cookparms) 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, UT_Vector3I &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void setGoalGroup(const UT_StringHolder &val)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void saveData(std::ostream &os, UT_StringHolder s)
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
int64 opSmoothnessDegree(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, fpreal64 &v)
long long int64
Definition: SYS_Types.h:116
int64 opPatchStride(const SOP_NodeVerb::CookParms &cookparms) const
fpreal64 opSmoothnessWeight(const SOP_NodeVerb::CookParms &cookparms) const
void setSourceGroup(const UT_StringHolder &val)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void saveData(std::ostream &os, UT_Vector4D v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:303
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
GT_API const UT_StringHolder version
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, bool v)
int64 opBlurringWindowRadius(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, int64 &v)
bool opUseSpatialPropagation(const SOP_NodeVerb::CookParms &cookparms) const
const char * getNestParmName(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void loadData(UT_IStream &is, bool &v)
const UT_StringHolder & getSourceGroup() const
fpreal64 fpreal
Definition: SYS_Types.h:278
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
fpreal64 opPyramidScale(const SOP_NodeVerb::CookParms &cookparms) const
int64 opIterations(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
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
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setOutputName(const UT_StringHolder &val)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:372
static void loadData(UT_IStream &is, UT_Matrix3D &v)
bool isParmColorRamp(exint idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
const char * findChar(int c) const
Definition: UT_String.h:1401
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
bool opUseGaussianFilter(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void loadFromOpSubclass(const LoadParms &loadparms) override
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_StringHolder & getOutputName() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
fpreal64 opApproximationWindowRadius(const SOP_NodeVerb::CookParms &cookparms) const
exint getNestNumParms(TempIndex idx) const override
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void saveData(std::ostream &os, UT_Matrix3D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
ParmType getNestParmType(TempIndex fieldnum) const override
int64 opFinestScale(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const SOP_TextureOpticalFlowParms &src) const
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663