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 <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  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 
47  if (baseGetSignature() != src.baseGetSignature()) return false;
48 
49  return true;
50  }
51  bool operator!=(const SOP_SwitchParms &src) const
52  {
53  return !operator==(src);
54  }
55 
56 
57 
58  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
59  {
60  myInput = 0;
61  if (true)
62  graph->evalOpParm(myInput, nodeidx, "input", time, graph->isDirect()?nullptr:depnode);
63 
64  }
65 
66 
67  void loadFromOpSubclass(const LoadParms &loadparms) override
68  {
69  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
70  }
71 
72 
73  void copyFrom(const OP_NodeParms *src) override
74  {
75  *this = *((const SOP_SwitchParms *)src);
76  }
77 
78  template <typename T>
79  void
80  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
81  {
82  if (idx.size() < 1)
83  return;
84  UT_ASSERT(idx.size() == instance.size()+1);
85  if (idx.size() != instance.size()+1)
86  return;
87  switch (idx[0])
88  {
89  case 0:
90  coerceValue(value, myInput);
91  break;
92 
93  }
94  }
95 
96  bool isParmColorRamp(exint idx) const override
97  {
98  switch (idx)
99  {
100 
101  }
102  return false;
103  }
104 
105  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
106  { doGetParmValue(idx, instance, value); }
107  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
108  { doGetParmValue(idx, instance, value); }
109  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
110  { doGetParmValue(idx, instance, value); }
111  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
112  { doGetParmValue(idx, instance, value); }
113  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
114  { doGetParmValue(idx, instance, value); }
115  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
116  { doGetParmValue(idx, instance, value); }
117  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
118  { doGetParmValue(idx, instance, value); }
119  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
120  { doGetParmValue(idx, instance, value); }
121  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
122  { doGetParmValue(idx, instance, value); }
123  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
124  { doGetParmValue(idx, instance, value); }
125  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
126  { doGetParmValue(idx, instance, value); }
127 
128  template <typename T>
129  void
130  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
131  {
132  if (idx.size() < 1)
133  return;
134  UT_ASSERT(idx.size() == instance.size()+1);
135  if (idx.size() != instance.size()+1)
136  return;
137  switch (idx[0])
138  {
139  case 0:
140  coerceValue(myInput, ( ( value ) ));
141  break;
142 
143  }
144  }
145 
146  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
147  { doSetParmValue(idx, instance, value); }
148  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
149  { doSetParmValue(idx, instance, value); }
150  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
151  { doSetParmValue(idx, instance, value); }
152  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
153  { doSetParmValue(idx, instance, value); }
154  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
155  { doSetParmValue(idx, instance, value); }
156  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
157  { doSetParmValue(idx, instance, value); }
158  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
159  { doSetParmValue(idx, instance, value); }
160  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
161  { doSetParmValue(idx, instance, value); }
162  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
163  { doSetParmValue(idx, instance, value); }
164  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
165  { doSetParmValue(idx, instance, value); }
166  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
167  { doSetParmValue(idx, instance, value); }
168 
169  exint getNestNumParms(TempIndex idx) const override
170  {
171  if (idx.size() == 0)
172  return 1;
173  switch (idx[0])
174  {
175 
176  }
177  // Invalid
178  return 0;
179  }
180 
181  const char *getNestParmName(TempIndex fieldnum) const override
182  {
183  if (fieldnum.size() < 1)
184  return 0;
185  switch (fieldnum[0])
186  {
187  case 0:
188  return "input";
189 
190  }
191  return 0;
192  }
193 
194  ParmType getNestParmType(TempIndex fieldnum) const override
195  {
196  if (fieldnum.size() < 1)
197  return PARM_UNSUPPORTED;
198  switch (fieldnum[0])
199  {
200  case 0:
201  return PARM_INTEGER;
202 
203  }
204  return PARM_UNSUPPORTED;
205  }
206 
207  // Boiler plate to load individual types.
208  static void loadData(UT_IStream &is, int64 &v)
209  { is.bread(&v, 1); }
210  static void loadData(UT_IStream &is, bool &v)
211  { int64 iv; is.bread(&iv, 1); v = iv; }
212  static void loadData(UT_IStream &is, fpreal64 &v)
213  { is.bread<fpreal64>(&v, 1); }
214  static void loadData(UT_IStream &is, UT_Vector2D &v)
215  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
216  static void loadData(UT_IStream &is, UT_Vector3D &v)
217  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
218  is.bread<fpreal64>(&v.z(), 1); }
219  static void loadData(UT_IStream &is, UT_Vector4D &v)
220  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
221  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
222  static void loadData(UT_IStream &is, UT_Matrix2D &v)
223  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
224  static void loadData(UT_IStream &is, UT_Matrix3D &v)
225  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
226  static void loadData(UT_IStream &is, UT_Matrix4D &v)
227  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
228  static void loadData(UT_IStream &is, UT_Vector2I &v)
229  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
230  static void loadData(UT_IStream &is, UT_Vector3I &v)
231  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
232  is.bread<int64>(&v.z(), 1); }
233  static void loadData(UT_IStream &is, UT_Vector4I &v)
234  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
235  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
237  { is.bread(v); }
239  { UT_StringHolder rampdata;
240  loadData(is, rampdata);
241  if (rampdata.isstring())
242  {
243  v.reset(new UT_Ramp());
244  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
245  v->load(istr);
246  }
247  else v.reset();
248  }
251  loadData(is, data);
252  if (data.isstring())
253  {
254  // Find the data type.
255  const char *colon = UT_StringWrap(data).findChar(':');
256  if (colon)
257  {
258  int typelen = colon - data.buffer();
260  type.strncpy(data.buffer(), typelen);
261  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
262 
263  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
264  }
265  }
266  else v.reset();
267  }
268 
269  static void saveData(std::ostream &os, int64 v)
270  { UTwrite(os, &v); }
271  static void saveData(std::ostream &os, bool v)
272  { int64 iv = v; UTwrite(os, &iv); }
273  static void saveData(std::ostream &os, fpreal64 v)
274  { UTwrite<fpreal64>(os, &v); }
275  static void saveData(std::ostream &os, UT_Vector2D v)
276  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
277  static void saveData(std::ostream &os, UT_Vector3D v)
278  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
279  UTwrite<fpreal64>(os, &v.z()); }
280  static void saveData(std::ostream &os, UT_Vector4D v)
281  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
282  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
283  static void saveData(std::ostream &os, UT_Matrix2D v)
285  static void saveData(std::ostream &os, UT_Matrix3D v)
287  static void saveData(std::ostream &os, UT_Matrix4D v)
289  static void saveData(std::ostream &os, UT_StringHolder s)
290  { UT_StringWrap(s).saveBinary(os); }
291  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
293  UT_OStringStream ostr;
294  if (s) s->save(ostr);
295  result = ostr.str();
296  saveData(os, result);
297  }
298  static void saveData(std::ostream &os, PRM_DataItemHandle s)
300  UT_OStringStream ostr;
301  if (s)
302  {
303  ostr << s->getDataTypeToken();
304  ostr << ":";
305  s->saveBinary(ostr);
306  }
307  result = ostr.str();
308  saveData(os, result);
309  }
310 
311 
312  void save(std::ostream &os) const
313  {
314  int32 v = version();
315  UTwrite(os, &v);
316  saveData(os, myInput);
317 
318  }
319 
320  bool load(UT_IStream &is)
321  {
322  int32 v;
323  is.bread(&v, 1);
324  if (version() != v)
325  {
326  // Fail incompatible versions
327  return false;
328  }
329  loadData(is, myInput);
330 
331  return true;
332  }
333 
334  int64 getInput() const { return myInput; }
335  void setInput(int64 val) { myInput = val; }
336  int64 opInput(const SOP_NodeVerb::CookParms &cookparms) const
337  {
338  SOP_Node *thissop = cookparms.getNode();
339  if (!thissop) return getInput();
340  int64 result;
341  OP_Utils::evalOpParm(result, thissop, "input", cookparms.getCookTime(), 0);
342  return result;
343  }
344 
345 private:
346  int64 myInput;
347 
348 };
type
Definition: core.h:556
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:63
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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:622
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
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:303
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:310
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:278
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:96
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
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
#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:372
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
const char * findChar(int c) const
Definition: UT_String.h:1401
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
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
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
void loadFromOpSubclass(const LoadParms &loadparms) override
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