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