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