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