HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_CameraToPoints.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 namespace SOP_CameraToPointsEnums
24 {
25  enum class Outputproperties
26  {
27  DICT = 0,
28  UNPACK
29  };
30 
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Outputproperties::DICT: return "dict"_sh;
37  case Outputproperties::UNPACK: return "unpack"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42 }
43 
44 
46 {
47 public:
48  static int version() { return 1; }
49 
51  {
52  myOutputproperties = 0;
53  myCamparmsattr = "camera_parms"_UTsh;
54 
55  }
56 
57  explicit SOP_CameraToPointsParms(const SOP_CameraToPointsParms &) = default;
59  SOP_CameraToPointsParms(SOP_CameraToPointsParms &&) noexcept = default;
60  SOP_CameraToPointsParms &operator=(SOP_CameraToPointsParms &&) noexcept = default;
61 
62  ~SOP_CameraToPointsParms() override {}
63 
65  {
66  if (myOutputproperties != src.myOutputproperties) return false;
67  if (myCamparmsattr != src.myCamparmsattr) return false;
68 
69 
70  if (baseGetSignature() != src.baseGetSignature()) return false;
71 
72  return true;
73  }
75  {
76  return !operator==(src);
77  }
79 
80 
81 
82  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
83  {
84  myOutputproperties = 0;
85  if (true)
86  graph->evalOpParm(myOutputproperties, nodeidx, "outputproperties", time, graph->isDirect()?nullptr:depnode);
87  myCamparmsattr = "camera_parms"_UTsh;
88  if (true && ( (true&&!(((int64(getOutputproperties())!=0)))) ) )
89  graph->evalOpParm(myCamparmsattr, nodeidx, "camparmsattr", time, graph->isDirect()?nullptr:depnode);
90 
91  }
92 
93 
94  void loadFromOpSubclass(const LoadParms &loadparms) override
95  {
96  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
97  }
98 
99 
100  void copyFrom(const OP_NodeParms *src) override
101  {
102  *this = *((const SOP_CameraToPointsParms *)src);
103  }
104 
105  template <typename T>
106  void
107  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
108  {
109  if (idx.size() < 1)
110  return;
111  UT_ASSERT(idx.size() == instance.size()+1);
112  if (idx.size() != instance.size()+1)
113  return;
114  switch (idx[0])
115  {
116  case 0:
117  coerceValue(value, myOutputproperties);
118  break;
119  case 1:
120  coerceValue(value, myCamparmsattr);
121  break;
122 
123  }
124  }
125 
126  bool isParmColorRamp(exint idx) const override
127  {
128  switch (idx)
129  {
130 
131  }
132  return false;
133  }
134 
135  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
136  { doGetParmValue(idx, instance, value); }
137  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
138  { doGetParmValue(idx, instance, value); }
139  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
140  { doGetParmValue(idx, instance, value); }
141  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
142  { doGetParmValue(idx, instance, value); }
143  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
144  { doGetParmValue(idx, instance, value); }
145  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
146  { doGetParmValue(idx, instance, value); }
147  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
148  { doGetParmValue(idx, instance, value); }
149  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
150  { doGetParmValue(idx, instance, value); }
151  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
152  { doGetParmValue(idx, instance, value); }
153  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
154  { doGetParmValue(idx, instance, value); }
155  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
156  { doGetParmValue(idx, instance, value); }
157 
158  template <typename T>
159  void
160  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
161  {
162  if (idx.size() < 1)
163  return;
164  UT_ASSERT(idx.size() == instance.size()+1);
165  if (idx.size() != instance.size()+1)
166  return;
167  switch (idx[0])
168  {
169  case 0:
170  coerceValue(myOutputproperties, clampMinValue(0, clampMaxValue(1, value ) ));
171  break;
172  case 1:
173  coerceValue(myCamparmsattr, ( ( value ) ));
174  break;
175 
176  }
177  }
178 
179  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
180  { doSetParmValue(idx, instance, value); }
181  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
182  { doSetParmValue(idx, instance, value); }
183  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
184  { doSetParmValue(idx, instance, value); }
185  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
186  { doSetParmValue(idx, instance, value); }
187  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
188  { doSetParmValue(idx, instance, value); }
189  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
190  { doSetParmValue(idx, instance, value); }
191  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
192  { doSetParmValue(idx, instance, value); }
193  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
194  { doSetParmValue(idx, instance, value); }
195  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
196  { doSetParmValue(idx, instance, value); }
197  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
198  { doSetParmValue(idx, instance, value); }
199  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
200  { doSetParmValue(idx, instance, value); }
201 
202  exint getNestNumParms(TempIndex idx) const override
203  {
204  if (idx.size() == 0)
205  return 2;
206  switch (idx[0])
207  {
208 
209  }
210  // Invalid
211  return 0;
212  }
213 
214  const char *getNestParmName(TempIndex fieldnum) const override
215  {
216  if (fieldnum.size() < 1)
217  return 0;
218  switch (fieldnum[0])
219  {
220  case 0:
221  return "outputproperties";
222  case 1:
223  return "camparmsattr";
224 
225  }
226  return 0;
227  }
228 
229  ParmType getNestParmType(TempIndex fieldnum) const override
230  {
231  if (fieldnum.size() < 1)
232  return PARM_UNSUPPORTED;
233  switch (fieldnum[0])
234  {
235  case 0:
236  return PARM_INTEGER;
237  case 1:
238  return PARM_STRING;
239 
240  }
241  return PARM_UNSUPPORTED;
242  }
243 
244  // Boiler plate to load individual types.
245  static void loadData(UT_IStream &is, int64 &v)
246  { is.bread(&v, 1); }
247  static void loadData(UT_IStream &is, bool &v)
248  { int64 iv; is.bread(&iv, 1); v = iv; }
249  static void loadData(UT_IStream &is, fpreal64 &v)
250  { is.bread<fpreal64>(&v, 1); }
251  static void loadData(UT_IStream &is, UT_Vector2D &v)
252  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
253  static void loadData(UT_IStream &is, UT_Vector3D &v)
254  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
255  is.bread<fpreal64>(&v.z(), 1); }
256  static void loadData(UT_IStream &is, UT_Vector4D &v)
257  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
258  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
259  static void loadData(UT_IStream &is, UT_Matrix2D &v)
260  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
261  static void loadData(UT_IStream &is, UT_Matrix3D &v)
262  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
263  static void loadData(UT_IStream &is, UT_Matrix4D &v)
264  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
265  static void loadData(UT_IStream &is, UT_Vector2I &v)
266  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
267  static void loadData(UT_IStream &is, UT_Vector3I &v)
268  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
269  is.bread<int64>(&v.z(), 1); }
270  static void loadData(UT_IStream &is, UT_Vector4I &v)
271  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
272  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
274  { is.bread(v); }
276  { UT_StringHolder rampdata;
277  loadData(is, rampdata);
278  if (rampdata.isstring())
279  {
280  v.reset(new UT_Ramp());
281  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
282  v->load(istr);
283  }
284  else v.reset();
285  }
288  loadData(is, data);
289  if (data.isstring())
290  {
291  // Find the data type.
292  const char *colon = UT_StringWrap(data).findChar(':');
293  if (colon)
294  {
295  int typelen = colon - data.buffer();
297  type.strncpy(data.buffer(), typelen);
298  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
299 
300  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
301  }
302  }
303  else v.reset();
304  }
305 
306  static void saveData(std::ostream &os, int64 v)
307  { UTwrite(os, &v); }
308  static void saveData(std::ostream &os, bool v)
309  { int64 iv = v; UTwrite(os, &iv); }
310  static void saveData(std::ostream &os, fpreal64 v)
311  { UTwrite<fpreal64>(os, &v); }
312  static void saveData(std::ostream &os, UT_Vector2D v)
313  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
314  static void saveData(std::ostream &os, UT_Vector3D v)
315  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
316  UTwrite<fpreal64>(os, &v.z()); }
317  static void saveData(std::ostream &os, UT_Vector4D v)
318  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
319  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
320  static void saveData(std::ostream &os, UT_Matrix2D v)
322  static void saveData(std::ostream &os, UT_Matrix3D v)
324  static void saveData(std::ostream &os, UT_Matrix4D v)
326  static void saveData(std::ostream &os, UT_StringHolder s)
327  { UT_StringWrap(s).saveBinary(os); }
328  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
330  UT_OStringStream ostr;
331  if (s) s->save(ostr);
332  result = ostr.str();
333  saveData(os, result);
334  }
335  static void saveData(std::ostream &os, PRM_DataItemHandle s)
337  UT_OStringStream ostr;
338  if (s)
339  {
340  ostr << s->getDataTypeToken();
341  ostr << ":";
342  s->saveBinary(ostr);
343  }
344  result = ostr.str();
345  saveData(os, result);
346  }
347 
348 
349  void save(std::ostream &os) const
350  {
351  int32 v = version();
352  UTwrite(os, &v);
353  saveData(os, myOutputproperties);
354  saveData(os, myCamparmsattr);
355 
356  }
357 
358  bool load(UT_IStream &is)
359  {
360  int32 v;
361  is.bread(&v, 1);
362  if (version() != v)
363  {
364  // Fail incompatible versions
365  return false;
366  }
367  loadData(is, myOutputproperties);
368  loadData(is, myCamparmsattr);
369 
370  return true;
371  }
372 
373  Outputproperties getOutputproperties() const { return Outputproperties(myOutputproperties); }
374  void setOutputproperties(Outputproperties val) { myOutputproperties = int64(val); }
376  {
377  SOP_Node *thissop = cookparms.getNode();
378  if (!thissop) return getOutputproperties();
379  int64 result;
380  OP_Utils::evalOpParm(result, thissop, "outputproperties", cookparms.getCookTime(), 0);
381  return Outputproperties(result);
382  }
383  const UT_StringHolder & getCamparmsattr() const { return myCamparmsattr; }
384  void setCamparmsattr(const UT_StringHolder & val) { myCamparmsattr = val; }
386  {
387  SOP_Node *thissop = cookparms.getNode();
388  if (!thissop) return getCamparmsattr();
390  OP_Utils::evalOpParm(result, thissop, "camparmsattr", cookparms.getCookTime(), 0);
391  return result;
392  }
393 
394 private:
395  int64 myOutputproperties;
396  UT_StringHolder myCamparmsattr;
397 
398 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
type
Definition: core.h:556
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:403
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
void setOutputproperties(Outputproperties val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
GLboolean * data
Definition: glcorearb.h:131
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:495
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:63
GLsizei const GLfloat * value
Definition: glcorearb.h:824
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void saveData(std::ostream &os, UT_Vector2D v)
UT_StringHolder opCamparmsattr(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void loadData(UT_IStream &is, UT_Matrix3D &v)
const OP_Context & context() const
Definition: OP_NodeParms.h:97
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:669
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
GLdouble s
Definition: glad.h:3009
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, bool v)
**But if you need a result
Definition: thread.h:622
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
bool operator!=(const SOP_CameraToPointsParms &src) const
Outputproperties opOutputproperties(const SOP_NodeVerb::CookParms &cookparms) 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.
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void saveData(std::ostream &os, UT_StringHolder s)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:493
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:426
exint getNestNumParms(TempIndex idx) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void copyFrom(const OP_NodeParms *src) override
void loadFromOpSubclass(const LoadParms &loadparms) override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
exint length() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
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 UT_SharedPtr< UT_Ramp > &value) override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:497
static void saveData(std::ostream &os, UT_Matrix3D v)
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
static void saveData(std::ostream &os, PRM_DataItemHandle s)
ParmType getNestParmType(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void saveData(std::ostream &os, UT_Vector4D v)
const UT_StringHolder & getCamparmsattr() const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
long long int64
Definition: SYS_Types.h:116
const char * getNestParmName(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, int64 &v)
Outputproperties getOutputproperties() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:306
GT_API const UT_StringHolder version
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
fpreal64 fpreal
Definition: SYS_Types.h:283
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:499
GLuint GLfloat * val
Definition: glcorearb.h:1608
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
void setCamparmsattr(const UT_StringHolder &val)
#define SOP_API
Definition: SOP_API.h:10
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:432
void save(std::ostream &os) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, int64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
const char * findChar(int c) const
Definition: UT_String.h:1421
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void saveData(std::ostream &os, UT_Vector3D v)
bool isParmColorRamp(exint idx) const override
GLboolean r
Definition: glcorearb.h:1222
exint bread(uint8 *buffer, exint asize=1)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:667
SYS_FORCE_INLINE UT_StringHolder getToken(Outputproperties enum_value)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
static void loadData(UT_IStream &is, UT_Vector4D &v)
bool operator==(const SOP_CameraToPointsParms &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void saveData(std::ostream &os, fpreal64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:428
SYS_FORCE_INLINE bool isstring() const
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:665
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)