Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BPy_Convert.h « python « intern « freestyle « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e09161968085f9de141e34cc8ab7e974b670b0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

/** \file
 * \ingroup freestyle
 */

#pragma once

extern "C" {
#include <Python.h>
}

#include <typeinfo>

#include "../geometry/Geom.h"

// BBox
#include "../geometry/BBox.h"

// FEdge, FEdgeSharp, FEdgeSmooth, SShape, SVertex, FEdgeInternal::SVertexIterator
#include "../view_map/Silhouette.h"

// Id
#include "../system/Id.h"

// Interface0D, Interface0DIteratorNested, Interface0DIterator
#include "../view_map/Interface0D.h"

// Interface1D
#include "../view_map/Interface1D.h"

// FrsMaterial
#include "../scene_graph/FrsMaterial.h"

// Nature::VertexNature, Nature::EdgeNature
#include "../winged_edge/Nature.h"

// Stroke, StrokeAttribute, StrokeVertex
#include "../stroke/Stroke.h"

// NonTVertex, TVertex, ViewEdge, ViewMap, ViewShape, ViewVertex
#include "../view_map/ViewMap.h"

// CurvePoint, Curve
#include "../stroke/Curve.h"

// Chain
#include "../stroke/Chain.h"

//====== ITERATORS

// AdjacencyIterator, ChainingIterator, ChainSilhouetteIterator, ChainPredicateIterator
#include "../stroke/ChainingIterators.h"

// ViewVertexInternal::orientedViewEdgeIterator
// ViewEdgeInternal::SVertexIterator
// ViewEdgeInternal::ViewEdgeIterator
#include "../view_map/ViewMapIterators.h"

// StrokeInternal::StrokeVertexIterator
#include "../stroke/StrokeIterators.h"

// CurveInternal::CurvePointIterator
#include "../stroke/CurveIterators.h"

#ifdef __cplusplus
extern "C" {
#endif

///////////////////////////////////////////////////////////////////////////////////////////

#include "generic/python_utildefines.h"
#include "mathutils/mathutils.h"

//==============================
// C++ => Python
//==============================

PyObject *PyBool_from_bool(bool b);
PyObject *Vector_from_Vec2f(Freestyle::Geometry::Vec2f &v);
PyObject *Vector_from_Vec3f(Freestyle::Geometry::Vec3f &v);
PyObject *Vector_from_Vec3r(Freestyle::Geometry::Vec3r &v);

PyObject *Any_BPy_Interface0D_from_Interface0D(Freestyle::Interface0D &if0D);
PyObject *Any_BPy_Interface1D_from_Interface1D(Freestyle::Interface1D &if1D);
PyObject *Any_BPy_FEdge_from_FEdge(Freestyle::FEdge &fe);
PyObject *Any_BPy_ViewVertex_from_ViewVertex(Freestyle::ViewVertex &vv);

PyObject *BPy_BBox_from_BBox(const Freestyle::BBox<Freestyle::Geometry::Vec3r> &bb);
PyObject *BPy_CurvePoint_from_CurvePoint(Freestyle::CurvePoint &cp);
PyObject *BPy_directedViewEdge_from_directedViewEdge(Freestyle::ViewVertex::directedViewEdge &dve);
PyObject *BPy_FEdge_from_FEdge(Freestyle::FEdge &fe);
PyObject *BPy_FEdgeSharp_from_FEdgeSharp(Freestyle::FEdgeSharp &fes);
PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(Freestyle::FEdgeSmooth &fes);
PyObject *BPy_Id_from_Id(Freestyle::Id &id);
PyObject *BPy_Interface0D_from_Interface0D(Freestyle::Interface0D &if0D);
PyObject *BPy_Interface1D_from_Interface1D(Freestyle::Interface1D &if1D);
PyObject *BPy_IntegrationType_from_IntegrationType(Freestyle::IntegrationType i);
PyObject *BPy_FrsMaterial_from_FrsMaterial(const Freestyle::FrsMaterial &m);
PyObject *BPy_Nature_from_Nature(unsigned short n);
PyObject *BPy_MediumType_from_MediumType(Freestyle::Stroke::MediumType n);
PyObject *BPy_SShape_from_SShape(Freestyle::SShape &ss);
PyObject *BPy_Stroke_from_Stroke(Freestyle::Stroke &s);
PyObject *BPy_StrokeAttribute_from_StrokeAttribute(Freestyle::StrokeAttribute &sa);
PyObject *BPy_StrokeVertex_from_StrokeVertex(Freestyle::StrokeVertex &sv);
PyObject *BPy_SVertex_from_SVertex(Freestyle::SVertex &sv);
PyObject *BPy_ViewVertex_from_ViewVertex(Freestyle::ViewVertex &vv);
PyObject *BPy_NonTVertex_from_NonTVertex(Freestyle::NonTVertex &ntv);
PyObject *BPy_TVertex_from_TVertex(Freestyle::TVertex &tv);
PyObject *BPy_ViewEdge_from_ViewEdge(Freestyle::ViewEdge &ve);
PyObject *BPy_Chain_from_Chain(Freestyle::Chain &c);
PyObject *BPy_ViewShape_from_ViewShape(Freestyle::ViewShape &vs);

PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(Freestyle::AdjacencyIterator &a_it);
PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Freestyle::Interface0DIterator &if0D_it,
                                                           bool reversed);
PyObject *BPy_CurvePointIterator_from_CurvePointIterator(
    Freestyle::CurveInternal::CurvePointIterator &cp_it);
PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator(
    Freestyle::StrokeInternal::StrokeVertexIterator &sv_it, bool reversed);
PyObject *BPy_SVertexIterator_from_SVertexIterator(
    Freestyle::ViewEdgeInternal::SVertexIterator &sv_it);
PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(
    Freestyle::ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed);
PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(
    Freestyle::ViewEdgeInternal::ViewEdgeIterator &ve_it);
PyObject *BPy_ChainingIterator_from_ChainingIterator(Freestyle::ChainingIterator &c_it);
PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(
    Freestyle::ChainPredicateIterator &cp_it);
PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(
    Freestyle::ChainSilhouetteIterator &cs_it);

//==============================
// Python => C++
//==============================

bool bool_from_PyBool(PyObject *b);
Freestyle::IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj);
Freestyle::Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj);
Freestyle::Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj);
bool Vec2f_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
bool Vec3f_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec3f &vec);
bool Vec3r_ptr_from_PyObject(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
bool Vec2f_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
bool Vec3f_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec3f &vec);
bool Vec3r_ptr_from_Vector(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
bool Vec3f_ptr_from_Color(PyObject *obj, Freestyle::Geometry::Vec3f &vec);
bool Vec3r_ptr_from_Color(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
bool Vec2f_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
bool Vec3f_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec3f &vec);
bool Vec3r_ptr_from_PyList(PyObject *obj, Freestyle::Geometry::Vec3r &vec);
bool Vec2f_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec2f &vec);
bool Vec3f_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec3f &vec);
bool Vec3r_ptr_from_PyTuple(PyObject *obj, Freestyle::Geometry::Vec3r &vec);

bool float_array_from_PyObject(PyObject *obj, float *v, int n);

int convert_v4(PyObject *obj, void *v);
int convert_v3(PyObject *obj, void *v);
int convert_v2(PyObject *obj, void *v);

///////////////////////////////////////////////////////////////////////////////////////////

#ifdef __cplusplus
}
#endif