Made the Freestyle Python API compatible with Python 3.
[blender.git] / source / blender / freestyle / intern / python / BPy_Convert.h
1 #ifndef FREESTYLE_PYTHON_CONVERT_H
2 #define FREESTYLE_PYTHON_CONVERT_H
3
4 #include <typeinfo>
5
6 #include "../geometry/Geom.h"
7 using namespace Geometry;
8
9 // BBox
10 #include "../geometry/BBox.h"
11
12 // FEdge, FEdgeSharp, FEdgeSmooth, SShape, SVertex, FEdgeInternal::SVertexIterator
13 #include "../view_map/Silhouette.h" 
14
15 // Id
16 #include "../system/Id.h"
17
18 // Interface0D, Interface0DIteratorNested, Interface0DIterator
19 #include "../view_map/Interface0D.h"
20
21 // Interface1D
22 #include "../view_map/Interface1D.h"
23
24 // FrsMaterial
25 #include "../scene_graph/FrsMaterial.h"
26
27 // Nature::VertexNature, Nature::EdgeNature
28 #include "../winged_edge/Nature.h"
29
30 // Stroke, StrokeAttribute, StrokeVertex
31 #include "../stroke/Stroke.h"
32
33 // NonTVertex, TVertex, ViewEdge, ViewMap, ViewShape, ViewVertex
34 #include "../view_map/ViewMap.h"
35
36 // CurvePoint, Curve
37 #include "../stroke/Curve.h"
38
39 // Chain
40 #include "../stroke/Chain.h"
41
42 //====== ITERATORS
43
44 // AdjacencyIterator, ChainingIterator, ChainSilhouetteIterator, ChainPredicateIterator
45 #include "../stroke/ChainingIterators.h"
46
47 // ViewVertexInternal::orientedViewEdgeIterator
48 // ViewEdgeInternal::SVertexIterator
49 // ViewEdgeInternal::ViewEdgeIterator
50 #include "../view_map/ViewMapIterators.h"
51
52 // StrokeInternal::StrokeVertexIterator
53 #include "../stroke/StrokeIterators.h"
54
55 // CurveInternal::CurvePointIterator
56 #include "../stroke/CurveIterators.h"
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 ///////////////////////////////////////////////////////////////////////////////////////////
63
64 #include <Python.h>
65 #include "generic/Mathutils.h"
66
67 //==============================
68 // C++ => Python
69 //==============================
70
71 PyObject * PyBool_from_bool( bool b );
72 PyObject * Vector_from_Vec2f( Vec2f& v );
73 PyObject * Vector_from_Vec3f( Vec3f& v );
74 PyObject * Vector_from_Vec3r( Vec3r& v );
75
76 PyObject * Any_BPy_Interface0D_from_Interface0D( Interface0D& if0D );
77 PyObject * Any_BPy_Interface1D_from_Interface1D( Interface1D& if1D );
78 PyObject * Any_BPy_FEdge_from_FEdge( FEdge& fe );
79 PyObject * Any_BPy_ViewVertex_from_ViewVertex( ViewVertex& vv );
80
81 PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb );
82 PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp );
83 PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve );
84 PyObject * BPy_FEdge_from_FEdge( FEdge& fe );
85 PyObject * BPy_FEdgeSharp_from_FEdgeSharp( FEdgeSharp& fes );
86 PyObject * BPy_FEdgeSmooth_from_FEdgeSmooth( FEdgeSmooth& fes );
87 PyObject * BPy_Id_from_Id( Id& id );
88 PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D );
89 PyObject * BPy_Interface1D_from_Interface1D( Interface1D& if1D );
90 PyObject * BPy_IntegrationType_from_IntegrationType( IntegrationType i );
91 PyObject * BPy_FrsMaterial_from_FrsMaterial( FrsMaterial& m );
92 PyObject * BPy_Nature_from_Nature( unsigned short n );
93 PyObject * BPy_MediumType_from_MediumType( Stroke::MediumType n );
94 PyObject * BPy_SShape_from_SShape( SShape& ss );
95 PyObject * BPy_Stroke_from_Stroke( Stroke& s );
96 PyObject * BPy_StrokeAttribute_from_StrokeAttribute( StrokeAttribute& sa );
97 PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv );
98 PyObject * BPy_SVertex_from_SVertex( SVertex& sv );
99 PyObject * BPy_ViewVertex_from_ViewVertex( ViewVertex& vv );
100 PyObject * BPy_NonTVertex_from_NonTVertex( NonTVertex& ntv );
101 PyObject * BPy_TVertex_from_TVertex( TVertex& tv );
102 PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve );
103 PyObject * BPy_Chain_from_Chain( Chain& c );
104 PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs );
105
106 PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator( AdjacencyIterator& a_it );
107 PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& if0D_it, int reversed );
108 PyObject * BPy_CurvePointIterator_from_CurvePointIterator( CurveInternal::CurvePointIterator& cp_it );
109 PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator& sv_it, int reversed);
110 PyObject * BPy_SVertexIterator_from_SVertexIterator( ViewEdgeInternal::SVertexIterator& sv_it );
111 PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it, int reversed );
112 PyObject * BPy_ViewEdgeIterator_from_ViewEdgeIterator( ViewEdgeInternal::ViewEdgeIterator& ve_it );
113 PyObject * BPy_ChainingIterator_from_ChainingIterator( ChainingIterator& c_it );
114 PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator( ChainPredicateIterator& cp_it );
115 PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhouetteIterator& cs_it );
116
117 //==============================
118 // Python => C++
119 //==============================
120
121 bool bool_from_PyBool( PyObject *b );
122 IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
123 Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
124 Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj );
125 Vec2f * Vec2f_ptr_from_PyObject( PyObject* obj );
126 Vec3f * Vec3f_ptr_from_PyObject( PyObject* obj );
127 Vec3r * Vec3r_ptr_from_PyObject( PyObject* obj );
128 Vec2f * Vec2f_ptr_from_Vector( PyObject* obj );
129 Vec3f * Vec3f_ptr_from_Vector( PyObject* obj );
130 Vec3r * Vec3r_ptr_from_Vector( PyObject* obj );
131 Vec2f * Vec2f_ptr_from_PyList( PyObject* obj );
132 Vec3f * Vec3f_ptr_from_PyList( PyObject* obj );
133 Vec3r * Vec3r_ptr_from_PyList( PyObject* obj );
134 Vec2f * Vec2f_ptr_from_PyTuple( PyObject* obj );
135 Vec3f * Vec3f_ptr_from_PyTuple( PyObject* obj );
136 Vec3r * Vec3r_ptr_from_PyTuple( PyObject* obj );
137
138
139
140 ///////////////////////////////////////////////////////////////////////////////////////////
141
142 #ifdef __cplusplus
143 }
144 #endif
145
146
147 #endif /* FREESTYLE_PYTHON_CONVERT_H */