HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MatchTopology.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 
25 {
26 public:
27  static int version() { return 1; }
28 
30  {
31  myTrackpts = ""_UTsh;
32  myRefpts = ""_UTsh;
33  myAssumeprimmatch = false;
34 
35  }
36 
37  explicit SOP_MatchTopologyParms(const SOP_MatchTopologyParms &) = default;
39  SOP_MatchTopologyParms(SOP_MatchTopologyParms &&) noexcept = default;
40  SOP_MatchTopologyParms &operator=(SOP_MatchTopologyParms &&) noexcept = default;
41 
42  ~SOP_MatchTopologyParms() override {}
43 
45  {
46  if (myTrackpts != src.myTrackpts) return false;
47  if (myRefpts != src.myRefpts) return false;
48  if (myAssumeprimmatch != src.myAssumeprimmatch) return false;
49 
50  return true;
51  }
53  {
54  return !operator==(src);
55  }
56 
57 
58 
59  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
60  {
61  myTrackpts = ""_UTsh;
62  if (true)
63  graph->evalOpParm(myTrackpts, nodeidx, "trackpts", time, 0);
64  myRefpts = ""_UTsh;
65  if (true)
66  graph->evalOpParm(myRefpts, nodeidx, "refpts", time, 0);
67  myAssumeprimmatch = false;
68  if (true)
69  graph->evalOpParm(myAssumeprimmatch, nodeidx, "assumeprimmatch", time, 0);
70 
71  }
72 
73 
74  void loadFromOpSubclass(const LoadParms &loadparms) override
75  {
76  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
77  }
78 
79 
80  void copyFrom(const OP_NodeParms *src) override
81  {
82  *this = *((const SOP_MatchTopologyParms *)src);
83  }
84 
85  template <typename T>
86  void
87  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
88  {
89  if (idx.size() < 1)
90  return;
91  UT_ASSERT(idx.size() == instance.size()+1);
92  if (idx.size() != instance.size()+1)
93  return;
94  switch (idx[0])
95  {
96  case 0:
97  coerceValue(value, myTrackpts);
98  break;
99  case 1:
100  coerceValue(value, myRefpts);
101  break;
102  case 2:
103  coerceValue(value, myAssumeprimmatch);
104  break;
105 
106  }
107  }
108 
109  bool isParmColorRamp(exint idx) const override
110  {
111  switch (idx)
112  {
113 
114  }
115  return false;
116  }
117 
118  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
119  { doGetParmValue(idx, instance, value); }
120  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
121  { doGetParmValue(idx, instance, value); }
122  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
123  { doGetParmValue(idx, instance, value); }
124  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
125  { doGetParmValue(idx, instance, value); }
126  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
127  { doGetParmValue(idx, instance, value); }
128  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
129  { doGetParmValue(idx, instance, value); }
130  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
131  { doGetParmValue(idx, instance, value); }
132  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
133  { doGetParmValue(idx, instance, value); }
134  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
135  { doGetParmValue(idx, instance, value); }
136  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
137  { doGetParmValue(idx, instance, value); }
138  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
139  { doGetParmValue(idx, instance, value); }
140 
141  template <typename T>
142  void
143  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
144  {
145  if (idx.size() < 1)
146  return;
147  UT_ASSERT(idx.size() == instance.size()+1);
148  if (idx.size() != instance.size()+1)
149  return;
150  switch (idx[0])
151  {
152  case 0:
153  coerceValue(myTrackpts, ( ( value ) ));
154  break;
155  case 1:
156  coerceValue(myRefpts, ( ( value ) ));
157  break;
158  case 2:
159  coerceValue(myAssumeprimmatch, ( ( value ) ));
160  break;
161 
162  }
163  }
164 
165  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
166  { doSetParmValue(idx, instance, value); }
167  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
168  { doSetParmValue(idx, instance, value); }
169  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
170  { doSetParmValue(idx, instance, value); }
171  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
172  { doSetParmValue(idx, instance, value); }
173  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
174  { doSetParmValue(idx, instance, value); }
175  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
176  { doSetParmValue(idx, instance, value); }
177  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
178  { doSetParmValue(idx, instance, value); }
179  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
180  { doSetParmValue(idx, instance, value); }
181  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
182  { doSetParmValue(idx, instance, value); }
183  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
184  { doSetParmValue(idx, instance, value); }
185  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
186  { doSetParmValue(idx, instance, value); }
187 
188  exint getNestNumParms(TempIndex idx) const override
189  {
190  if (idx.size() == 0)
191  return 3;
192  switch (idx[0])
193  {
194 
195  }
196  // Invalid
197  return 0;
198  }
199 
200  const char *getNestParmName(TempIndex fieldnum) const override
201  {
202  if (fieldnum.size() < 1)
203  return 0;
204  switch (fieldnum[0])
205  {
206  case 0:
207  return "trackpts";
208  case 1:
209  return "refpts";
210  case 2:
211  return "assumeprimmatch";
212 
213  }
214  return 0;
215  }
216 
217  ParmType getNestParmType(TempIndex fieldnum) const override
218  {
219  if (fieldnum.size() < 1)
220  return PARM_UNSUPPORTED;
221  switch (fieldnum[0])
222  {
223  case 0:
224  return PARM_STRING;
225  case 1:
226  return PARM_STRING;
227  case 2:
228  return PARM_INTEGER;
229 
230  }
231  return PARM_UNSUPPORTED;
232  }
233 
234  // Boiler plate to load individual types.
235  static void loadData(UT_IStream &is, int64 &v)
236  { is.bread(&v, 1); }
237  static void loadData(UT_IStream &is, bool &v)
238  { int64 iv; is.bread(&iv, 1); v = iv; }
239  static void loadData(UT_IStream &is, fpreal64 &v)
240  { is.bread<fpreal64>(&v, 1); }
241  static void loadData(UT_IStream &is, UT_Vector2D &v)
242  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
243  static void loadData(UT_IStream &is, UT_Vector3D &v)
244  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
245  is.bread<fpreal64>(&v.z(), 1); }
246  static void loadData(UT_IStream &is, UT_Vector4D &v)
247  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
248  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
249  static void loadData(UT_IStream &is, UT_Matrix2D &v)
250  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
251  static void loadData(UT_IStream &is, UT_Matrix3D &v)
252  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
253  static void loadData(UT_IStream &is, UT_Matrix4D &v)
254  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
255  static void loadData(UT_IStream &is, UT_Vector2I &v)
256  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
257  static void loadData(UT_IStream &is, UT_Vector3I &v)
258  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
259  is.bread<int64>(&v.z(), 1); }
260  static void loadData(UT_IStream &is, UT_Vector4I &v)
261  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
262  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
264  { is.bread(v); }
266  { UT_StringHolder rampdata;
267  loadData(is, rampdata);
268  if (rampdata.isstring())
269  {
270  v.reset(new UT_Ramp());
271  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
272  v->load(istr);
273  }
274  else v.reset();
275  }
278  loadData(is, data);
279  if (data.isstring())
280  {
281  // Find the data type.
282  const char *colon = UT_StringWrap(data).findChar(':');
283  if (colon)
284  {
285  int typelen = colon - data.buffer();
287  type.strncpy(data.buffer(), typelen);
288  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
289 
290  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
291  }
292  }
293  else v.reset();
294  }
295 
296  static void saveData(std::ostream &os, int64 v)
297  { UTwrite(os, &v); }
298  static void saveData(std::ostream &os, bool v)
299  { int64 iv = v; UTwrite(os, &iv); }
300  static void saveData(std::ostream &os, fpreal64 v)
301  { UTwrite<fpreal64>(os, &v); }
302  static void saveData(std::ostream &os, UT_Vector2D v)
303  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
304  static void saveData(std::ostream &os, UT_Vector3D v)
305  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
306  UTwrite<fpreal64>(os, &v.z()); }
307  static void saveData(std::ostream &os, UT_Vector4D v)
308  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
309  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
310  static void saveData(std::ostream &os, UT_Matrix2D v)
312  static void saveData(std::ostream &os, UT_Matrix3D v)
314  static void saveData(std::ostream &os, UT_Matrix4D v)
316  static void saveData(std::ostream &os, UT_StringHolder s)
317  { UT_StringWrap(s).saveBinary(os); }
318  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
320  UT_OStringStream ostr;
321  if (s) s->save(ostr);
322  result = ostr.str();
323  saveData(os, result);
324  }
325  static void saveData(std::ostream &os, PRM_DataItemHandle s)
327  UT_OStringStream ostr;
328  if (s)
329  {
330  ostr << s->getDataTypeToken();
331  ostr << ":";
332  s->saveBinary(ostr);
333  }
334  result = ostr.str();
335  saveData(os, result);
336  }
337 
338 
339  void save(std::ostream &os) const
340  {
341  int32 v = version();
342  UTwrite(os, &v);
343  saveData(os, myTrackpts);
344  saveData(os, myRefpts);
345  saveData(os, myAssumeprimmatch);
346 
347  }
348 
349  bool load(UT_IStream &is)
350  {
351  int32 v;
352  is.bread(&v, 1);
353  if (version() != v)
354  {
355  // Fail incompatible versions
356  return false;
357  }
358  loadData(is, myTrackpts);
359  loadData(is, myRefpts);
360  loadData(is, myAssumeprimmatch);
361 
362  return true;
363  }
364 
365  const UT_StringHolder & getTrackpts() const { return myTrackpts; }
366  void setTrackpts(const UT_StringHolder & val) { myTrackpts = val; }
368  {
369  SOP_Node *thissop = cookparms.getNode();
370  if (!thissop) return getTrackpts();
372  OP_Utils::evalOpParm(result, thissop, "trackpts", cookparms.getCookTime(), 0);
373  return result;
374  }
375  const UT_StringHolder & getRefpts() const { return myRefpts; }
376  void setRefpts(const UT_StringHolder & val) { myRefpts = val; }
378  {
379  SOP_Node *thissop = cookparms.getNode();
380  if (!thissop) return getRefpts();
382  OP_Utils::evalOpParm(result, thissop, "refpts", cookparms.getCookTime(), 0);
383  return result;
384  }
385  bool getAssumeprimmatch() const { return myAssumeprimmatch; }
386  void setAssumeprimmatch(bool val) { myAssumeprimmatch = val; }
387  bool opAssumeprimmatch(const SOP_NodeVerb::CookParms &cookparms) const
388  {
389  SOP_Node *thissop = cookparms.getNode();
390  if (!thissop) return getAssumeprimmatch();
391  bool result;
392  OP_Utils::evalOpParm(result, thissop, "assumeprimmatch", cookparms.getCookTime(), 0);
393  return result;
394  }
395 
396 private:
397  UT_StringHolder myTrackpts;
398  UT_StringHolder myRefpts;
399  bool myAssumeprimmatch;
400 
401 };
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
static void loadData(UT_IStream &is, int64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
exint getNestNumParms(TempIndex idx) const override
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
bool operator==(const SOP_MatchTopologyParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:62
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_StringHolder & getTrackpts() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
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
An output stream object that owns its own string buffer storage.
void setRefpts(const UT_StringHolder &val)
const char * getNestParmName(TempIndex fieldnum) const override
**But if you need a result
Definition: thread.h:613
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
bool isParmColorRamp(exint idx) const override
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.
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void loadFromOpSubclass(const LoadParms &loadparms) override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
UT_StringHolder opTrackpts(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector2D v)
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
bool opAssumeprimmatch(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opRefpts(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
exint length() const
static void saveData(std::ostream &os, UT_Matrix2D 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
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
bool operator!=(const SOP_MatchTopologyParms &src) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
long long int64
Definition: SYS_Types.h:116
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void saveData(std::ostream &os, UT_StringHolder s)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
GT_API const UT_StringHolder version
void setTrackpts(const UT_StringHolder &val)
ParmType getNestParmType(TempIndex fieldnum) const override
void coerceValue(T &result, const S &src) const
Definition: OP_NodeParms.h:301
static void loadData(UT_IStream &is, UT_StringHolder &v)
void copyFrom(const OP_NodeParms *src) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:88
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
static void saveData(std::ostream &os, UT_Vector3D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
const UT_StringHolder & getRefpts() const
static void saveData(std::ostream &os, fpreal64 v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
static void loadData(UT_IStream &is, bool &v)
const char * findChar(int c) const
Definition: UT_String.h:1385
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
static void saveData(std::ostream &os, UT_Matrix3D v)
GLboolean r
Definition: glcorearb.h:1222
static void saveData(std::ostream &os, bool v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void save(std::ostream &os) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
static void saveData(std::ostream &os, int64 v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
type
Definition: core.h:1059
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
OP_NodeParms & operator=(const OP_NodeParms &)=default
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
static void loadData(UT_IStream &is, UT_Matrix3D &v)