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