2008-07-23 07:56:08 +00:00
|
|
|
#include "BPy_Convert.h"
|
2008-07-12 04:02:08 +00:00
|
|
|
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "BPy_BBox.h"
|
2008-08-01 02:25:21 +00:00
|
|
|
#include "BPy_FrsMaterial.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "BPy_Id.h"
|
|
|
|
|
#include "BPy_IntegrationType.h"
|
|
|
|
|
#include "BPy_Interface0D.h"
|
2008-09-25 16:35:53 +00:00
|
|
|
#include "Interface0D/BPy_CurvePoint.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "Interface0D/CurvePoint/BPy_StrokeVertex.h"
|
|
|
|
|
#include "Interface0D/BPy_SVertex.h"
|
|
|
|
|
#include "Interface0D/BPy_ViewVertex.h"
|
2008-07-30 01:51:40 +00:00
|
|
|
#include "BPy_Interface1D.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "Interface1D/BPy_FEdge.h"
|
2008-07-31 08:50:12 +00:00
|
|
|
#include "Interface1D/BPy_Stroke.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "Interface1D/BPy_ViewEdge.h"
|
|
|
|
|
#include "BPy_Nature.h"
|
|
|
|
|
#include "BPy_MediumType.h"
|
2008-07-25 01:38:19 +00:00
|
|
|
#include "BPy_SShape.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
#include "BPy_StrokeAttribute.h"
|
2008-07-25 01:38:19 +00:00
|
|
|
#include "BPy_ViewShape.h"
|
2008-07-24 20:39:13 +00:00
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
#include "Iterator/BPy_AdjacencyIterator.h"
|
|
|
|
|
#include "Iterator/BPy_ChainPredicateIterator.h"
|
|
|
|
|
#include "Iterator/BPy_ChainSilhouetteIterator.h"
|
|
|
|
|
#include "Iterator/BPy_ChainingIterator.h"
|
|
|
|
|
#include "Iterator/BPy_CurvePointIterator.h"
|
|
|
|
|
#include "Iterator/BPy_Interface0DIterator.h"
|
|
|
|
|
#include "Iterator/BPy_SVertexIterator.h"
|
|
|
|
|
#include "Iterator/BPy_StrokeVertexIterator.h"
|
|
|
|
|
#include "Iterator/BPy_ViewEdgeIterator.h"
|
|
|
|
|
#include "Iterator/BPy_orientedViewEdgeIterator.h"
|
|
|
|
|
|
2008-08-01 02:15:25 +00:00
|
|
|
#include "../stroke/StrokeRep.h"
|
|
|
|
|
|
2008-07-12 04:02:08 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2008-08-01 21:55:58 +00:00
|
|
|
//==============================
|
|
|
|
|
// C++ => Python
|
|
|
|
|
//==============================
|
|
|
|
|
|
2008-07-12 04:02:08 +00:00
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * PyBool_from_bool( bool b ){
|
2008-07-12 04:02:08 +00:00
|
|
|
return PyBool_FromLong( b ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * Vector_from_Vec2f( Vec2f& vec ) {
|
2008-07-12 04:02:08 +00:00
|
|
|
float vec_data[2]; // because vec->_coord is protected
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
vec_data[0] = vec.x(); vec_data[1] = vec.y();
|
|
|
|
|
return newVectorObject( vec_data, 2, Py_NEW);
|
2008-07-12 04:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * Vector_from_Vec3f( Vec3f& vec ) {
|
2008-07-12 04:02:08 +00:00
|
|
|
float vec_data[3]; // because vec->_coord is protected
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
vec_data[0] = vec.x(); vec_data[1] = vec.y(); vec_data[2] = vec.z();
|
|
|
|
|
return newVectorObject( vec_data, 3, Py_NEW);
|
2008-07-12 04:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * Vector_from_Vec3r( Vec3r& vec ) {
|
2008-07-12 04:02:08 +00:00
|
|
|
float vec_data[3]; // because vec->_coord is protected
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
vec_data[0] = vec.x(); vec_data[1] = vec.y(); vec_data[2] = vec.z();
|
|
|
|
|
return newVectorObject( vec_data, 3, Py_NEW);
|
|
|
|
|
}
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * BPy_Id_from_Id( Id& id ) {
|
2008-07-18 02:55:23 +00:00
|
|
|
PyObject *py_id = Id_Type.tp_new( &Id_Type, 0, 0 );
|
|
|
|
|
((BPy_Id *) py_id)->id = new Id( id.getFirst(), id.getSecond() );
|
|
|
|
|
|
|
|
|
|
return py_id;
|
2008-07-12 04:02:08 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D ) {
|
2008-07-18 02:55:23 +00:00
|
|
|
PyObject *py_if0D = Interface0D_Type.tp_new( &Interface0D_Type, 0, 0 );
|
|
|
|
|
((BPy_Interface0D *) py_if0D)->if0D = &if0D;
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
return py_if0D;
|
2008-07-15 01:07:19 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-30 01:51:40 +00:00
|
|
|
PyObject * BPy_Interface1D_from_Interface1D( Interface1D& if1D ) {
|
|
|
|
|
PyObject *py_if1D = Interface1D_Type.tp_new( &Interface1D_Type, 0, 0 );
|
|
|
|
|
((BPy_Interface1D *) py_if1D)->if1D = &if1D;
|
|
|
|
|
|
|
|
|
|
return py_if1D;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyObject * BPy_SVertex_from_SVertex_ptr( SVertex *sv ) {
|
2008-07-18 02:55:23 +00:00
|
|
|
PyObject *py_sv = SVertex_Type.tp_new( &SVertex_Type, 0, 0 );
|
2008-08-02 07:39:49 +00:00
|
|
|
((BPy_SVertex *) py_sv)->sv = sv;
|
2008-07-18 02:55:23 +00:00
|
|
|
((BPy_SVertex *) py_sv)->py_if0D.if0D = ((BPy_SVertex *) py_sv)->sv;
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
return py_sv;
|
|
|
|
|
}
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * BPy_FEdge_from_FEdge( FEdge& fe ) {
|
2008-07-18 02:55:23 +00:00
|
|
|
PyObject *py_fe = FEdge_Type.tp_new( &FEdge_Type, 0, 0 );
|
|
|
|
|
((BPy_FEdge *) py_fe)->fe = new FEdge( fe );
|
|
|
|
|
((BPy_FEdge *) py_fe)->py_if1D.if1D = ((BPy_FEdge *) py_fe)->fe;
|
2008-07-17 06:35:30 +00:00
|
|
|
|
2008-07-18 02:55:23 +00:00
|
|
|
return py_fe;
|
2008-07-17 06:35:30 +00:00
|
|
|
}
|
2008-07-18 02:55:23 +00:00
|
|
|
|
2008-07-20 05:01:29 +00:00
|
|
|
PyObject * BPy_Nature_from_Nature( unsigned short n ) {
|
2008-11-08 23:56:16 +00:00
|
|
|
PyObject *py_n;
|
2008-07-20 05:01:29 +00:00
|
|
|
|
|
|
|
|
PyObject *args = PyTuple_New(1);
|
|
|
|
|
PyTuple_SetItem( args, 0, PyInt_FromLong(n) );
|
2008-11-08 23:56:16 +00:00
|
|
|
py_n = Nature_Type.tp_new(&Nature_Type, args, NULL);
|
2008-07-20 05:01:29 +00:00
|
|
|
Py_DECREF(args);
|
|
|
|
|
|
|
|
|
|
return py_n;
|
|
|
|
|
}
|
2008-07-18 02:55:23 +00:00
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyObject * BPy_Stroke_from_Stroke_ptr( Stroke* s ) {
|
2008-07-31 08:50:12 +00:00
|
|
|
PyObject *py_s = Stroke_Type.tp_new( &Stroke_Type, 0, 0 );
|
2008-08-02 07:39:49 +00:00
|
|
|
((BPy_Stroke *) py_s)->s = s;
|
2008-07-31 08:50:12 +00:00
|
|
|
((BPy_Stroke *) py_s)->py_if1D.if1D = ((BPy_Stroke *) py_s)->s;
|
|
|
|
|
|
|
|
|
|
return py_s;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyObject * BPy_StrokeAttribute_from_StrokeAttribute_ptr( StrokeAttribute *sa ) {
|
2008-07-22 08:15:21 +00:00
|
|
|
PyObject *py_sa = StrokeAttribute_Type.tp_new( &StrokeAttribute_Type, 0, 0 );
|
2008-08-02 07:39:49 +00:00
|
|
|
((BPy_StrokeAttribute *) py_sa)->sa = sa;
|
2008-07-22 08:15:21 +00:00
|
|
|
return py_sa;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-23 07:56:08 +00:00
|
|
|
PyObject * BPy_MediumType_from_MediumType( int n ) {
|
2008-07-23 05:54:34 +00:00
|
|
|
PyObject *py_mt = MediumType_Type.tp_new( &MediumType_Type, 0, 0 );
|
|
|
|
|
|
|
|
|
|
PyObject *args = PyTuple_New(1);
|
|
|
|
|
PyTuple_SetItem( args, 0, PyInt_FromLong(n) );
|
|
|
|
|
MediumType_Type.tp_init( py_mt, args, 0 );
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
|
|
|
|
|
return py_mt;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyObject * BPy_StrokeVertex_from_StrokeVertex_ptr( StrokeVertex *sv ) {
|
2008-07-23 05:54:34 +00:00
|
|
|
PyObject *py_sv = StrokeVertex_Type.tp_new( &StrokeVertex_Type, 0, 0 );
|
2008-08-02 07:39:49 +00:00
|
|
|
((BPy_StrokeVertex *) py_sv)->sv = sv;
|
2008-07-23 05:54:34 +00:00
|
|
|
((BPy_StrokeVertex *) py_sv)->py_cp.cp = ((BPy_StrokeVertex *) py_sv)->sv;
|
|
|
|
|
((BPy_StrokeVertex *) py_sv)->py_cp.py_if0D.if0D = ((BPy_StrokeVertex *) py_sv)->sv;
|
|
|
|
|
|
|
|
|
|
return py_sv;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-24 08:29:48 +00:00
|
|
|
PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv ) {
|
|
|
|
|
PyObject *py_vv = ViewVertex_Type.tp_new( &ViewVertex_Type, 0, 0 );
|
|
|
|
|
((BPy_ViewVertex *) py_vv)->vv = vv;
|
|
|
|
|
((BPy_ViewVertex *) py_vv)->py_if0D.if0D = ((BPy_ViewVertex *) py_vv)->vv;
|
|
|
|
|
|
|
|
|
|
return py_vv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb ) {
|
|
|
|
|
PyObject *py_bb = BBox_Type.tp_new( &BBox_Type, 0, 0 );
|
|
|
|
|
((BPy_BBox *) py_bb)->bb = new BBox< Vec3r >( bb );
|
|
|
|
|
|
|
|
|
|
return py_bb;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyObject * BPy_ViewEdge_from_ViewEdge_ptr( ViewEdge* ve ) {
|
2008-07-24 08:29:48 +00:00
|
|
|
PyObject *py_ve = ViewEdge_Type.tp_new( &ViewEdge_Type, 0, 0 );
|
2008-08-02 07:39:49 +00:00
|
|
|
((BPy_ViewEdge *) py_ve)->ve = ve;
|
2008-07-24 08:29:48 +00:00
|
|
|
((BPy_ViewEdge *) py_ve)->py_if1D.if1D = ((BPy_ViewEdge *) py_ve)->ve;
|
|
|
|
|
|
|
|
|
|
return py_ve;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_SShape_from_SShape( SShape& ss ) {
|
|
|
|
|
PyObject *py_ss = SShape_Type.tp_new( &SShape_Type, 0, 0 );
|
|
|
|
|
((BPy_SShape *) py_ss)->ss = new SShape( ss );
|
|
|
|
|
|
|
|
|
|
return py_ss;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-25 01:38:19 +00:00
|
|
|
PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs ) {
|
|
|
|
|
PyObject *py_vs = ViewShape_Type.tp_new( &ViewShape_Type, 0, 0 );
|
|
|
|
|
((BPy_ViewShape *) py_vs)->vs = new ViewShape( vs );
|
|
|
|
|
|
|
|
|
|
return py_vs;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-07 15:04:25 +00:00
|
|
|
PyObject * BPy_FrsMaterial_from_FrsMaterial( FrsMaterial& m ){
|
2008-08-01 02:25:21 +00:00
|
|
|
PyObject *py_m = FrsMaterial_Type.tp_new( &FrsMaterial_Type, 0, 0 );
|
2008-08-07 15:04:25 +00:00
|
|
|
((BPy_FrsMaterial*) py_m)->m = new FrsMaterial( m );
|
2008-07-24 21:32:50 +00:00
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
return py_m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_IntegrationType_from_IntegrationType( int i ) {
|
|
|
|
|
PyObject *py_it = IntegrationType_Type.tp_new( &IntegrationType_Type, 0, 0 );
|
|
|
|
|
|
|
|
|
|
PyObject *args = PyTuple_New(1);
|
|
|
|
|
PyTuple_SetItem( args, 0, PyInt_FromLong(i) );
|
|
|
|
|
IntegrationType_Type.tp_init( py_it, args, 0 );
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
|
|
|
|
|
return py_it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp ) {
|
|
|
|
|
PyObject *py_cp = CurvePoint_Type.tp_new( &CurvePoint_Type, 0, 0 );
|
|
|
|
|
((BPy_CurvePoint*) py_cp)->cp = new CurvePoint( cp );
|
|
|
|
|
|
|
|
|
|
return py_cp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve ) {
|
|
|
|
|
PyObject *py_dve = PyList_New(2);
|
|
|
|
|
|
2008-08-02 07:39:49 +00:00
|
|
|
PyList_SetItem( py_dve, 0, BPy_ViewEdge_from_ViewEdge_ptr(dve.first) );
|
2008-07-29 05:45:16 +00:00
|
|
|
PyList_SetItem( py_dve, 1, PyBool_from_bool(dve.second) );
|
|
|
|
|
|
|
|
|
|
return py_dve;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==============================
|
|
|
|
|
// Iterators
|
|
|
|
|
//==============================
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator( AdjacencyIterator& a_it ) {
|
|
|
|
|
PyObject *py_a_it = AdjacencyIterator_Type.tp_new( &AdjacencyIterator_Type, 0, 0 );
|
|
|
|
|
((BPy_AdjacencyIterator *) py_a_it)->a_it = new AdjacencyIterator( a_it );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_AdjacencyIterator *) py_a_it)->py_it.it = ((BPy_AdjacencyIterator *) py_a_it)->a_it;
|
2008-07-29 05:45:16 +00:00
|
|
|
|
|
|
|
|
return py_a_it;
|
2008-07-24 21:32:50 +00:00
|
|
|
}
|
2008-07-24 08:29:48 +00:00
|
|
|
|
2008-07-25 00:18:10 +00:00
|
|
|
PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& if0D_it ) {
|
|
|
|
|
PyObject *py_if0D_it = Interface0DIterator_Type.tp_new( &Interface0DIterator_Type, 0, 0 );
|
|
|
|
|
((BPy_Interface0DIterator *) py_if0D_it)->if0D_it = new Interface0DIterator( if0D_it );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_Interface0DIterator *) py_if0D_it)->py_it.it = ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it;
|
2008-07-25 00:18:10 +00:00
|
|
|
|
|
|
|
|
return py_if0D_it;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_CurvePointIterator_from_CurvePointIterator( CurveInternal::CurvePointIterator& cp_it ) {
|
|
|
|
|
PyObject *py_cp_it = CurvePointIterator_Type.tp_new( &CurvePointIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_CurvePointIterator *) py_cp_it)->cp_it = new CurveInternal::CurvePointIterator( cp_it );
|
|
|
|
|
((BPy_CurvePointIterator *) py_cp_it)->py_it.it = ((BPy_CurvePointIterator *) py_cp_it)->cp_it;
|
2008-07-29 05:45:16 +00:00
|
|
|
|
|
|
|
|
return py_cp_it;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-01 11:14:33 +00:00
|
|
|
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator& sv_it, int reversed) {
|
2008-07-25 00:18:10 +00:00
|
|
|
PyObject *py_sv_it = StrokeVertexIterator_Type.tp_new( &StrokeVertexIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_StrokeVertexIterator *) py_sv_it)->sv_it = new StrokeInternal::StrokeVertexIterator( sv_it );
|
|
|
|
|
((BPy_StrokeVertexIterator *) py_sv_it)->py_it.it = ((BPy_StrokeVertexIterator *) py_sv_it)->sv_it;
|
2008-12-01 11:14:33 +00:00
|
|
|
((BPy_StrokeVertexIterator *) py_sv_it)->reversed = reversed;
|
2008-07-25 00:18:10 +00:00
|
|
|
|
|
|
|
|
return py_sv_it;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_SVertexIterator_from_SVertexIterator( ViewEdgeInternal::SVertexIterator& sv_it ) {
|
|
|
|
|
PyObject *py_sv_it = SVertexIterator_Type.tp_new( &SVertexIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_SVertexIterator *) py_sv_it)->sv_it = new ViewEdgeInternal::SVertexIterator( sv_it );
|
|
|
|
|
((BPy_SVertexIterator *) py_sv_it)->py_it.it = ((BPy_SVertexIterator *) py_sv_it)->sv_it;
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
return py_sv_it;
|
2008-07-26 02:33:21 +00:00
|
|
|
}
|
2008-07-25 01:38:19 +00:00
|
|
|
|
2008-08-01 02:15:25 +00:00
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it ) {
|
|
|
|
|
PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new( &orientedViewEdgeIterator_Type, 0, 0 );
|
|
|
|
|
((BPy_orientedViewEdgeIterator *) py_ove_it)->ove_it = new ViewVertexInternal::orientedViewEdgeIterator( ove_it );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_orientedViewEdgeIterator *) py_ove_it)->py_it.it = ((BPy_orientedViewEdgeIterator *) py_ove_it)->ove_it;
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
return py_ove_it;
|
|
|
|
|
}
|
2008-07-27 11:27:59 +00:00
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_ViewEdgeIterator_from_ViewEdgeIterator( ViewEdgeInternal::ViewEdgeIterator& ve_it ) {
|
|
|
|
|
PyObject *py_ve_it = ViewEdgeIterator_Type.tp_new( &ViewEdgeIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_ViewEdgeIterator *) py_ve_it)->ve_it = new ViewEdgeInternal::ViewEdgeIterator( ve_it );
|
|
|
|
|
((BPy_ViewEdgeIterator *) py_ve_it)->py_it.it = ((BPy_ViewEdgeIterator *) py_ve_it)->ve_it;
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
return py_ve_it;
|
2008-07-27 11:27:59 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_ChainingIterator_from_ChainingIterator( ChainingIterator& c_it ) {
|
|
|
|
|
PyObject *py_c_it = ChainingIterator_Type.tp_new( &ChainingIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_ChainingIterator *) py_c_it)->c_it = new ChainingIterator( c_it );
|
|
|
|
|
((BPy_ChainingIterator *) py_c_it)->py_ve_it.py_it.it = ((BPy_ChainingIterator *) py_c_it)->c_it;
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
return py_c_it;
|
2008-07-27 11:27:59 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-29 05:45:16 +00:00
|
|
|
PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator( ChainPredicateIterator& cp_it ) {
|
|
|
|
|
PyObject *py_cp_it = ChainPredicateIterator_Type.tp_new( &ChainPredicateIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_ChainPredicateIterator *) py_cp_it)->cp_it = new ChainPredicateIterator( cp_it );
|
|
|
|
|
((BPy_ChainPredicateIterator *) py_cp_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainPredicateIterator *) py_cp_it)->cp_it;
|
2008-07-29 05:45:16 +00:00
|
|
|
|
|
|
|
|
return py_cp_it;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator( ChainSilhouetteIterator& cs_it ) {
|
|
|
|
|
PyObject *py_cs_it = ChainSilhouetteIterator_Type.tp_new( &ChainSilhouetteIterator_Type, 0, 0 );
|
2008-08-01 02:15:25 +00:00
|
|
|
((BPy_ChainSilhouetteIterator *) py_cs_it)->cs_it = new ChainSilhouetteIterator( cs_it );
|
|
|
|
|
((BPy_ChainSilhouetteIterator *) py_cs_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainSilhouetteIterator *) py_cs_it)->cs_it;
|
2008-07-29 05:45:16 +00:00
|
|
|
|
|
|
|
|
return py_cs_it;
|
2008-07-27 13:40:33 +00:00
|
|
|
}
|
2008-07-27 11:27:59 +00:00
|
|
|
|
2008-07-25 01:38:19 +00:00
|
|
|
|
2008-08-01 21:55:58 +00:00
|
|
|
//==============================
|
|
|
|
|
// Python => C++
|
|
|
|
|
//==============================
|
|
|
|
|
|
|
|
|
|
bool bool_from_PyBool( PyObject *b ) {
|
2008-08-02 07:39:49 +00:00
|
|
|
return (b == Py_True || PyInt_AsLong(b) != 0);
|
2008-08-01 21:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
|
|
|
|
|
return static_cast<IntegrationType>( PyInt_AsLong(obj) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
|
|
|
|
|
return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
|
|
|
|
|
}
|
2008-07-29 05:45:16 +00:00
|
|
|
|
2008-08-01 21:55:58 +00:00
|
|
|
Nature::EdgeNature EdgeNature_from_BPy_Nature( PyObject* obj ) {
|
|
|
|
|
return static_cast<Nature::EdgeNature>( PyInt_AsLong(obj) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vec2f * Vec2f_ptr_from_Vector( PyObject* obj ) {
|
|
|
|
|
float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
|
|
|
|
float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
|
|
|
|
|
|
|
|
|
return new Vec2f(x,y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vec3f * Vec3f_ptr_from_Vector( PyObject* obj ) {
|
|
|
|
|
float x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
|
|
|
|
float y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
|
|
|
|
float z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
|
|
|
|
|
|
|
|
|
|
return new Vec3f(x,y,z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Vec3r * Vec3r_ptr_from_Vector( PyObject* obj ) {
|
|
|
|
|
double x = PyFloat_AsDouble( PyObject_GetAttrString(obj,"x") );
|
|
|
|
|
double y = PyFloat_AsDouble( PyObject_GetAttrString(obj,"y") );
|
|
|
|
|
double z = PyFloat_AsDouble( PyObject_GetAttrString(obj,"z") );
|
|
|
|
|
|
|
|
|
|
return new Vec3r(x,y,z);
|
|
|
|
|
}
|
2008-07-29 05:45:16 +00:00
|
|
|
|
|
|
|
|
|
2008-07-12 04:02:08 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
2008-11-08 23:56:16 +00:00
|
|
|
#endif
|