HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HOM_Defines.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Defines_h__
10 #define __HOM_Defines_h__
11 
12 #include <UT/UT_Assert.h>
13 
14 // Unfortunately, we can't compare against UT_ASSERT_LEVEL_PARANOID here,
15 // otherwise the comparison sometimes succeeds under swig when it shouldn't.
16 // So, we instead compare against the numeric value itself.
17 #if UT_ASSERT_LEVEL >= 2
18 #define HOM_DEBUG
19 #endif
20 
21 #ifdef SWIG
22 #define SWIGOUT(x) x
23 #else
24 #define SWIGOUT(x)
25 #endif
26 
27 #if defined(SWIG) && defined(SWIGPYTHON)
28 #define SWIGPYTHONOUT(x) x
29 #else
30 #define SWIGPYTHONOUT(x)
31 #endif
32 
33 // Define a synonym for hboost::any to customize a typemap for arguments that
34 // are to hold values to be inserted into a UT_Options object. SWIG allows
35 // typemaps to be defined for each typename independently.
36 #include <hboost/any.hpp>
37 typedef hboost::any HOM_UTOptionAny;
38 
39 // Define a synonym for hboost::any to customize a typemap for arguments that
40 // are to return drag-n-drop source data. SWIG allows typemaps to be defined
41 // for each typename independently.
42 typedef hboost::any HOM_DDSourceAny;
43 
44 #ifdef SWIG
45 
46 //----------------------------------------------------------------------------
47 
48 // Since there's no way for a C++ function to have varying return types,
49 // we need to add special methods and functions that are only known
50 // to swig. For python, there's a typemap for PyObject* so that when
51 // swig encounters a function returning that type it won't try to wrap
52 // the return value, and will instead send it directly to the interpreter.
53 // We create a typemap for this type so our code can use it instead of
54 // PyObject* directly so it's easier to use more than just python in the
55 // future.
56 
57 // The swig code we output directly to the swig wrapper below (using %{%})
58 // uses InterpreterObject, so we need to say what it is.
59 %{
60 #ifdef SWIGPYTHON
61 typedef PyObject *InterpreterObject;
62 
63 PyObject *HOMincRef(PyObject *object)
64 {
65  if (!object)
66  object = Py_None;
67  Py_INCREF(object);
68  return object;
69 }
70 #endif
71 %}
72 
73 // We need to tell swig what InterpreterObject is so it applies the PyObject*
74 // typemap properly.
75 typedef PyObject *InterpreterObject;
76 
77 //----------------------------------------------------------------------------
78 
79 %{
80 // These helper functions convert from C++ objects to corresponding
81 // interpreter objects (PyObject*'s in python). They're roughly the same
82 // as swig::from(), but swig::from() does a slow lookup on the name of the
83 // type. These functions know the type at compile-time so they're faster.
84 // Unfortunately, we need to explicitly specialize all the types supported by
85 // the functions. Specifically, since HOM_IterableList calls these functions,
86 // objects that can be inside HOM_IterableList need to be specialized below.
87 
88 // The general case is left unimplemented so we get compiler errors if
89 // we call the function with an unspecialized type.
90 template <typename T> InterpreterObject
91 HOMconvertValueForInterpreter(const T &value, int own);
92 
93 // These functions specialize the native data types.
94 template <> InterpreterObject
95 HOMconvertValueForInterpreter<int>(const int& value, int /*own*/)
96 { return SWIG_From_int(value); }
97 
98 template <> InterpreterObject
99 HOMconvertValueForInterpreter<float>(const float& value, int /*own*/)
100 { return SWIG_From_float(value); }
101 
102 template <> InterpreterObject
103 HOMconvertValueForInterpreter<double>(const double& value, int /*own*/)
104 { return SWIG_From_double(value); }
105 
106 template <> InterpreterObject
107 HOMconvertValueForInterpreter<std::string>(
108  const std::string& value, int /*own*/)
109 { return SWIG_From_std_string(value); }
110 
111 // These functions specialize base classes to return interpreter instances
112 // of the proper subclass.
113 template <> InterpreterObject
114 HOMconvertValueForInterpreter<HOM_Node*>(HOM_Node *const &node, int own)
115 {
116  PY_InterpreterAutoLock py_lock;
117  OP_OpTypeId optypeid;
118 
119  if (!node)
120  return SWIG_NewPointerObj(node, SWIGTYPE_p_HOM_Node, own);
121 
122  optypeid = (OP_OpTypeId)node->opTypeIdAsInt();
123  switch (optypeid)
124  {
125  case OBJ_OPTYPE_ID:
126  // Because of multiple inheritance, it's extremely important that
127  // we explicitly cast the pointer to a HOM_ObjNode so we
128  // pass the right address to SWIG_NewPointerObject, since it takes
129  // a void*.
130  return SWIG_NewPointerObj(
131  (void*)dynamic_cast<const HOM_ObjNode* const>(node),
132  SWIGTYPE_p_HOM_ObjNode, own);
133 
134  case SOP_OPTYPE_ID:
135  // Because of multiple inheritance, it's extremely important that
136  // we explicitly cast the pointer to a HOM_SopNode so we
137  // pass the right address to SWIG_NewPointerObject, since it takes
138  // a void*.
139  return SWIG_NewPointerObj(
140  (void*)dynamic_cast<const HOM_SopNode* const>(node),
141  SWIGTYPE_p_HOM_SopNode, own);
142 
143  case CHOP_OPTYPE_ID:
144  // Because of multiple inheritance, it's extremely important that
145  // we explicitly cast the pointer to a HOM_ChopNode so we
146  // pass the right address to SWIG_NewPointerObject, since it takes
147  // a void*.
148  return SWIG_NewPointerObj(
149  (void*)dynamic_cast<const HOM_ChopNode* const>(node),
150  SWIGTYPE_p_HOM_ChopNode, own);
151 
152  case COP2_OPTYPE_ID:
153  // Because of multiple inheritance, it's extremely important that
154  // we explicitly cast the pointer to a HOM_CopNode so we
155  // pass the right address to SWIG_NewPointerObject, since it takes
156  // a void*.
157  return SWIG_NewPointerObj(
158  (void*)dynamic_cast<const HOM_CopNode* const>(node),
159  SWIGTYPE_p_HOM_CopNode, own);
160 
161  case DOP_OPTYPE_ID:
162  // Because of multiple inheritance, it's extremely important that
163  // we explicitly cast the pointer to a HOM_DopNode so we
164  // pass the right address to SWIG_NewPointerObject, since it takes
165  // a void*.
166  return SWIG_NewPointerObj(
167  (void*)dynamic_cast<const HOM_DopNode* const>(node),
168  SWIGTYPE_p_HOM_DopNode, own);
169 
170  case POP_OPTYPE_ID:
171  // Because of multiple inheritance, it's extremely important that
172  // we explicitly cast the pointer to a HOM_PopNode so we
173  // pass the right address to SWIG_NewPointerObject, since it takes
174  // a void*.
175  return SWIG_NewPointerObj(
176  (void*)dynamic_cast<const HOM_PopNode* const>(node),
177  SWIGTYPE_p_HOM_PopNode, own);
178 
179  case POPNET_OPTYPE_ID:
180  // Because of multiple inheritance, it's extremely important that
181  // we explicitly cast the pointer to a HOM_PopNetNode so we
182  // pass the right address to SWIG_NewPointerObject, since it takes
183  // a void*.
184  return SWIG_NewPointerObj(
185  (void*)dynamic_cast<const HOM_PopNetNode* const>(node),
186  SWIGTYPE_p_HOM_PopNetNode, own);
187 
188  case SHOP_OPTYPE_ID:
189  // Because of multiple inheritance, it's extremely important that
190  // we explicitly cast the pointer to a HOM_ShopNode so we
191  // pass the right address to SWIG_NewPointerObject, since it takes
192  // a void*.
193  return SWIG_NewPointerObj(
194  (void*)dynamic_cast<const HOM_ShopNode* const>(node),
195  SWIGTYPE_p_HOM_ShopNode, own);
196 
197  case VOPNET_OPTYPE_ID:
198  // Because of multiple inheritance, it's extremely important that
199  // we explicitly cast the pointer to a HOM_VopNetNode so we
200  // pass the right address to SWIG_NewPointerObject, since it takes
201  // a void*.
202  return SWIG_NewPointerObj(
203  (void*)dynamic_cast<const HOM_VopNetNode* const>(node),
204  SWIGTYPE_p_HOM_VopNetNode, own);
205 
206  case ROP_OPTYPE_ID:
207  // Because of multiple inheritance, it's extremely important that
208  // we explicitly cast the pointer to a HOM_RopNode so we
209  // pass the right address to SWIG_NewPointerObject, since it takes
210  // a void*.
211  return SWIG_NewPointerObj(
212  (void*)dynamic_cast<const HOM_RopNode* const>(node),
213  SWIGTYPE_p_HOM_RopNode, own);
214 
215  case VOP_OPTYPE_ID:
216  // Because of multiple inheritance, it's extremely important that
217  // we explicitly cast the pointer to a HOM_VopNode so we
218  // pass the right address to SWIG_NewPointerObject, since it takes
219  // a void*.
220  return SWIG_NewPointerObj(
221  (void*)dynamic_cast<const HOM_VopNode* const>(node),
222  SWIGTYPE_p_HOM_VopNode, own);
223 
224  default:
225  break;
226  };
227 
228  return SWIG_NewPointerObj(node, SWIGTYPE_p_HOM_Node, own);
229 }
230 
231 template <> InterpreterObject
232 HOMconvertValueForInterpreter<HOM_NodeType*>(
233  HOM_NodeType *const &nodetype, int own)
234 {
235  PY_InterpreterAutoLock py_lock;
236  OP_OpTypeId optypeid;
237 
238  if (!nodetype)
239  return SWIG_NewPointerObj(nodetype, SWIGTYPE_p_HOM_NodeType, own);
240 
241  if( !nodetype->managerFlag() )
242  {
243  optypeid = (OP_OpTypeId)nodetype->opTypeIdAsInt();
244  switch (optypeid)
245  {
246  case SOP_OPTYPE_ID:
247  // Because of multiple inheritance, it's extremely important that
248  // we explicitly cast the pointer to a HOM_SopNodeType so we
249  // pass the right address to SWIG_NewPointerObject, since it takes
250  // a void*.
251  return SWIG_NewPointerObj(
252  (void*)dynamic_cast<const HOM_SopNodeType* const>(nodetype),
253  SWIGTYPE_p_HOM_SopNodeType, own);
254 
255  case SHOP_OPTYPE_ID:
256  // Because of multiple inheritance, it's extremely important that
257  // we explicitly cast the pointer to a HOM_ShopNodeType so we
258  // pass the right address to SWIG_NewPointerObject, since it takes
259  // a void*.
260  return SWIG_NewPointerObj(
261  (void*)dynamic_cast<const HOM_ShopNodeType* const>(nodetype),
262  SWIGTYPE_p_HOM_ShopNodeType, own);
263 
264  case VOP_OPTYPE_ID:
265  // Because of multiple inheritance, it's extremely important that
266  // we explicitly cast the pointer to a HOM_VopNodeType so we
267  // pass the right address to SWIG_NewPointerObject, since it takes
268  // a void*.
269  return SWIG_NewPointerObj(
270  (void*)dynamic_cast<const HOM_VopNodeType* const>(nodetype),
271  SWIGTYPE_p_HOM_VopNodeType, own);
272  default:
273  break;
274  }
275  }
276 
277  return SWIG_NewPointerObj(nodetype, SWIGTYPE_p_HOM_NodeType, own);
278 }
279 
280 template <> InterpreterObject
281 HOMconvertValueForInterpreter<HOM_BaseKeyframe*>(
282  HOM_BaseKeyframe *const &keyframe, int own)
283 {
284  PY_InterpreterAutoLock py_lock;
285 
286  if (!keyframe)
287  return SWIG_NewPointerObj(keyframe, SWIGTYPE_p_HOM_BaseKeyframe, own);
288 
289  if (keyframe->evaluatedType() == HOM_parmData::Float)
290  {
291  // Because of multiple inheritance, it's extremely important that
292  // we explicitly cast the pointer to a HOM_Keyframe so we
293  // pass the right address to SWIG_NewPointerObject, since it takes
294  // a void*.
295  return SWIG_NewPointerObj(
296  (void*)dynamic_cast<const HOM_Keyframe* const>(keyframe),
297  SWIGTYPE_p_HOM_Keyframe, own);
298  }
299  else if (keyframe->evaluatedType() == HOM_parmData::String)
300  {
301  // Because of multiple inheritance, it's extremely important that
302  // we explicitly cast the pointer to a HOM_Keyframe so we
303  // pass the right address to SWIG_NewPointerObject, since it takes
304  // a void*.
305  return SWIG_NewPointerObj(
306  (void*)dynamic_cast<const HOM_StringKeyframe* const>(keyframe),
307  SWIGTYPE_p_HOM_StringKeyframe, own);
308  }
309 
310  return SWIG_NewPointerObj(keyframe, SWIGTYPE_p_HOM_BaseKeyframe, own);
311 }
312 
313 template <> InterpreterObject
314 HOMconvertValueForInterpreter<HOM_PackedPrim*>(HOM_PackedPrim *const &prim, int own)
315 {
316  PY_InterpreterAutoLock py_lock;
317 
318  if (!prim)
319  return SWIG_NewPointerObj(prim, SWIGTYPE_p_HOM_PackedPrim, own);
320 
321  // Because of multiple inheritance, it's extremely important that
322  // we explicitly cast the pointer to the right HOM type so we
323  // pass the right address to SWIG_NewPointerObject, since it takes
324  // a void*.
325 
326  switch (prim->type().id())
327  {
328  case HOM_primType::Agent_Id:
329  return SWIG_NewPointerObj(
330  (void *)dynamic_cast<const HOM_Agent *const>(prim),
331  SWIGTYPE_p_HOM_Agent, own);
332 
333  case HOM_primType::PackedFragment_Id:
334  return SWIG_NewPointerObj(
335  (void *)dynamic_cast<const HOM_PackedFragment *const>(prim),
336  SWIGTYPE_p_HOM_PackedFragment, own);
337 
338  case HOM_primType::PackedGeometry_Id:
339  return SWIG_NewPointerObj(
340  (void *)dynamic_cast<const HOM_PackedGeometry *const>(prim),
341  SWIGTYPE_p_HOM_PackedGeometry, own);
342  }
343 
344  return SWIG_NewPointerObj(
345  (void *)dynamic_cast<const HOM_PackedPrim *const>(prim),
346  SWIGTYPE_p_HOM_PackedPrim, own);
347 }
348 
349 template <> InterpreterObject
350 HOMconvertValueForInterpreter<HOM_Prim*>(HOM_Prim *const &prim, int own)
351 {
352  PY_InterpreterAutoLock py_lock;
353 
354  if (!prim)
355  return SWIG_NewPointerObj(prim, SWIGTYPE_p_HOM_Prim, own);
356 
357  // Because of multiple inheritance, it's extremely important that
358  // we explicitly cast the pointer to the right HOM type so we
359  // pass the right address to SWIG_NewPointerObject, since it takes
360  // a void*.
361  HOM_PackedPrim * packed = dynamic_cast<HOM_PackedPrim *>(prim);
362  if(packed)
363  return HOMconvertValueForInterpreter(packed, own);
364 
365  switch (prim->type().id())
366  {
367  case HOM_primType::Polygon_Id:
368  return SWIG_NewPointerObj(
369  (void*)dynamic_cast<const HOM_Polygon* const>(prim),
370  SWIGTYPE_p_HOM_Polygon, own);
371 
372  case HOM_primType::NURBSCurve_Id:
373  case HOM_primType::BezierCurve_Id:
374  return SWIG_NewPointerObj(
375  (void*)dynamic_cast<const HOM_Face* const>(prim),
376  SWIGTYPE_p_HOM_Face, own);
377 
378  case HOM_primType::Mesh_Id:
379  case HOM_primType::NURBSSurface_Id:
380  case HOM_primType::BezierSurface_Id:
381  return SWIG_NewPointerObj(
382  (void*)dynamic_cast<const HOM_Surface* const>(prim),
383  SWIGTYPE_p_HOM_Surface, own);
384 
385  case HOM_primType::Circle_Id:
386  case HOM_primType::Sphere_Id:
387  case HOM_primType::Tube_Id:
388  return SWIG_NewPointerObj(
389  (void*)dynamic_cast<const HOM_Quadric* const>(prim),
390  SWIGTYPE_p_HOM_Quadric, own);
391 
392  case HOM_primType::Volume_Id:
393  return SWIG_NewPointerObj(
394  (void*)dynamic_cast<const HOM_Volume* const>(prim),
395  SWIGTYPE_p_HOM_Volume, own);
396 
397  case HOM_primType::VDB_Id:
398  return SWIG_NewPointerObj(
399  (void*)dynamic_cast<const HOM_VDB* const>(prim),
400  SWIGTYPE_p_HOM_VDB, own);
401 
402  // TODO: Support more primitive types.
403  }
404 
405  return SWIG_NewPointerObj(prim, SWIGTYPE_p_HOM_Prim, own);
406 }
407 
408 template <> InterpreterObject
409 HOMconvertValueForInterpreter<HOM_ParmTemplate*>(
410  HOM_ParmTemplate *const &parm_template, int own)
411 {
412  PY_InterpreterAutoLock py_lock;
413 
414  if (!parm_template)
415  return SWIG_NewPointerObj(
416  parm_template, SWIGTYPE_p_HOM_ParmTemplate, own);
417 
418  // Because of multiple inheritance, it's extremely important that we
419  // explicitly cast to a pointer to the subclass so we pass the right
420  // address to SWIG_NewPointerObject, since it takes a void*.
421  switch (parm_template->type().id())
422  {
423  case HOM_parmTemplateType::Int_Id:
424  return SWIG_NewPointerObj(
425  (void*)dynamic_cast<const HOM_IntParmTemplate* const>(
426  parm_template),
427  SWIGTYPE_p_HOM_IntParmTemplate, own);
428 
429  case HOM_parmTemplateType::Float_Id:
430  return SWIG_NewPointerObj(
431  (void*)dynamic_cast<const HOM_FloatParmTemplate* const>(
432  parm_template),
433  SWIGTYPE_p_HOM_FloatParmTemplate, own);
434 
435  case HOM_parmTemplateType::String_Id:
436  return SWIG_NewPointerObj(
437  (void*)dynamic_cast<const HOM_StringParmTemplate* const>(
438  parm_template),
439  SWIGTYPE_p_HOM_StringParmTemplate, own);
440 
441  case HOM_parmTemplateType::Data_Id:
442  return SWIG_NewPointerObj(
443  (void*)dynamic_cast<const HOM_DataParmTemplate* const>(
444  parm_template),
445  SWIGTYPE_p_HOM_DataParmTemplate, own);
446 
447  case HOM_parmTemplateType::Toggle_Id:
448  return SWIG_NewPointerObj(
449  (void*)dynamic_cast<const HOM_ToggleParmTemplate* const>(
450  parm_template),
451  SWIGTYPE_p_HOM_ToggleParmTemplate, own);
452 
453  case HOM_parmTemplateType::Menu_Id:
454  return SWIG_NewPointerObj(
455  (void*)dynamic_cast<const HOM_MenuParmTemplate* const>(
456  parm_template),
457  SWIGTYPE_p_HOM_MenuParmTemplate, own);
458 
459  case HOM_parmTemplateType::Button_Id:
460  return SWIG_NewPointerObj(
461  (void*)dynamic_cast<const HOM_ButtonParmTemplate* const>(
462  parm_template),
463  SWIGTYPE_p_HOM_ButtonParmTemplate, own);
464 
465  case HOM_parmTemplateType::Label_Id:
466  return SWIG_NewPointerObj(
467  (void*)dynamic_cast<const HOM_LabelParmTemplate* const>(
468  parm_template),
469  SWIGTYPE_p_HOM_LabelParmTemplate, own);
470 
471  case HOM_parmTemplateType::Separator_Id:
472  return SWIG_NewPointerObj(
473  (void*)dynamic_cast<const HOM_SeparatorParmTemplate* const>(
474  parm_template),
475  SWIGTYPE_p_HOM_SeparatorParmTemplate, own);
476 
477  case HOM_parmTemplateType::FolderSet_Id:
478  return SWIG_NewPointerObj(
479  (void*)dynamic_cast<const HOM_FolderSetParmTemplate* const>(
480  parm_template),
481  SWIGTYPE_p_HOM_FolderSetParmTemplate, own);
482 
483  case HOM_parmTemplateType::Folder_Id:
484  return SWIG_NewPointerObj(
485  (void*)dynamic_cast<const HOM_FolderParmTemplate* const>(
486  parm_template),
487  SWIGTYPE_p_HOM_FolderParmTemplate, own);
488 
489  case HOM_parmTemplateType::Ramp_Id:
490  return SWIG_NewPointerObj(
491  (void*)dynamic_cast<const HOM_RampParmTemplate* const>(
492  parm_template),
493  SWIGTYPE_p_HOM_RampParmTemplate, own);
494  };
495 
496  UT_ASSERT(!"Unknown parm template type");
497  return SWIG_NewPointerObj(parm_template, SWIGTYPE_p_HOM_ParmTemplate, own);
498 }
499 
500 template <> InterpreterObject
501 HOMconvertValueForInterpreter<HOM_PaneTab*>(
502  HOM_PaneTab *const &pane_tab, int own)
503 {
504  PY_InterpreterAutoLock py_lock;
505 
506  if (!pane_tab)
507  return SWIG_NewPointerObj(pane_tab, SWIGTYPE_p_HOM_PaneTab, own);
508 
509  // Because of multiple inheritance, it's extremely important that
510  // we explicitly cast the pointer to the HOM type so we pass the right
511  // address to SWIG_NewPointerObject, since it takes a void*.
512 
513  switch (pane_tab->type().id())
514  {
515  case HOM_paneTabType::ContextViewer_Id:
516  return SWIG_NewPointerObj(
517  (void*)dynamic_cast<const HOM_ContextViewer* const>(pane_tab),
518  SWIGTYPE_p_HOM_ContextViewer, own);
519 
520  case HOM_paneTabType::SceneViewer_Id:
521  return SWIG_NewPointerObj(
522  (void*)dynamic_cast<const HOM_SceneViewer* const>(pane_tab),
523  SWIGTYPE_p_HOM_SceneViewer, own);
524 
525  case HOM_paneTabType::CompositorViewer_Id:
526  return SWIG_NewPointerObj(
527  (void*)dynamic_cast<const HOM_CompositorViewer* const>(pane_tab),
528  SWIGTYPE_p_HOM_CompositorViewer, own);
529 
530  case HOM_paneTabType::NetworkEditor_Id:
531  return SWIG_NewPointerObj(
532  (void*)dynamic_cast<const HOM_NetworkEditor* const>(pane_tab),
533  SWIGTYPE_p_HOM_NetworkEditor, own);
534 
535  case HOM_paneTabType::HelpBrowser_Id:
536  return SWIG_NewPointerObj(
537  (void*)dynamic_cast<const HOM_HelpBrowser* const>(pane_tab),
538  SWIGTYPE_p_HOM_HelpBrowser, own);
539 
540  case HOM_paneTabType::PythonPanel_Id:
541  return SWIG_NewPointerObj(
542  (void*)dynamic_cast<const HOM_PythonPanel* const>(pane_tab),
543  SWIGTYPE_p_HOM_PythonPanel, own);
544 
545  case HOM_paneTabType::IPRViewer_Id:
546  return SWIG_NewPointerObj(
547  (void*)dynamic_cast<const HOM_IPRViewer* const>(pane_tab),
548  SWIGTYPE_p_HOM_IPRViewer, own);
549 
550  case HOM_paneTabType::AssetBrowser_Id:
551  return SWIG_NewPointerObj(
552  (void*)dynamic_cast<const HOM_AssetBrowser* const>(pane_tab),
553  SWIGTYPE_p_HOM_AssetBrowser, own);
554 
555  case HOM_paneTabType::PerformanceMonitor_Id:
556  return SWIG_NewPointerObj(
557  (void*)dynamic_cast<const HOM_PerformanceMonitor* const>(pane_tab),
558  SWIGTYPE_p_HOM_PerformanceMonitor, own);
559 
560  case HOM_paneTabType::ChannelEditor_Id:
561  return SWIG_NewPointerObj(
562  (void*)dynamic_cast<const HOM_ChannelEditorPane* const>(pane_tab),
563  SWIGTYPE_p_HOM_ChannelEditorPane, own);
564 
565  case HOM_paneTabType::DataTree_Id:
566  return SWIG_NewPointerObj(
567  (void*)dynamic_cast<const HOM_DataTree* const>(pane_tab),
568  SWIGTYPE_p_HOM_DataTree, own);
569 
570  case HOM_paneTabType::ChannelViewer_Id:
571  case HOM_paneTabType::OutputViewer_Id:
572  case HOM_paneTabType::ShaderViewer_Id:
573  case HOM_paneTabType::Parm_Id:
574  case HOM_paneTabType::DetailsView_Id:
575  case HOM_paneTabType::TreeView_Id:
576  return SWIG_NewPointerObj(
577  (void*)dynamic_cast<const HOM_PathBasedPaneTab* const>(pane_tab),
578  SWIGTYPE_p_HOM_PathBasedPaneTab, own);
579 
580  case HOM_paneTabType::ChannelList_Id:
581  case HOM_paneTabType::Textport_Id:
582  case HOM_paneTabType::PythonShell_Id:
583  case HOM_paneTabType::HandleList_Id:
584  case HOM_paneTabType::BundleList_Id:
585  case HOM_paneTabType::TakeList_Id:
586  case HOM_paneTabType::ParmSpreadsheet_Id:
587  case HOM_paneTabType::LightLinker_Id:
588  case HOM_paneTabType::MaterialPalette_Id:
589  return SWIG_NewPointerObj(pane_tab, SWIGTYPE_p_HOM_PaneTab, own);
590  };
591 
592  UT_ASSERT(!"Unknown pane tab type");
593  return SWIG_NewPointerObj(pane_tab, SWIGTYPE_p_HOM_PaneTab, own);
594 }
595 
596 template <> InterpreterObject
597 HOMconvertValueForInterpreter<HOM_SopVerb*>(
598  HOM_SopVerb *const &verb, int own)
599 {
600  PY_InterpreterAutoLock py_lock;
601 
602  return SWIG_NewPointerObj(verb, SWIGTYPE_p_HOM_SopVerb, own);
603 }
604 
605 template <> InterpreterObject
606 HOMconvertValueForInterpreter<HOM_Geometry*>(
607  HOM_Geometry *const &geo, int own)
608 {
609  PY_InterpreterAutoLock py_lock;
610 
611  return SWIG_NewPointerObj(geo, SWIGTYPE_p_HOM_Geometry, own);
612 }
613 
614 template <> InterpreterObject
615 HOMconvertValueForInterpreter<HOM_NetworkItem*>(
616  HOM_NetworkItem *const &item, int own)
617 {
618  PY_InterpreterAutoLock py_lock;
619 
620  if (item)
621  {
622  switch (item->networkItemType().id())
623  {
624  case HOM_networkItemType::Node_Id:
625  // We know its a node, but we need to convert to the specific
626  // node type referred to by this item.
627  return HOMconvertValueForInterpreter(
628  dynamic_cast<HOM_Node* const>(item), own);
629 
630  case HOM_networkItemType::NetworkBox_Id:
631  return SWIG_NewPointerObj(
632  (void*)dynamic_cast<const HOM_NetworkBox* const>(item),
633  SWIGTYPE_p_HOM_NetworkBox, own);
634 
635  case HOM_networkItemType::StickyNote_Id:
636  return SWIG_NewPointerObj(
637  (void*)dynamic_cast<const HOM_StickyNote* const>(item),
638  SWIGTYPE_p_HOM_StickyNote, own);
639 
640  case HOM_networkItemType::SubnetIndirectInput_Id:
641  return SWIG_NewPointerObj(
642  (void*)dynamic_cast<const HOM_SubnetIndirectInput* const>(item),
643  SWIGTYPE_p_HOM_SubnetIndirectInput, own);
644 
645  case HOM_networkItemType::Connection_Id:
646  return SWIG_NewPointerObj(
647  (void*)dynamic_cast<const HOM_NodeConnection* const>(item),
648  SWIGTYPE_p_HOM_NodeConnection, own);
649 
650  case HOM_networkItemType::NetworkDot_Id:
651  return SWIG_NewPointerObj(
652  (void*)dynamic_cast<const HOM_NetworkDot* const>(item),
653  SWIGTYPE_p_HOM_NetworkDot, own);
654 
655  default:
656  break;
657  };
658  }
659 
660  return SWIG_NewPointerObj(item, SWIGTYPE_p_HOM_NetworkItem, own);
661 }
662 
663 template <> InterpreterObject
664 HOMconvertValueForInterpreter<HOM_NetworkMovableItem*>(
665  HOM_NetworkMovableItem *const &item, int own)
666 {
667  PY_InterpreterAutoLock py_lock;
668 
669  if (!item)
670  return SWIG_NewPointerObj(item, SWIGTYPE_p_HOM_NetworkMovableItem, own);
671 
672  return HOMconvertValueForInterpreter<HOM_NetworkItem *>(item, own);
673 }
674 
675 template <> InterpreterObject
676 HOMconvertValueForInterpreter<
677  std::vector<HOM_ElemPtr<HOM_NodeConnection> >*>(
678  std::vector<HOM_ElemPtr<HOM_NodeConnection> > *const &list,
679  int own)
680 {
681  return swig::from(*list);
682 }
683 
684 template <> InterpreterObject
685 HOMconvertValueForInterpreter<HOM_DopData*>(HOM_DopData *const &data, int own)
686 {
687  PY_InterpreterAutoLock py_lock;
688 
689  const HOM_DopObject *const dop_object =
690  dynamic_cast<const HOM_DopObject *const>(data);
691  if (dop_object)
692  return SWIG_NewPointerObj(
693  (void *)dop_object, SWIGTYPE_p_HOM_DopObject, own);
694 
695  const HOM_DopRelationship *const dop_relationship =
696  dynamic_cast<const HOM_DopRelationship *const>(data);
697  if (dop_relationship)
698  return SWIG_NewPointerObj(
699  (void *)dop_relationship, SWIGTYPE_p_HOM_DopRelationship, own);
700 
701  return SWIG_NewPointerObj(data, SWIGTYPE_p_HOM_DopData, own);
702 }
703 
704 // These functions specialize pointers to other classes. If a class is
705 // used inside HOM_IterableList or HOM_ElemPtr, it must be listed here.
706 #define HOM_PROVIDE_SWIG_LOOKUP(type) \
707  template <> InterpreterObject HOMconvertValueForInterpreter<type*>( \
708  type* const& value, int own) \
709  { \
710  PY_InterpreterAutoLock py_lock; \
711  return SWIG_NewPointerObj(SWIG_as_voidptr(value), \
712  SWIGTYPE_p_ ## type, own); \
713  }
714 
715 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentClip)
716 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentDefinition)
717 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentLayer)
718 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentShape)
719 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentShapeBinding)
720 HOM_PROVIDE_SWIG_LOOKUP(HOM_AgentTransformGroup)
721 HOM_PROVIDE_SWIG_LOOKUP(HOM_Attrib)
722 HOM_PROVIDE_SWIG_LOOKUP(HOM_Desktop)
723 HOM_PROVIDE_SWIG_LOOKUP(HOM_Dialog)
724 HOM_PROVIDE_SWIG_LOOKUP(HOM_DopRecord)
725 HOM_PROVIDE_SWIG_LOOKUP(HOM_FloatingPanel)
726 HOM_PROVIDE_SWIG_LOOKUP(HOM_Gallery)
727 HOM_PROVIDE_SWIG_LOOKUP(HOM_GalleryEntry)
728 HOM_PROVIDE_SWIG_LOOKUP(HOM_GeometrySelection)
729 HOM_PROVIDE_SWIG_LOOKUP(HOM_GeometryViewport)
730 HOM_PROVIDE_SWIG_LOOKUP(HOM_HDADefinition)
731 HOM_PROVIDE_SWIG_LOOKUP(HOM_HDASection)
732 HOM_PROVIDE_SWIG_LOOKUP(HOM_IndexPairPropertyTable)
733 HOM_PROVIDE_SWIG_LOOKUP(HOM_Matrix2)
734 HOM_PROVIDE_SWIG_LOOKUP(HOM_Matrix3)
735 HOM_PROVIDE_SWIG_LOOKUP(HOM_Matrix4)
736 HOM_PROVIDE_SWIG_LOOKUP(HOM_NetworkBox)
737 HOM_PROVIDE_SWIG_LOOKUP(HOM_NetworkDot)
738 HOM_PROVIDE_SWIG_LOOKUP(HOM_NodeBundle)
739 HOM_PROVIDE_SWIG_LOOKUP(HOM_NodeConnection)
740 HOM_PROVIDE_SWIG_LOOKUP(HOM_NodeGroup)
741 HOM_PROVIDE_SWIG_LOOKUP(HOM_Pane)
742 HOM_PROVIDE_SWIG_LOOKUP(HOM_Parm)
743 HOM_PROVIDE_SWIG_LOOKUP(HOM_ParmTuple)
744 HOM_PROVIDE_SWIG_LOOKUP(HOM_Point)
745 HOM_PROVIDE_SWIG_LOOKUP(HOM_Polygon)
746 HOM_PROVIDE_SWIG_LOOKUP(HOM_PythonPanelInterface)
747 HOM_PROVIDE_SWIG_LOOKUP(HOM_Edge)
748 HOM_PROVIDE_SWIG_LOOKUP(HOM_PointGroup)
749 HOM_PROVIDE_SWIG_LOOKUP(HOM_PrimGroup)
750 HOM_PROVIDE_SWIG_LOOKUP(HOM_EdgeGroup)
751 HOM_PROVIDE_SWIG_LOOKUP(HOM_Quaternion)
752 HOM_PROVIDE_SWIG_LOOKUP(HOM_RadialItem)
753 HOM_PROVIDE_SWIG_LOOKUP(HOM_RadialSubmenu)
754 HOM_PROVIDE_SWIG_LOOKUP(HOM_RadialMenu)
755 HOM_PROVIDE_SWIG_LOOKUP(HOM_Ramp)
756 HOM_PROVIDE_SWIG_LOOKUP(HOM_Selection)
757 HOM_PROVIDE_SWIG_LOOKUP(HOM_Selector)
758 HOM_PROVIDE_SWIG_LOOKUP(HOM_Shelf)
759 HOM_PROVIDE_SWIG_LOOKUP(HOM_ShelfSet)
760 HOM_PROVIDE_SWIG_LOOKUP(HOM_StickyNote)
761 HOM_PROVIDE_SWIG_LOOKUP(HOM_SubnetIndirectInput)
762 HOM_PROVIDE_SWIG_LOOKUP(HOM_Take)
763 HOM_PROVIDE_SWIG_LOOKUP(HOM_Tool)
764 HOM_PROVIDE_SWIG_LOOKUP(HOM_Track)
765 HOM_PROVIDE_SWIG_LOOKUP(HOM_Vector2)
766 HOM_PROVIDE_SWIG_LOOKUP(HOM_Vector3)
767 HOM_PROVIDE_SWIG_LOOKUP(HOM_Vector4)
768 HOM_PROVIDE_SWIG_LOOKUP(HOM_Vertex)
769 HOM_PROVIDE_SWIG_LOOKUP(HOM_VexContext)
770 HOM_PROVIDE_SWIG_LOOKUP(HOM_ViewerState)
771 HOM_PROVIDE_SWIG_LOOKUP(HOM_ViewportVisualizer)
772 HOM_PROVIDE_SWIG_LOOKUP(HOM_ViewportVisualizerType)
773 
774 %}
775 
776 //----------------------------------------------------------------------------
777 
778 // We create typemaps for base classes that appear as return types to make
779 // sure swig instances the proper subclasses in the interpreter.
780 %typemap(out) HOM_Prim* {
781  $result = HOMconvertValueForInterpreter($1, $owner);
782 }
783 
784 %typemap(out) HOM_PackedPrim* {
785  $result = HOMconvertValueForInterpreter($1, $owner);
786 }
787 
788 %typemap(out) HOM_Node* {
789  $result = HOMconvertValueForInterpreter($1, $owner);
790 }
791 
792 %typemap(out) HOM_NodeType* {
793  $result = HOMconvertValueForInterpreter($1, $owner);
794 }
795 
796 %typemap(out) HOM_BaseKeyframe* {
797  $result = HOMconvertValueForInterpreter($1, $owner);
798 }
799 
800 %typemap(out) HOM_ParmTemplate* {
801  $result = HOMconvertValueForInterpreter($1, $owner);
802 }
803 
804 %typemap(out) HOM_Pane* {
805  $result = HOMconvertValueForInterpreter($1, $owner);
806 }
807 
808 %typemap(out) HOM_PaneTab* {
809  $result = HOMconvertValueForInterpreter($1, $owner);
810 }
811 
812 %typemap(out) HOM_DopData* {
813  $result = HOMconvertValueForInterpreter($1, $owner);
814 }
815 
816 %typemap(out) HOM_NetworkMovableItem* {
817  $result = HOMconvertValueForInterpreter($1, $owner);
818 }
819 
820 %typemap(out) HOM_NetworkItem* {
821  $result = HOMconvertValueForInterpreter($1, $owner);
822 }
823 
824 %typemap(out) std::vector<HOM_ElemPtr<HOM_NodeConnection> > * {
825  $result = HOMconvertValueForInterpreter($1, $owner);
826 }
827 
828 //----------------------------------------------------------------------------
829 
830 // These typemaps convert HOM exceptions into corresponding python standard
831 // exceptions.
832 %typemap(throws) HOM_TypeError %{
833  SWIG_exception_fail(SWIG_TypeError, $1.instanceMessage().c_str());
834 %}
835 
836 %typemap(throws) HOM_ValueError %{
837  SWIG_exception_fail(SWIG_ValueError, $1.instanceMessage().c_str());
838 %}
839 
840 #ifdef SWIGPYTHON
841 %typemap(throws) HOM_SystemExit %{
842  PyErr_SetObject(PyExc_SystemExit, SWIG_From_int($1.code()));
843  SWIG_fail;
844 %}
845 #endif
846 
847 //----------------------------------------------------------------------------
848 
849 // This typemap lets you declare a hboost::any parameter and swig will convert
850 // the interpreter (Python) object to a hboost::any that wraps the C++ data
851 // type.
852 %typemap(in) hboost::any {
853  // Note that if we can't convert to a hboost::any, we leave the hboost::any
854  // as empty (i.e. its empty() method returns true).
855  HOMinterpreterObjectToBoostAny($input, $1);
856 }
857 
858 // This typemap lets you declare a HOM_UTOptionAny (hboost::any) parameter and
859 // swig will convert the interpreter (Python) object into the C++ data type
860 // for interpreter objects that correspond to a UT_OptionType.
861 %typemap(in) HOM_UTOptionAny {
862  // Note that if we can't convert to a hboost::any, we leave the hboost::any
863  // as empty (i.e. its empty() method returns true).
864  HOMinterpreterObjectToUTOptionAny($input, $1);
865 }
866 
867 // This typemap lets you return hboost::any objects.
868 %typemap(out) hboost::any {
869  $result = HOMboostAnyToInterpreterObject($1);
870 }
871 
872 %typemap(out) HOM_DDSourceAny {
873  $result = HOMDDSourceAnyToInterpreterObject($1);
874 }
875 
876 //----------------------------------------------------------------------------
877 
878 #ifdef SWIGPYTHON
879 %typemap(out) PY_OpaqueObject {
880  $result = HOMincRef((InterpreterObject)$1.opaqueObject());
881 }
882 #endif
883 
884 // For whatever reason, adding the typemap does not customize swig::from(),
885 // so we do that manually.
886 %{
887 #ifdef SWIGPYTHON
888 namespace swig {
889  template <>
890  struct traits_from<PY_OpaqueObject>
891  {
892  static PyObject *from(const PY_OpaqueObject &val)
893  {
894  return HOMincRef((InterpreterObject)val.opaqueObject());
895  }
896  };
897 }
898 #endif
899 
900 //----------------------------------------------------------------------------
901 
902 // This helper function takes an interpreter (Python) object and converts it
903 // into a hboost::any object. It returns whether or not the conversion was
904 // possible, and leaves the hboost::any unchanged if a conversion wasn't
905 // possible.
906 bool
907 HOMinterpreterObjectToBoostAny(InterpreterObject input, hboost::any &result)
908 {
909 #ifdef SWIGPYTHON
910  if (input == Py_None)
911  {
912  result = (void *)NULL;
913  return true;
914  }
915 
916  // SWIG_AsVal_bool is too permissive, and treats thinks that an integer
917  // is a bool. So, we explicitly check against True and False.
918  if (input == Py_True)
919  {
920  result = true;
921  return true;
922  }
923 
924  if (input == Py_False)
925  {
926  result = false;
927  return true;
928  }
929 #endif
930 
931  int int_result;
932  if (SWIG_IsOK(SWIG_AsVal_int(input, &int_result)))
933  {
934  result = int_result;
935  return true;
936  }
937 
938  double double_result;
939  if (SWIG_IsOK(SWIG_AsVal_double(input, &double_result)))
940  {
941  result = double_result;
942  return true;
943  }
944 
945  std::string string_result;
946  if (SWIG_IsOK(SWIG_AsVal_std_string(input, &string_result)))
947  {
948  result = string_result;
949  return true;
950  }
951 
952  void *geometry_result = NULL;
953  if (SWIG_IsOK(SWIG_ConvertPtr(input, &geometry_result,
954  SWIGTYPE_p_HOM_Geometry, 0)) && geometry_result)
955  {
956  result = reinterpret_cast<HOM_Geometry *>(geometry_result);
957  return true;
958  }
959 
960  void *ramp_result = NULL;
961  if (SWIG_IsOK(SWIG_ConvertPtr(input, &ramp_result,
962  SWIGTYPE_p_HOM_Ramp, 0)) && ramp_result)
963  {
964  result = reinterpret_cast<HOM_Ramp *>(ramp_result);
965  return true;
966  }
967 
968  std::vector<int> *int_vector_ptr = NULL;
969  if (SWIG_IsOK(swig::asptr(input, (std::vector<int> **)NULL)) &&
970  SWIG_IsOK(swig::asptr(input, &int_vector_ptr)))
971  {
972  result = *int_vector_ptr;
973  delete int_vector_ptr;
974  return true;
975  }
976 
977  std::vector<double> *double_vector_ptr = NULL;
978  if (SWIG_IsOK(swig::asptr(input, (std::vector<double> **)NULL)) &&
979  SWIG_IsOK(swig::asptr(input, &double_vector_ptr)))
980  {
981  result = *double_vector_ptr;
982  delete double_vector_ptr;
983  return true;
984  }
985 
986  std::vector<std::string> *string_vector_ptr = NULL;
987  if (SWIG_IsOK(swig::asptr(input, (std::vector<std::string> **)NULL)) &&
988  SWIG_IsOK(swig::asptr(input, &string_vector_ptr)))
989  {
990  result = *string_vector_ptr;
991  delete string_vector_ptr;
992  return true;
993  }
994 
995  std::vector<HOM_Vector2> *vector2_vector_ptr = NULL;
996  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector2> **)NULL)) &&
997  SWIG_IsOK(swig::asptr(input, &vector2_vector_ptr)))
998  {
999  result = *vector2_vector_ptr;
1000  delete vector2_vector_ptr;
1001  return true;
1002  }
1003 
1004  std::vector<HOM_Vector3> *vector3_vector_ptr = NULL;
1005  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector3> **)NULL)) &&
1006  SWIG_IsOK(swig::asptr(input, &vector3_vector_ptr)))
1007  {
1008  result = *vector3_vector_ptr;
1009  delete vector3_vector_ptr;
1010  return true;
1011  }
1012 
1013  std::vector<HOM_Vector4> *vector4_vector_ptr = NULL;
1014  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector4> **)NULL)) &&
1015  SWIG_IsOK(swig::asptr(input, &vector4_vector_ptr)))
1016  {
1017  result = *vector4_vector_ptr;
1018  delete vector4_vector_ptr;
1019  return true;
1020  }
1021 
1022  std::vector<HOM_Matrix2> *matrix2_vector_ptr = NULL;
1023  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix2> **)NULL)) &&
1024  SWIG_IsOK(swig::asptr(input, &matrix2_vector_ptr)))
1025  {
1026  result = *matrix2_vector_ptr;
1027  delete matrix2_vector_ptr;
1028  return true;
1029  }
1030 
1031  std::vector<HOM_Matrix3> *matrix3_vector_ptr = NULL;
1032  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix3> **)NULL)) &&
1033  SWIG_IsOK(swig::asptr(input, &matrix3_vector_ptr)))
1034  {
1035  result = *matrix3_vector_ptr;
1036  delete matrix3_vector_ptr;
1037  return true;
1038  }
1039 
1040  std::vector<HOM_Matrix4> *matrix4_vector_ptr = NULL;
1041  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix4> **)NULL)) &&
1042  SWIG_IsOK(swig::asptr(input, &matrix4_vector_ptr)))
1043  {
1044  result = *matrix4_vector_ptr;
1045  delete matrix4_vector_ptr;
1046  return true;
1047  }
1048 
1049  UT_ASSERT(result.empty());
1050  return false;
1051 }
1052 
1053 // This helper function takes an interpreter (Python) object and converts it
1054 // into a HOM_UTOptionAny (hboost::any) object. It returns whether or not the
1055 // conversion was possible, and leaves the HOM_UTOptionAny unchanged if a
1056 // conversion wasn't possible.
1057 bool
1058 HOMinterpreterObjectToUTOptionAny(InterpreterObject input,
1059  HOM_UTOptionAny &result)
1060 {
1061 #ifdef SWIGPYTHON
1062  if (input == Py_None)
1063  {
1064  result = (void *)NULL;
1065  return true;
1066  }
1067 
1068  // SWIG_AsVal_bool is too permissive, and treats thinks that an integer
1069  // is a bool. So, we explicitly check against True and False.
1070  if (input == Py_True)
1071  {
1072  result = true;
1073  return true;
1074  }
1075 
1076  if (input == Py_False)
1077  {
1078  result = false;
1079  return true;
1080  }
1081 #endif
1082 
1083  int int_result;
1084  if (SWIG_IsOK(SWIG_AsVal_int(input, &int_result)))
1085  {
1086  result = int_result;
1087  return true;
1088  }
1089 
1090  double double_result;
1091  if (SWIG_IsOK(SWIG_AsVal_double(input, &double_result)))
1092  {
1093  result = double_result;
1094  return true;
1095  }
1096 
1097  std::string string_result;
1098  if (SWIG_IsOK(SWIG_AsVal_std_string(input, &string_result)))
1099  {
1100  result = string_result;
1101  return true;
1102  }
1103 
1104  void *vector2_result = NULL;
1105  if (SWIG_IsOK(SWIG_ConvertPtr(input, &vector2_result,
1106  SWIGTYPE_p_HOM_Vector2, 0)) && vector2_result)
1107  {
1108  result = reinterpret_cast<HOM_Vector2 *>(vector2_result);
1109  return true;
1110  }
1111 
1112  void *vector3_result = NULL;
1113  if (SWIG_IsOK(SWIG_ConvertPtr(input, &vector3_result,
1114  SWIGTYPE_p_HOM_Vector3, 0)) && vector3_result)
1115  {
1116  result = reinterpret_cast<HOM_Vector3 *>(vector3_result);
1117  return true;
1118  }
1119 
1120  void *vector4_result = NULL;
1121  if (SWIG_IsOK(SWIG_ConvertPtr(input, &vector4_result,
1122  SWIGTYPE_p_HOM_Vector4, 0)) && vector4_result)
1123  {
1124  result = reinterpret_cast<HOM_Vector4 *>(vector4_result);
1125  return true;
1126  }
1127 
1128  void *quat_result = NULL;
1129  if (SWIG_IsOK(SWIG_ConvertPtr(input, &quat_result,
1130  SWIGTYPE_p_HOM_Quaternion, 0)) && quat_result)
1131  {
1132  result = reinterpret_cast<HOM_Quaternion *>(quat_result);
1133  return true;
1134  }
1135 
1136  void *matrix2_result = NULL;
1137  if (SWIG_IsOK(SWIG_ConvertPtr(input, &matrix2_result,
1138  SWIGTYPE_p_HOM_Matrix2, 0)) && matrix2_result)
1139  {
1140  result = reinterpret_cast<HOM_Matrix2 *>(matrix2_result);
1141  return true;
1142  }
1143 
1144  void *matrix3_result = NULL;
1145  if (SWIG_IsOK(SWIG_ConvertPtr(input, &matrix3_result,
1146  SWIGTYPE_p_HOM_Matrix3, 0)) && matrix3_result)
1147  {
1148  result = reinterpret_cast<HOM_Matrix3 *>(matrix3_result);
1149  return true;
1150  }
1151 
1152  void *matrix4_result = NULL;
1153  if (SWIG_IsOK(SWIG_ConvertPtr(input, &matrix4_result,
1154  SWIGTYPE_p_HOM_Matrix4, 0)) && matrix4_result)
1155  {
1156  result = reinterpret_cast<HOM_Matrix4 *>(matrix4_result);
1157  return true;
1158  }
1159 
1160  void *geometry_result = NULL;
1161  if (SWIG_IsOK(SWIG_ConvertPtr(input, &geometry_result,
1162  SWIGTYPE_p_HOM_Geometry, 0)) && geometry_result)
1163  {
1164  result = reinterpret_cast<HOM_Geometry *>(geometry_result);
1165  return true;
1166  }
1167 
1168  void *ramp_result = NULL;
1169  if (SWIG_IsOK(SWIG_ConvertPtr(input, &ramp_result,
1170  SWIGTYPE_p_HOM_Ramp, 0)) && ramp_result)
1171  {
1172  result = reinterpret_cast<HOM_Ramp *>(ramp_result);
1173  return true;
1174  }
1175 
1176  std::vector<int> *int_vector_ptr = NULL;
1177  if (SWIG_IsOK(swig::asptr(input, (std::vector<int> **)NULL)) &&
1178  SWIG_IsOK(swig::asptr(input, &int_vector_ptr)))
1179  {
1180  result = *int_vector_ptr;
1181  delete int_vector_ptr;
1182  return true;
1183  }
1184 
1185  std::vector<double> *double_vector_ptr = NULL;
1186  if (SWIG_IsOK(swig::asptr(input, (std::vector<double> **)NULL)) &&
1187  SWIG_IsOK(swig::asptr(input, &double_vector_ptr)))
1188  {
1189  result = *double_vector_ptr;
1190  delete double_vector_ptr;
1191  return true;
1192  }
1193 
1194  std::vector<std::string> *string_vector_ptr = NULL;
1195  if (SWIG_IsOK(swig::asptr(input, (std::vector<std::string> **)NULL)) &&
1196  SWIG_IsOK(swig::asptr(input, &string_vector_ptr)))
1197  {
1198  result = *string_vector_ptr;
1199  delete string_vector_ptr;
1200  return true;
1201  }
1202 
1203  std::vector<HOM_Vector2> *vector2_vector_ptr = NULL;
1204  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector2> **)NULL)) &&
1205  SWIG_IsOK(swig::asptr(input, &vector2_vector_ptr)))
1206  {
1207  result = *vector2_vector_ptr;
1208  delete vector2_vector_ptr;
1209  return true;
1210  }
1211 
1212  std::vector<HOM_Vector3> *vector3_vector_ptr = NULL;
1213  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector3> **)NULL)) &&
1214  SWIG_IsOK(swig::asptr(input, &vector3_vector_ptr)))
1215  {
1216  result = *vector3_vector_ptr;
1217  delete vector3_vector_ptr;
1218  return true;
1219  }
1220 
1221  std::vector<HOM_Vector4> *vector4_vector_ptr = NULL;
1222  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Vector4> **)NULL)) &&
1223  SWIG_IsOK(swig::asptr(input, &vector4_vector_ptr)))
1224  {
1225  result = *vector4_vector_ptr;
1226  delete vector4_vector_ptr;
1227  return true;
1228  }
1229 
1230  std::vector<HOM_Matrix2> *matrix2_vector_ptr = NULL;
1231  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix2> **)NULL)) &&
1232  SWIG_IsOK(swig::asptr(input, &matrix2_vector_ptr)))
1233  {
1234  result = *matrix2_vector_ptr;
1235  delete matrix2_vector_ptr;
1236  return true;
1237  }
1238 
1239  std::vector<HOM_Matrix3> *matrix3_vector_ptr = NULL;
1240  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix3> **)NULL)) &&
1241  SWIG_IsOK(swig::asptr(input, &matrix3_vector_ptr)))
1242  {
1243  result = *matrix3_vector_ptr;
1244  delete matrix3_vector_ptr;
1245  return true;
1246  }
1247 
1248  std::vector<HOM_Matrix4> *matrix4_vector_ptr = NULL;
1249  if (SWIG_IsOK(swig::asptr(input, (std::vector<HOM_Matrix4> **)NULL)) &&
1250  SWIG_IsOK(swig::asptr(input, &matrix4_vector_ptr)))
1251  {
1252  result = *matrix4_vector_ptr;
1253  delete matrix4_vector_ptr;
1254  return true;
1255  }
1256 
1257  UT_ASSERT(result.empty());
1258  return false;
1259 }
1260 
1261 // Creating an input typemap isn't sufficient to handle input parameters with
1262 // std::vector's or std::map's of hboost::any's, so we need to specialize
1263 // swig::traits_asptr<hboost::any>.
1264 namespace swig {
1265  template <>
1266  struct traits_asptr<hboost::any>
1267  {
1268  static int asptr(InterpreterObject obj, hboost::any **val)
1269  {
1270  // TODO: Will the hboost::any be properly deleted?
1271  hboost::any *p = new hboost::any();
1272  HOMinterpreterObjectToBoostAny(obj, *p);
1273  if (val)
1274  *val = p;
1275  return SWIG_NEWOBJ;
1276  }
1277  };
1278 }
1279 
1280 // This function is not instantiated until the first use of HOM_BinaryString,
1281 // but we need to use it in HOMboostAnyToInterpreterObject. So just forward
1282 // declare it here.
1283 static PyObject * SWIG_From_HOM_BinaryString(const HOM_BinaryString& s);
1284 
1285 // This helper function takes a variable wrapped inside a hboost::any object
1286 // and creates a new instance of the corresponding InterpreterObject.
1287 static InterpreterObject
1288 HOMboostAnyToInterpreterObject(const hboost::any &result)
1289 {
1290  if (result.empty())
1291  return SWIG_Py_Void();
1292 
1293  if (result.type() == typeid(int))
1294  return SWIG_From_int(hboost::any_cast<int>(result));
1295 
1296  if (result.type() == typeid(long))
1297  return SWIG_From_long(hboost::any_cast<long>(result));
1298 
1299  if (result.type() == typeid(int64))
1300  return swig::from(hboost::any_cast<int64>(result));
1301 
1302  if (result.type() == typeid(float))
1303  return SWIG_From_float(hboost::any_cast<float>(result));
1304 
1305  if (result.type() == typeid(double))
1306  return SWIG_From_double(hboost::any_cast<double>(result));
1307 
1308  if (result.type() == typeid(std::string))
1309  return SWIG_From_std_string(hboost::any_cast<std::string>(result));
1310 
1311  if (result.type() == typeid(HOM_BinaryString))
1312  return SWIG_From_HOM_BinaryString(hboost::any_cast<HOM_BinaryString>(result));
1313 
1314  if (result.type() == typeid(std::vector<int>))
1315  return swig::from(hboost::any_cast<std::vector<int> >(result));
1316 
1317  if (result.type() == typeid(std::vector<int64>))
1318  return swig::from(hboost::any_cast<std::vector<int64> >(result));
1319 
1320  if (result.type() == typeid(std::vector<float>))
1321  return swig::from(hboost::any_cast<std::vector<float> >(result));
1322 
1323  if (result.type() == typeid(std::vector<std::string>))
1324  return swig::from(hboost::any_cast<std::vector<std::string> >(result));
1325 
1326  if (result.type() == typeid(std::vector<double>))
1327  return swig::from(hboost::any_cast<std::vector<double> >(result));
1328 
1329  if (result.type() == typeid(std::vector<std::vector<float> >))
1330  return swig::from(
1331  hboost::any_cast<std::vector<std::vector<float> > >(result));
1332 
1333  if (result.type() == typeid(std::vector<std::vector<double> >))
1334  return swig::from(
1335  hboost::any_cast<std::vector<std::vector<double> > >(result));
1336 
1337  // If a HOM function returns a pointer to a HOM_Vector*/HOM_Matrix*, it
1338  // will transfer the ownership of that object to swig.
1339  if (result.type() == typeid(HOM_Vector2 *))
1340  return HOMconvertValueForInterpreter(
1341  hboost::any_cast<HOM_Vector2 *>(result), SWIG_POINTER_OWN);
1342 
1343  if (result.type() == typeid(HOM_Vector3 *))
1344  return HOMconvertValueForInterpreter(
1345  hboost::any_cast<HOM_Vector3 *>(result), SWIG_POINTER_OWN);
1346 
1347  if (result.type() == typeid(HOM_Vector4 *))
1348  return HOMconvertValueForInterpreter(
1349  hboost::any_cast<HOM_Vector4 *>(result), SWIG_POINTER_OWN);
1350 
1351  if (result.type() == typeid(HOM_Matrix2 *))
1352  return HOMconvertValueForInterpreter(
1353  hboost::any_cast<HOM_Matrix2 *>(result), SWIG_POINTER_OWN);
1354 
1355  if (result.type() == typeid(HOM_Matrix3 *))
1356  return HOMconvertValueForInterpreter(
1357  hboost::any_cast<HOM_Matrix3 *>(result), SWIG_POINTER_OWN);
1358 
1359  if (result.type() == typeid(HOM_Matrix4 *))
1360  return HOMconvertValueForInterpreter(
1361  hboost::any_cast<HOM_Matrix4 *>(result), SWIG_POINTER_OWN);
1362 
1363  if (result.type() == typeid(HOM_NodeType *))
1364  return HOMconvertValueForInterpreter(
1365  hboost::any_cast<HOM_NodeType *>(result), SWIG_POINTER_OWN);
1366 
1367  if (result.type() == typeid(HOM_Ramp *))
1368  return HOMconvertValueForInterpreter(
1369  hboost::any_cast<HOM_Ramp *>(result), SWIG_POINTER_OWN);
1370 
1371  if (result.type() == typeid(HOM_Geometry *))
1372  return HOMconvertValueForInterpreter(
1373  hboost::any_cast<HOM_Geometry *>(result), SWIG_POINTER_OWN);
1374 
1375  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Vector2> >))
1376  return swig::from(
1377  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Vector2> > >(result));
1378 
1379  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Vector3> >))
1380  return swig::from(
1381  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Vector3> > >(result));
1382 
1383  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Vector4> >))
1384  return swig::from(
1385  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Vector4> > >(result));
1386 
1387  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Matrix2> >))
1388  return swig::from(
1389  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Matrix2> > >(result));
1390 
1391  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Matrix3> >))
1392  return swig::from(
1393  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Matrix3> > >(result));
1394 
1395  if (result.type() == typeid(std::vector<HOM_ElemPtr<HOM_Matrix4> >))
1396  return swig::from(
1397  hboost::any_cast<std::vector<HOM_ElemPtr<HOM_Matrix4> > >(result));
1398 
1399 #if UT_ASSERT_LEVEL > 0
1400  std::cout << "Unknown data type: "
1401  << UTunmangleClassNameFromTypeIdName(result.type().name()) << "\n";
1402 #endif
1403  UT_ASSERT(!"Unknown data type");
1404  return SWIG_Py_Void();
1405 }
1406 
1407 // This helper function takes a variable wrapped inside a hboost::any object
1408 // and creates a new instance of the corresponding InterpreterObject.
1409 static InterpreterObject
1410 HOMDDSourceAnyToInterpreterObject(const HOM_DDSourceAny &result)
1411 {
1412  if (result.type() == typeid(HOM_Node *))
1413  {
1414  return HOMconvertValueForInterpreter(
1415  hboost::any_cast<HOM_Node *>(result), SWIG_POINTER_OWN);
1416  }
1417  if (result.type() == typeid(HOM_Parm *))
1418  {
1419  return HOMconvertValueForInterpreter(
1420  hboost::any_cast<HOM_Parm *>(result), SWIG_POINTER_OWN);
1421  }
1422  if (result.type() == typeid(HOM_GalleryEntry *))
1423  {
1424  return HOMconvertValueForInterpreter(
1425  hboost::any_cast<HOM_GalleryEntry *>(result), SWIG_POINTER_OWN);
1426  }
1427 
1428  return HOMboostAnyToInterpreterObject(result);
1429 }
1430 
1431 namespace swig {
1432  // Adding the typemap does not customize swig::from() so we do that
1433  // manually.
1434  template <>
1435  struct traits_from<hboost::any>
1436  {
1437  static PyObject *from(const hboost::any &val)
1438  { return HOMboostAnyToInterpreterObject(val); }
1439  };
1440 }
1441 
1442 static InterpreterObject
1443 HOMoptionEntryToInterpreterObject(const UT_OptionEntry &option_entry)
1444 {
1445  InterpreterObject result = NULL;
1446 
1447  switch (option_entry.getType())
1448  {
1449  case UT_OPTION_INT:
1450  return SWIG_From_int(
1451  ((const UT_OptionInt &)option_entry).getValue());
1452 
1453  case UT_OPTION_BOOL:
1454  return SWIG_From_bool(
1455  ((const UT_OptionBool &)option_entry).getValue());
1456 
1457  case UT_OPTION_FPREAL:
1458  return SWIG_From_double(
1459  ((const UT_OptionFpreal &)option_entry).getValue());
1460 
1461  case UT_OPTION_STRING:
1462  case UT_OPTION_STRINGRAW:
1463  {
1464  return SWIG_From_std_string(
1465  ((const UT_OptionString &)option_entry).getValue().toStdString());
1466  }
1467 
1468  case UT_OPTION_VECTOR2:
1469  return HOMconvertValueForInterpreter(
1470  new HOM_Vector2(
1471  ((const UT_OptionVector2 &)option_entry).getValue()),
1472  SWIG_POINTER_OWN);
1473 
1474  case UT_OPTION_VECTOR3:
1475  return HOMconvertValueForInterpreter(
1476  new HOM_Vector3(
1477  ((const UT_OptionVector3 &)option_entry).getValue()),
1478  SWIG_POINTER_OWN);
1479 
1480  case UT_OPTION_VECTOR4:
1481  return HOMconvertValueForInterpreter(
1482  new HOM_Vector4(
1483  ((const UT_OptionVector4 &)option_entry).getValue()),
1484  SWIG_POINTER_OWN);
1485 
1486  case UT_OPTION_QUATERNION:
1487  return HOMconvertValueForInterpreter(
1488  new HOM_Quaternion(
1489  ((const UT_OptionQuaternion &)option_entry).getValue()),
1490  SWIG_POINTER_OWN);
1491 
1492  case UT_OPTION_MATRIX2:
1493  return HOMconvertValueForInterpreter(
1495  ((const UT_OptionMatrix2 &)option_entry).getValue())),
1496  SWIG_POINTER_OWN);
1497 
1498  case UT_OPTION_MATRIX3:
1499  return HOMconvertValueForInterpreter(
1501  ((const UT_OptionMatrix3 &)option_entry).getValue())),
1502  SWIG_POINTER_OWN);
1503 
1504  case UT_OPTION_MATRIX4:
1505  return HOMconvertValueForInterpreter(
1507  ((const UT_OptionMatrix4 &)option_entry).getValue())),
1508  SWIG_POINTER_OWN);
1509 
1510  case UT_OPTION_UV:
1511  return HOMconvertValueForInterpreter(
1512  new HOM_Vector2(
1513  ((const UT_OptionUV &)option_entry).getValue()),
1514  SWIG_POINTER_OWN);
1515 
1516  case UT_OPTION_UVW:
1517  return HOMconvertValueForInterpreter(
1518  new HOM_Vector3(
1519  ((const UT_OptionUVW &)option_entry).getValue()),
1520  SWIG_POINTER_OWN);
1521 
1522  case UT_OPTION_INTARRAY:
1523  {
1524  std::vector<int64> int_vector;
1525  static_cast<const UT_OptionInt64Array &>(
1526  option_entry).getValue().toStdVector(int_vector);
1527  return swig::from(int_vector);
1528  }
1529 
1530  case UT_OPTION_FPREALARRAY:
1531  {
1532  std::vector<double> double_vector;
1533  static_cast<const UT_OptionFpreal64Array &>(
1534  option_entry).getValue().toStdVector(double_vector);
1535  return swig::from(double_vector);
1536  }
1537 
1538  case UT_OPTION_STRINGARRAY:
1539  {
1540  std::vector<std::string> str_vector;
1541  static_cast<const UT_OptionStringArray &>(
1542  option_entry).getValue().toStdVectorOfStrings(str_vector);
1543  return swig::from(str_vector);
1544  }
1545 
1546  case UT_OPTION_INVALID:
1547  case UT_OPTION_NUM_TYPES:
1548  // Just exit the switch with no result.
1549  break;
1550  }
1551 
1552  return result ? result : SWIG_Py_Void();
1553 }
1554 
1555 #ifdef SWIGPYTHON
1556 static InterpreterObject
1557 HOMoptionsToInterpreterObject(const UT_Options &options)
1558 {
1559  InterpreterObject result = PyDict_New();
1560 
1561  for (UT_Options::iterator it = options.begin(); !it.atEnd(); ++it)
1562  {
1563  // The Python dictionary object will increment the reference count
1564  // on the value, so we decrement it since we just allocated it.
1565  InterpreterObject value=HOMoptionEntryToInterpreterObject(*it.entry());
1566  PyDict_SetItemString(result, it.name(), value);
1567  Py_DECREF(value);
1568  }
1569 
1570  return result;
1571 }
1572 #endif
1573 
1574 //----------------------------------------------------------------------------
1575 
1576 #ifdef SWIGPYTHON
1577 // This helper class takes a Python buffer object and provides access to
1578 // the underlying C buffer. Note that the class is only used inside the
1579 // swig file, so it doesn't need to be exported from the current library.
1580 class HOM_PyBuffer
1581 {
1582 public:
1583  HOM_PyBuffer(InterpreterObject py_object)
1584  {
1585  myData = NULL;
1586  myLength = 0;
1587 
1588  // Python added a new buffer interface starting with Python 2.6.
1589 #if PY_VERSION_HEX >= 0x02060000
1590  myUseNewAPI = false;
1591  if (PyObject_CheckBuffer(py_object))
1592  {
1593  if (PyObject_GetBuffer(py_object, &myPyBuffer, PyBUF_SIMPLE) < 0)
1594  throw HOM_TypeError("failed to get readable buffer");
1595 
1596  myUseNewAPI = true;
1597  myData = myPyBuffer.buf;
1598  myLength = myPyBuffer.len;
1599  return;
1600  }
1601 #endif
1602  // Either the new API isn't supported in this Python version or the
1603  // Python object doesn't support it. Try the old API.
1604  if (!PyObject_CheckReadBuffer(py_object))
1605  throw HOM_TypeError("expected a readable buffer");
1606 
1607  if (PyObject_AsReadBuffer(py_object, &myData, &myLength) < 0)
1608  throw HOM_TypeError("failed to get readable buffer");
1609  }
1610 
1611  ~HOM_PyBuffer()
1612  {
1613 #if PY_VERSION_HEX >= 0x02060000
1614  if (myUseNewAPI)
1615  PyBuffer_Release(&myPyBuffer);
1616 #endif
1617  }
1618 
1619 #if PY_VERSION_HEX >= 0x02060000
1620  bool myUseNewAPI;
1621  Py_buffer myPyBuffer;
1622 #endif
1623  const void *myData;
1624  Py_ssize_t myLength;
1625 };
1626 #endif
1627 
1628 //----------------------------------------------------------------------------
1629 
1630 // These helper functions are used to implement the attrib() methods of
1631 // Points, Prims, and Vertices. We need to do extra work for these methods
1632 // because the return type can vary.
1633 template <typename T>
1634 InterpreterObject
1635 HOMattribValue(T &geo_element, HOM_Attrib &hom_attrib)
1636 {
1637  InterpreterObject result = NULL;
1638  switch (hom_attrib.dataType().id())
1639  {
1640  case HOM_attribData::Int_Id:
1641  if (hom_attrib.size() == 1)
1642  result = swig::from(
1643  hboost::any_cast<int64>(geo_element.intAttribValue(hom_attrib)));
1644  else
1645  result = swig::from(
1646  hboost::any_cast<std::vector<int64> >(
1647  geo_element.intListAttribValue(hom_attrib)));
1648  break;
1649 
1650  case HOM_attribData::Float_Id:
1651  if (hom_attrib.size() == 1)
1652  result = SWIG_From_double(geo_element.floatAttribValue(hom_attrib));
1653  else
1654  result = swig::from(geo_element.floatListAttribValue(hom_attrib));
1655  break;
1656 
1657  case HOM_attribData::String_Id:
1658  if (hom_attrib.size() == 1)
1659  result = SWIG_From_std_string(
1660  geo_element.stringAttribValue(hom_attrib));
1661  else
1662  result = swig::from(geo_element.stringListAttribValue(hom_attrib));
1663  break;
1664  }
1665  UT_ASSERT(result);
1666  return result;
1667 }
1668 
1669 
1670 // Note that the caller is responsible for deleting the HOM_Attrib object
1671 // that's returned.
1672 template <typename T> HOM_Attrib*
1673 HOMlookUpAttrib(T &geo_element, const char *name);
1674 
1675 template <> HOM_Attrib*
1676 HOMlookUpAttrib(HOM_Point &point, const char *name)
1677 { return HOMdel(point.geometry())->findPointAttrib(name); }
1678 
1679 template <> HOM_Attrib*
1680 HOMlookUpAttrib(HOM_Prim &prim, const char *name)
1681 { return HOMdel(prim.geometry())->findPrimAttrib(name); }
1682 
1683 template <> HOM_Attrib*
1684 HOMlookUpAttrib(HOM_Vertex &vertex, const char *name)
1685 { return HOMdel(vertex.geometry())->findVertexAttrib(name); }
1686 
1687 template <> HOM_Attrib*
1688 HOMlookUpAttrib(HOM_Geometry &geometry, const char *name)
1689 { return geometry.findGlobalAttrib(name); }
1690 
1691 template <typename T>
1692 InterpreterObject
1693 HOMattribValue(T &geo_element, const char *name)
1694 {
1695  HOM_Attrib *hom_attrib = HOMlookUpAttrib(geo_element, name);
1696  if (!hom_attrib)
1697  throw HOM_OperationFailed();
1698 
1699  InterpreterObject result = HOMattribValue(geo_element, *hom_attrib);
1700  delete hom_attrib;
1701  return result;
1702 }
1703 %}
1704 
1705 //----------------------------------------------------------------------------
1706 
1707 %{
1708 // These helper functions are used to implement parm evaluation.
1709 static InterpreterObject
1710 HOMevalParm(HOM_Parm &parm)
1711 {
1712  PY_InterpreterAutoLock py_lock;
1713 
1714  switch (parm.parmDataTypeEnumId())
1715  {
1716  case HOM_parmData::Int_Id:
1717  return SWIG_From_int(parm.evalAsInt());
1718  case HOM_parmData::Float_Id:
1719  return SWIG_From_double(parm.evalAsFloat());
1720  case HOM_parmData::String_Id:
1721  return SWIG_From_std_string(parm.evalAsString());
1722  case HOM_parmData::Ramp_Id:
1723  return SWIG_NewPointerObj(
1724  (void*)parm.evalAsRamp(), SWIGTYPE_p_HOM_Ramp, SWIG_POINTER_OWN);
1725  case HOM_parmData::Data_Id:
1726  if (parm.dataParmTypeEnumId() == HOM_dataParmType::KeyValueDictionary_Id)
1727  return swig::from(parm.evalAsJSONMap());
1728 
1729  return SWIG_NewPointerObj(
1730  (void*)parm.evalAsGeometry(), SWIGTYPE_p_HOM_Geometry, SWIG_POINTER_OWN);
1731  }
1732 
1733  UT_ASSERT(!"Unknown parm data type");
1734  return SWIG_Py_Void();
1735 }
1736 
1737 static InterpreterObject
1738 HOMevalParmAtFrame(HOM_Parm &parm, double frame)
1739 {
1740  PY_InterpreterAutoLock py_lock;
1741 
1742  switch (parm.parmDataTypeEnumId())
1743  {
1744  case HOM_parmData::Int_Id:
1745  return SWIG_From_int(parm.evalAsIntAtFrame(frame));
1746  case HOM_parmData::Float_Id:
1747  return SWIG_From_double(parm.evalAsFloatAtFrame(frame));
1748  case HOM_parmData::String_Id:
1749  return SWIG_From_std_string(parm.evalAsStringAtFrame(frame));
1750  case HOM_parmData::Ramp_Id:
1751  return SWIG_NewPointerObj(
1752  (void*)parm.evalAsRampAtFrame(frame),
1753  SWIGTYPE_p_HOM_Ramp, SWIG_POINTER_OWN);
1754  case HOM_parmData::Data_Id:
1755  if (parm.dataParmTypeEnumId() == HOM_dataParmType::KeyValueDictionary_Id)
1756  return swig::from(parm.evalAsJSONMapAtFrame(frame));
1757 
1758  return SWIG_NewPointerObj(
1759  (void*)parm.evalAsGeometryAtFrame(frame),
1760  SWIGTYPE_p_HOM_Geometry, SWIG_POINTER_OWN);
1761  }
1762 
1763  UT_ASSERT(!"Unknown parm data type");
1764  return SWIG_Py_Void();
1765 }
1766 
1767 static InterpreterObject
1768 HOMevalParmTuple(HOM_ParmTuple &parm_tuple)
1769 {
1770  switch (parm_tuple.parmDataTypeEnumId())
1771  {
1772  case HOM_parmData::Int_Id:
1773  return swig::from(parm_tuple.evalAsInts());
1774  case HOM_parmData::Float_Id:
1775  return swig::from(parm_tuple.evalAsFloats());
1776  case HOM_parmData::String_Id:
1777  return swig::from(parm_tuple.evalAsStrings());
1778  case HOM_parmData::Ramp_Id:
1779  return swig::from(parm_tuple.evalAsRamps());
1780  case HOM_parmData::Data_Id:
1781  return swig::from(parm_tuple.evalAsGeometries());
1782  }
1783 
1784  UT_ASSERT(!"Unknown parm data type");
1785  return SWIG_Py_Void();
1786 }
1787 
1788 static InterpreterObject
1789 HOMevalParmTupleAtFrame(HOM_ParmTuple &parm_tuple, double frame)
1790 {
1791  switch (parm_tuple.parmDataTypeEnumId())
1792  {
1793  case HOM_parmData::Int_Id:
1794  return swig::from(parm_tuple.evalAsIntsAtFrame(frame));
1795  case HOM_parmData::Float_Id:
1796  return swig::from(parm_tuple.evalAsFloatsAtFrame(frame));
1797  case HOM_parmData::String_Id:
1798  return swig::from(parm_tuple.evalAsStringsAtFrame(frame));
1799  case HOM_parmData::Ramp_Id:
1800  return swig::from(parm_tuple.evalAsRampsAtFrame(frame));
1801  case HOM_parmData::Data_Id:
1802  return swig::from(parm_tuple.evalAsGeometriesAtFrame(frame));
1803  }
1804 
1805  UT_ASSERT(!"Unknown parm data type");
1806  return SWIG_Py_Void();
1807 }
1808 
1809 static InterpreterObject
1810 HOMevalViewportVisualizerParm(HOM_ViewportVisualizer &visualizer, const char *parm_name)
1811 {
1812  PY_InterpreterAutoLock py_lock;
1813 
1814  switch (visualizer.parmDataTypeEnumId(parm_name))
1815  {
1816  case HOM_parmData::Int_Id:
1817  return SWIG_From_int(visualizer.evalParmAsInt(parm_name));
1818  case HOM_parmData::Float_Id:
1819  return SWIG_From_double(visualizer.evalParmAsFloat(parm_name));
1820  case HOM_parmData::String_Id:
1821  return SWIG_From_std_string(visualizer.evalParmAsString(parm_name));
1822  case HOM_parmData::Ramp_Id:
1823  return SWIG_NewPointerObj(
1824  (void*)visualizer.evalParmAsRamp(parm_name), SWIGTYPE_p_HOM_Ramp,
1825  SWIG_POINTER_OWN);
1826  }
1827 
1828  UT_ASSERT(!"Unknown parm data type");
1829  return SWIG_Py_Void();
1830 }
1831 
1832 
1833 //----------------------------------------------------------------------------
1834 
1835 %}
1836 #endif
1837 
1838 #endif
hboost::shared_ptr< T > HOMdel(T *hom_object)
Definition: HOM_Module.h:863
UT_Matrix4T< double > UT_DMatrix4
virtual std::vector< HOM_ElemPtr< HOM_Geometry > > evalAsGeometries()=0
UT_Matrix3T< double > UT_DMatrix3
virtual std::vector< int > evalAsIntsAtFrame(double frame)=0
virtual int size()=0
virtual std::string evalParmAsString(const char *parm_name)=0
virtual std::vector< HOM_ElemPtr< HOM_Ramp > > evalAsRampsAtFrame(double frame)=0
virtual HOM_Attrib * findGlobalAttrib(const char *name)=0
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
virtual int parmDataTypeEnumId()=0
virtual double evalAsFloat()=0
virtual std::vector< int > evalAsInts()=0
bool atEnd() const
Definition: UT_Options.h:239
virtual HOM_Ramp * evalParmAsRamp(const char *parm_name)=0
virtual HOM_Ramp * evalAsRampAtFrame(double frame)=0
long long int64
Definition: SYS_Types.h:100
virtual std::vector< std::string > evalAsStrings()=0
UT_API std::string UTunmangleClassNameFromTypeIdName(const std::string &name)
virtual HOM_Geometry * geometry()=0
virtual double evalAsFloatAtFrame(double frame)=0
virtual int evalAsIntAtFrame(double frame)=0
virtual int dataParmTypeEnumId()=0
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
virtual std::map< std::string, std::string > evalAsJSONMapAtFrame(double frame)=0
virtual HOM_Geometry * geometry()=0
virtual HOM_Geometry * evalAsGeometryAtFrame(double frame)=0
virtual UT_OptionType getType() const
UT_Matrix2T< double > UT_DMatrix2
virtual std::map< std::string, std::string > evalAsJSONMap()=0
void * opaqueObject() const
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int parmDataTypeEnumId()=0
virtual std::string evalAsStringAtFrame(double frame)=0
virtual std::vector< HOM_ElemPtr< HOM_Geometry > > evalAsGeometriesAtFrame(double frame)=0
OP_OpTypeId
Definition: OP_Node.h:263
virtual std::vector< double > evalAsFloatsAtFrame(double frame)=0
virtual HOM_Ramp * evalAsRamp()=0
hboost::any HOM_DDSourceAny
Definition: HOM_Defines.h:42
virtual int evalAsInt()=0
iterator begin() const
Definition: UT_Options.h:352
virtual std::vector< double > evalAsFloats()=0
GLsizei const GLfloat * value
Definition: glcorearb.h:823
A map of string to various well defined value types.
Definition: UT_Options.h:42
virtual double evalParmAsFloat(const char *parm_name)=0
virtual int parmDataTypeEnumId(const char *parm_name)=0
typedef int
Definition: png.h:1175
GLuint GLfloat * val
Definition: glcorearb.h:1607
virtual HOM_EnumValue & dataType()=0
int id() const
Definition: HOM_EnumValue.h:82
virtual std::vector< HOM_ElemPtr< HOM_Ramp > > evalAsRamps()=0
#define const
Definition: zconf.h:214
virtual int evalParmAsInt(const char *parm_name)=0
virtual std::vector< std::string > evalAsStringsAtFrame(double frame)=0
virtual std::string evalAsString()=0
virtual HOM_Geometry * evalAsGeometry()=0
virtual HOM_Geometry * geometry()=0