HDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Null.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  myCopyinput = true;
32  myCacheinput = false;
33 
34  }
35 
36  explicit SOP_NullParms(const SOP_NullParms &) = default;
37  SOP_NullParms &operator=(const SOP_NullParms &) = default;
38  SOP_NullParms(SOP_NullParms &&) noexcept = default;
39  SOP_NullParms &operator=(SOP_NullParms &&) noexcept = default;
40 
41  ~SOP_NullParms() override {}
42 
43  bool operator==(const SOP_NullParms &src) const
44  {
45  if (myCopyinput != src.myCopyinput) return false;
46  if (myCacheinput != src.myCacheinput) return false;
47 
48  return true;
49  }
50  bool operator!=(const SOP_NullParms &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  myCopyinput = true;
60  if (true && ( (true&&!((((graph->getInput(nodeidx,0)>=0)==0)))) ) )
61  graph->evalOpParm(myCopyinput, nodeidx, "copyinput", time, 0);
62  myCacheinput = false;
63  if (true && ( (true&&!((((graph->getInput(nodeidx,0)>=0)==0))||((getCopyinput()==0)))) ) )
64  graph->evalOpParm(myCacheinput, nodeidx, "cacheinput", 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_NullParms *)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, myCopyinput);
93  break;
94  case 1:
95  coerceValue(value, myCacheinput);
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(myCopyinput, ( ( value ) ));
146  break;
147  case 1:
148  coerceValue(myCacheinput, ( ( 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 "copyinput";
197  case 1:
198  return "cacheinput";
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_INTEGER;
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, myCopyinput);
329  saveData(os, myCacheinput);
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, myCopyinput);
343  loadData(is, myCacheinput);
344 
345  return true;
346  }
347 
348  bool getCopyinput() const { return myCopyinput; }
349  void setCopyinput(bool val) { myCopyinput = val; }
350  bool opCopyinput(const SOP_NodeVerb::CookParms &cookparms) const
351  {
352  SOP_Node *thissop = cookparms.getNode();
353  if (!thissop) return getCopyinput();
354  bool result;
355  OP_Utils::evalOpParm(result, thissop, "copyinput", cookparms.getCookTime(), 0);
356  return result;
357  }
358  bool getCacheinput() const { return myCacheinput; }
359  void setCacheinput(bool val) { myCacheinput = val; }
360  bool opCacheinput(const SOP_NodeVerb::CookParms &cookparms) const
361  {
362  SOP_Node *thissop = cookparms.getNode();
363  if (!thissop) return getCacheinput();
364  bool result;
365  OP_Utils::evalOpParm(result, thissop, "cacheinput", cookparms.getCookTime(), 0);
366  return result;
367  }
368 
369 private:
370  bool myCopyinput;
371  bool myCacheinput;
372 
373 };
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
exint getNestNumParms(TempIndex idx) const override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
static void loadData(UT_IStream &is, UT_Vector2D &v)
void save(std::ostream &os) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
bool isParmColorRamp(exint idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
bool opCopyinput(const SOP_NodeVerb::CookParms &cookparms) const
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:62
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
ParmType getNestParmType(TempIndex fieldnum) const override
static void saveData(std::ostream &os, bool v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
const OP_Context & context() const
Definition: OP_NodeParms.h:97
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
bool getCopyinput() const
SYS_FORCE_INLINE const char * buffer() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
GLdouble s
Definition: glad.h:3009
An output stream object that owns its own string buffer storage.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, int64 &v)
**But if you need a result
Definition: thread.h:613
bool load(UT_IStream &is)
void setCacheinput(bool val)
bool operator==(const SOP_NullParms &src) const
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.
bool getCacheinput() const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void saveData(std::ostream &os, UT_Matrix4D v)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
virtual NodeIdx getInput(NodeIdx idx, int input, bool markused=false) const =0
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
exint length() const
static int version()
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) 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
static void saveData(std::ostream &os, UT_Vector3D v)
const char * getNestParmName(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, UT_Vector2D v)
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
void loadFromOpSubclass(const LoadParms &loadparms) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
bool opCacheinput(const SOP_NodeVerb::CookParms &cookparms) const
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
GT_API const UT_StringHolder version
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, bool &v)
void coerceValue(T &result, const S &src) const
Definition: OP_NodeParms.h:301
static void saveData(std::ostream &os, UT_Matrix2D v)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool operator!=(const SOP_NullParms &src) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
void copyFrom(const OP_NodeParms *src) override
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
void setCopyinput(bool val)
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void saveData(std::ostream &os, fpreal64 v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
type
Definition: core.h:1059
static void loadData(UT_IStream &is, fpreal64 &v)
static void saveData(std::ostream &os, int64 v)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
OP_NodeParms & operator=(const OP_NodeParms &)=default
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663