Blender  V2.93
BPy_Convert.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #pragma once
22 
23 extern "C" {
24 #include <Python.h>
25 }
26 
27 #include <typeinfo>
28 
29 #include "../geometry/Geom.h"
30 
31 // BBox
32 #include "../geometry/BBox.h"
33 
34 // FEdge, FEdgeSharp, FEdgeSmooth, SShape, SVertex, FEdgeInternal::SVertexIterator
35 #include "../view_map/Silhouette.h"
36 
37 // Id
38 #include "../system/Id.h"
39 
40 // Interface0D, Interface0DIteratorNested, Interface0DIterator
41 #include "../view_map/Interface0D.h"
42 
43 // Interface1D
44 #include "../view_map/Interface1D.h"
45 
46 // FrsMaterial
47 #include "../scene_graph/FrsMaterial.h"
48 
49 // Nature::VertexNature, Nature::EdgeNature
50 #include "../winged_edge/Nature.h"
51 
52 // Stroke, StrokeAttribute, StrokeVertex
53 #include "../stroke/Stroke.h"
54 
55 // NonTVertex, TVertex, ViewEdge, ViewMap, ViewShape, ViewVertex
56 #include "../view_map/ViewMap.h"
57 
58 // CurvePoint, Curve
59 #include "../stroke/Curve.h"
60 
61 // Chain
62 #include "../stroke/Chain.h"
63 
64 //====== ITERATORS
65 
66 // AdjacencyIterator, ChainingIterator, ChainSilhouetteIterator, ChainPredicateIterator
67 #include "../stroke/ChainingIterators.h"
68 
69 // ViewVertexInternal::orientedViewEdgeIterator
70 // ViewEdgeInternal::SVertexIterator
71 // ViewEdgeInternal::ViewEdgeIterator
72 #include "../view_map/ViewMapIterators.h"
73 
74 // StrokeInternal::StrokeVertexIterator
75 #include "../stroke/StrokeIterators.h"
76 
77 // CurveInternal::CurvePointIterator
78 #include "../stroke/CurveIterators.h"
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
85 
87 #include "mathutils/mathutils.h"
88 
89 //==============================
90 // C++ => Python
91 //==============================
92 
93 PyObject *PyBool_from_bool(bool b);
97 
102 
109 PyObject *BPy_Id_from_Id(Freestyle::Id &id);
114 PyObject *BPy_Nature_from_Nature(unsigned short n);
127 
130  bool reversed);
146 
147 //==============================
148 // Python => C++
149 //==============================
150 
151 bool bool_from_PyBool(PyObject *b);
155 bool Vec2f_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
157 bool Vec3r_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
158 bool Vec2f_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
160 bool Vec3r_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
162 bool Vec3r_ptr_from_Color(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
163 bool Vec2f_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
165 bool Vec3r_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
166 bool Vec2f_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
168 bool Vec3r_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
169 
170 bool float_array_from_PyObject(PyObject *obj, float *v, int n);
171 
172 int convert_v4(PyObject *obj, void *v);
173 int convert_v3(PyObject *obj, void *v);
174 int convert_v2(PyObject *obj, void *v);
175 
177 
178 #ifdef __cplusplus
179 }
180 #endif
PyObject * BPy_Interface0DIterator_from_Interface0DIterator(Freestyle::Interface0DIterator &if0D_it, bool reversed)
PyObject * BPy_FEdgeSmooth_from_FEdgeSmooth(Freestyle::FEdgeSmooth &fes)
PyObject * PyBool_from_bool(bool b)
Definition: BPy_Convert.cpp:73
PyObject * BPy_ViewShape_from_ViewShape(Freestyle::ViewShape &vs)
PyObject * BPy_MediumType_from_MediumType(Freestyle::Stroke::MediumType n)
PyObject * BPy_StrokeVertex_from_StrokeVertex(Freestyle::StrokeVertex &sv)
PyObject * BPy_Stroke_from_Stroke(Freestyle::Stroke &s)
bool bool_from_PyBool(PyObject *b)
PyObject * Any_BPy_Interface1D_from_Interface1D(Freestyle::Interface1D &if1D)
bool Vec3r_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec3r &vec)
PyObject * BPy_SVertexIterator_from_SVertexIterator(Freestyle::ViewEdgeInternal::SVertexIterator &sv_it)
Freestyle::Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj)
Freestyle::Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(Freestyle::ViewVertex &vv)
bool Vec3r_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec3r &vec)
PyObject * BPy_CurvePoint_from_CurvePoint(Freestyle::CurvePoint &cp)
PyObject * BPy_ViewEdge_from_ViewEdge(Freestyle::ViewEdge &ve)
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator(Freestyle::StrokeInternal::StrokeVertexIterator &sv_it, bool reversed)
PyObject * BPy_Interface1D_from_Interface1D(Freestyle::Interface1D &if1D)
PyObject * BPy_FEdgeSharp_from_FEdgeSharp(Freestyle::FEdgeSharp &fes)
bool Vec3f_ptr_from_Color(PyObject *obj, Freestyle::Geometry::Vec3f &vec)
PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator(Freestyle::AdjacencyIterator &a_it)
PyObject * BPy_IntegrationType_from_IntegrationType(Freestyle::IntegrationType i)
bool float_array_from_PyObject(PyObject *obj, float *v, int n)
PyObject * Vector_from_Vec3r(Freestyle::Geometry::Vec3r &v)
Definition: BPy_Convert.cpp:95
PyObject * BPy_BBox_from_BBox(const Freestyle::BBox< Freestyle::Geometry::Vec3r > &bb)
PyObject * BPy_ChainingIterator_from_ChainingIterator(Freestyle::ChainingIterator &c_it)
bool Vec3f_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec3f &vec)
PyObject * BPy_StrokeAttribute_from_StrokeAttribute(Freestyle::StrokeAttribute &sa)
bool Vec3r_ptr_from_Color(PyObject *obj, Freestyle::Geometry::Vec3r &vec)
PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(Freestyle::ChainSilhouetteIterator &cs_it)
PyObject * BPy_directedViewEdge_from_directedViewEdge(Freestyle::ViewVertex::directedViewEdge &dve)
PyObject * BPy_SShape_from_SShape(Freestyle::SShape &ss)
bool Vec3f_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec3f &vec)
PyObject * BPy_NonTVertex_from_NonTVertex(Freestyle::NonTVertex &ntv)
PyObject * BPy_FEdge_from_FEdge(Freestyle::FEdge &fe)
PyObject * BPy_Chain_from_Chain(Freestyle::Chain &c)
bool Vec2f_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec2f &vec)
bool Vec3f_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec3f &vec)
PyObject * BPy_TVertex_from_TVertex(Freestyle::TVertex &tv)
bool Vec2f_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec2f &vec)
bool Vec3r_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec3r &vec)
bool Vec3r_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec3r &vec)
bool Vec2f_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec2f &vec)
PyObject * BPy_SVertex_from_SVertex(Freestyle::SVertex &sv)
int convert_v4(PyObject *obj, void *v)
PyObject * BPy_FrsMaterial_from_FrsMaterial(const Freestyle::FrsMaterial &m)
bool Vec2f_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec2f &vec)
PyObject * BPy_Nature_from_Nature(unsigned short n)
PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator(Freestyle::ChainPredicateIterator &cp_it)
PyObject * BPy_Id_from_Id(Freestyle::Id &id)
PyObject * BPy_ViewVertex_from_ViewVertex(Freestyle::ViewVertex &vv)
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(Freestyle::ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed)
int convert_v3(PyObject *obj, void *v)
PyObject * Any_BPy_FEdge_from_FEdge(Freestyle::FEdge &fe)
PyObject * BPy_ViewEdgeIterator_from_ViewEdgeIterator(Freestyle::ViewEdgeInternal::ViewEdgeIterator &ve_it)
PyObject * BPy_Interface0D_from_Interface0D(Freestyle::Interface0D &if0D)
PyObject * Vector_from_Vec2f(Freestyle::Geometry::Vec2f &v)
Definition: BPy_Convert.cpp:78
Freestyle::IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj)
PyObject * BPy_CurvePointIterator_from_CurvePointIterator(Freestyle::CurveInternal::CurvePointIterator &cp_it)
PyObject * Any_BPy_Interface0D_from_Interface0D(Freestyle::Interface0D &if0D)
int convert_v2(PyObject *obj, void *v)
PyObject * Vector_from_Vec3f(Freestyle::Geometry::Vec3f &v)
bool Vec3f_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec3f &vec)
ATTR_WARN_UNUSED_RESULT const BMVert * v
pair< ViewEdge *, bool > directedViewEdge
Definition: ViewMap.h:280
unsigned short EdgeNature
Definition: Nature.h:46
static unsigned c
Definition: RandGen.cpp:97
header-only utilities