diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-24 12:29:48 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-24 12:29:48 +0400 |
commit | a0359c37506d05589bae86e4818fa653c8f281ab (patch) | |
tree | 35927f22801fa65585ac6f076abb29406189dd2a /source/blender/freestyle/intern/python | |
parent | dd899939dabae68564f7a1d1994b50ee2f2cf8be (diff) |
soc-2008-mxcurioni: added (without testing) the following classes: BBox, SShape, ViewShape. Also corrected a few typos (Get#->get#).
Diffstat (limited to 'source/blender/freestyle/intern/python')
20 files changed, 1127 insertions, 360 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp new file mode 100644 index 00000000000..ac15672580d --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -0,0 +1,142 @@ +#include "BPy_BBox.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for BBox instance -----------*/ +static int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds); +static void BBox___dealloc__(BPy_BBox *self); +static PyObject * BBox___repr__(BPy_BBox *self); + +/*----------------------BBox instance definitions ----------------------------*/ +static PyMethodDef BPy_BBox_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_BBox type definition ------------------------------*/ + +PyTypeObject BBox_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "BBox", /* tp_name */ + sizeof( BPy_BBox ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)BBox___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)BBox___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_BBox_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)BBox___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC BBox_Init( PyObject *module ) +{ + if( module == NULL ) + return; + + if( PyType_Ready( &BBox_Type ) < 0 ) + return; + + Py_INCREF( &BBox_Type ); + PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); +} + +//------------------------INSTANCE METHODS ---------------------------------- + +int BBox___init__(BPy_BBox *self, PyObject *args, PyObject *kwds) +{ + self->bb = new BBox< Vec3r>(); + return 0; +} + +void BBox___dealloc__(BPy_BBox* self) +{ + delete self->bb; + self->ob_type->tp_free((PyObject*)self); +} + + +PyObject * BBox___repr__(BPy_BBox* self) +{ + return PyString_FromFormat("BBox - address: %p", self->bb ); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/BPy_BBox.h b/source/blender/freestyle/intern/python/BPy_BBox.h new file mode 100644 index 00000000000..88bba3301bb --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_BBox.h @@ -0,0 +1,38 @@ +#ifndef FREESTYLE_PYTHON_BBOX_H +#define FREESTYLE_PYTHON_BBOX_H + +#include "../geometry/BBox.h" +#include "../geometry/Geom.h" +using namespace Geometry; + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject BBox_Type; + +#define BPy_BBox_Check(v) (( (PyObject *) v)->ob_type == &BBox_Type) + +/*---------------------------Python BPy_BBox structure definition----------*/ +typedef struct { + PyObject_HEAD + BBox<Vec3r> *bb; +} BPy_BBox; + +/*---------------------------Python BPy_BBox visible prototypes-----------*/ + +PyMODINIT_FUNC BBox_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + + +#endif /* FREESTYLE_PYTHON_BBOX_H */ diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 89fa677aac0..c052acb446f 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -105,6 +105,37 @@ PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv ) { return py_sv; } +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; +} + +PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve ) { + PyObject *py_ve = ViewEdge_Type.tp_new( &ViewEdge_Type, 0, 0 ); + ((BPy_ViewEdge *) py_ve)->ve = new ViewEdge( ve ); + ((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; +} + + /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 16f991e0e51..6bf05dc8047 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -4,12 +4,17 @@ #include "../geometry/Geom.h" using namespace Geometry; + +#include "BPy_BBox.h" #include "BPy_Id.h" #include "BPy_IntegrationType.h" #include "BPy_Interface0D.h" #include "Interface0D/CurvePoint/BPy_StrokeVertex.h" #include "Interface0D/BPy_SVertex.h" +#include "Interface0D/BPy_ViewVertex.h" #include "Interface1D/BPy_FEdge.h" +#include "Interface1D/BPy_ViewEdge.h" +#include "BPy_SShape.h" #include "BPy_Nature.h" #include "BPy_MediumType.h" #include "BPy_StrokeAttribute.h" @@ -31,14 +36,18 @@ PyObject * Vector_from_Vec2f( Vec2f& v ); PyObject * Vector_from_Vec3f( Vec3f& v ); PyObject * Vector_from_Vec3r( Vec3r& v ); +PyObject * BPy_BBox_from_BBox( BBox< Vec3r > &bb ); PyObject * BPy_FEdge_from_FEdge( FEdge& fe ); PyObject * BPy_Id_from_Id( Id& id ); PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D ); PyObject * BPy_Nature_from_Nature( unsigned short n ); PyObject * BPy_MediumType_from_MediumType( int n ); +PyObject * BPy_SShape_from_SShape( SShape& ss ); PyObject * BPy_StrokeAttribute_from_StrokeAttribute( StrokeAttribute& sa ); PyObject * BPy_StrokeVertex_from_StrokeVertex( StrokeVertex& sv ); PyObject * BPy_SVertex_from_SVertex( SVertex& sv ); +PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv ); +PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve ); /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index a6ef92d8f51..0496060d0f3 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -1,5 +1,6 @@ #include "BPy_Freestyle.h" +#include "BPy_BBox.h" #include "BPy_BinaryPredicate0D.h" #include "BPy_BinaryPredicate1D.h" #include "BPy_Id.h" @@ -10,12 +11,15 @@ #include "BPy_Interface1D.h" #include "BPy_MediumType.h" #include "BPy_Nature.h" +#include "BPy_SShape.h" #include "BPy_StrokeAttribute.h" #include "BPy_StrokeShader.h" #include "BPy_UnaryFunction0D.h" #include "BPy_UnaryFunction1D.h" #include "BPy_UnaryPredicate0D.h" #include "BPy_UnaryPredicate1D.h" +#include "BPy_ViewShape.h" + #ifdef __cplusplus extern "C" { @@ -137,6 +141,7 @@ PyObject *Freestyle_Init( void ) MediumType_Init( module ); Nature_Init( module ); + BBox_Init( module ); BinaryPredicate0D_Init( module ); BinaryPredicate1D_Init( module ); Id_Init( module ); @@ -144,12 +149,14 @@ PyObject *Freestyle_Init( void ) Interface0D_Init( module ); Interface1D_Init( module ); Iterator_Init( module ); + SShape_Init( module ); StrokeAttribute_Init( module ); StrokeShader_Init( module ); UnaryFunction0D_Init( module ); UnaryFunction1D_Init( module ); UnaryPredicate0D_Init( module ); UnaryPredicate1D_Init( module ); + ViewShape_Init( module ); return module; } diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 113fc3f1cf7..ec881b010ee 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -3,6 +3,7 @@ #include "BPy_Convert.h" #include "Interface1D/BPy_FEdge.h" #include "Interface1D/BPy_Stroke.h" +#include "Interface1D/BPy_ViewEdge.h" #include "BPy_MediumType.h" #ifdef __cplusplus @@ -150,6 +151,11 @@ PyMODINIT_FUNC Interface1D_Init( PyObject *module ) tmp = BPy_MediumType_from_MediumType( Stroke::HUMID_MEDIUM ); PyDict_SetItemString( Stroke_Type.tp_dict, "HUMID_MEDIUM", tmp); Py_DECREF(tmp); tmp = BPy_MediumType_from_MediumType( Stroke::OPAQUE_MEDIUM ); PyDict_SetItemString( Stroke_Type.tp_dict, "OPAQUE_MEDIUM", tmp); Py_DECREF(tmp); + if( PyType_Ready( &ViewEdge_Type ) < 0 ) + return; + Py_INCREF( &ViewEdge_Type ); + PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type); + } diff --git a/source/blender/freestyle/intern/python/BPy_Material.h b/source/blender/freestyle/intern/python/BPy_Material.h new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_Material.h diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index a5b1cf3f27a..62c554aab51 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -1,120 +1,277 @@ - PyObject *_wrap_SShape_userdata_set(PyObject *self , PyObject *args) { +#include "BPy_SShape.h" + +#include "BPy_Convert.h" +#include "Interface0D/BPy_SVertex.h" +#include "Interface1D/BPy_FEdge.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for SShape instance -----------*/ +static int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds); +static void SShape___dealloc__(BPy_SShape *self); +static PyObject * SShape___repr__(BPy_SShape* self); + +static PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args); +static PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args); +static PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args); +static PyObject * SShape_ComputeBBox( BPy_SShape *self ); +static PyObject * SShape_bbox( BPy_SShape *self ); +static PyObject * SShape_getVertexList( BPy_SShape *self ); +static PyObject * SShape_getEdgeList( BPy_SShape *self ); +static PyObject * SShape_getId( BPy_SShape *self ); +static PyObject * SShape_setId( BPy_SShape *self , PyObject *args); + +/*----------------------SShape instance definitions ----------------------------*/ +static PyMethodDef BPy_SShape_methods[] = { + {"AddEdge", ( PyCFunction ) SShape_AddEdge, METH_VARARGS, "(FEdge fe )Adds a FEdge to the list of FEdges. "}, + {"AddNewVertex", ( PyCFunction ) SShape_AddNewVertex, METH_VARARGS, "(SVertex sv )Adds a SVertex to the list of SVertex of this Shape. The SShape attribute of the SVertex is also set to 'this'."}, + {"setBBox", ( PyCFunction ) SShape_setBBox, METH_VARARGS, "(BBox bb )Sets the Bounding Box of the Shape"}, + {"ComputeBBox", ( PyCFunction ) SShape_ComputeBBox, METH_NOARGS, "( )Compute the bbox of the SShape"}, + {"bbox", ( PyCFunction ) SShape_bbox, METH_NOARGS, "( )Returns the bounding box of the shape."}, + {"getVertexList", ( PyCFunction ) SShape_getVertexList, METH_NOARGS, "( )Returns the list of SVertex of the Shape"}, + {"getEdgeList", ( PyCFunction ) SShape_getEdgeList, METH_NOARGS, "( )Returns the list of FEdges of the Shape."}, + {"getId", ( PyCFunction ) SShape_getId, METH_NOARGS, "( )Returns the Id of the Shape. "}, + {"setId", ( PyCFunction ) SShape_setId, METH_VARARGS, "(Id id )Sets the Id of the shape. "}, + + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_SShape type definition ------------------------------*/ + +PyTypeObject SShape_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "SShape", /* tp_name */ + sizeof( BPy_SShape ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)SShape___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)SShape___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_SShape_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)SShape___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC SShape_Init( PyObject *module ) +{ + if( module == NULL ) + return; + + if( PyType_Ready( &SShape_Type ) < 0 ) + return; + + Py_INCREF( &SShape_Type ); + PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type); } +//------------------------INSTANCE METHODS ---------------------------------- - PyObject *_wrap_SShape_userdata_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_SShape__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_SShape__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_SShape(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_SShape_dupplicate(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_delete_SShape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_SShape_AddEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_SShape_AddNewVertex(PyObject *self , PyObject *args) { -} +int SShape___init__(BPy_SShape *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + if (! PyArg_ParseTuple(args, "|O", &obj) ) + return -1; - PyObject *_wrap_SShape_AddChain(PyObject *self , PyObject *args) { + if( !obj ) { + self->ss = new SShape(); + + } else if( BPy_SShape_Check(obj) ) { + self->ss = new SShape(*( ((BPy_SShape *) obj)->ss )); + } + + return 0; } - - PyObject *_wrap_SShape_CreateSVertex(PyObject *self , PyObject *args) { +void SShape___dealloc__(BPy_SShape *self) +{ + delete self->ss; + self->ob_type->tp_free((PyObject*)self); } - - PyObject *_wrap_SShape_SplitEdge(PyObject *self , PyObject *args) { +PyObject * SShape___repr__(BPy_SShape *self) +{ + return PyString_FromFormat("SShape - address: %p", self->ss ); } +PyObject * SShape_AddEdge( BPy_SShape *self , PyObject *args) { + PyObject *py_fe = 0; - PyObject *_wrap_SShape_SplitEdgeIn2(PyObject *self , PyObject *args) { -} - + if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_FEdge_Check(py_fe) )) { + cout << "ERROR: SShape_AddEdge" << endl; + Py_RETURN_NONE; + } + + self->ss->AddEdge( ((BPy_FEdge *) py_fe)->fe ); - PyObject *_wrap_SShape_SetBBox(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * SShape_AddNewVertex( BPy_SShape *self , PyObject *args) { + PyObject *py_sv = 0; - PyObject *_wrap_SShape_ComputeBBox(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { + cout << "ERROR: SShape_AddNewVertex" << endl; + Py_RETURN_NONE; + } + + self->ss->AddNewVertex( ((BPy_SVertex *) py_sv)->sv ); - - PyObject *_wrap_SShape_RemoveEdgeFromChain(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * SShape_setBBox( BPy_SShape *self , PyObject *args) { + PyObject *py_bb = 0; - PyObject *_wrap_SShape_RemoveEdge(PyObject *self , PyObject *args) { -} - + if(!( PyArg_ParseTuple(args, "O", &py_bb) && BPy_BBox_Check(py_bb) )) { + cout << "ERROR: SShape_SetBBox" << endl; + Py_RETURN_NONE; + } + + self->ss->setBBox(*( ((BPy_BBox*) py_bb)->bb )); - PyObject *_wrap_SShape_GetVertexList(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * SShape_ComputeBBox( BPy_SShape *self ) { + self->ss->ComputeBBox(); - PyObject *_wrap_SShape_GetEdgeList(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } - - PyObject *_wrap_SShape_GetChains(PyObject *self , PyObject *args) { +PyObject * SShape_bbox( BPy_SShape *self ) { + BBox<Vec3r> bb( self->ss->bbox() ); + return BPy_BBox_from_BBox( bb ); } - PyObject *_wrap_SShape_bbox(PyObject *self , PyObject *args) { -} +PyObject * SShape_getVertexList( BPy_SShape *self ) { + PyObject *py_vertices = PyList_New(NULL); - - PyObject *_wrap_SShape_material(PyObject *self , PyObject *args) { + vector< SVertex * > vertices = self->ss->getVertexList(); + vector< SVertex * >::iterator it; + + for( it = vertices.begin(); it != vertices.end(); it++ ) { + PyList_Append( py_vertices, BPy_SVertex_from_SVertex(*( *it )) ); + } + + return py_vertices; } - PyObject *_wrap_SShape_materials(PyObject *self , PyObject *args) { -} - +PyObject * SShape_getEdgeList( BPy_SShape *self ) { + PyObject *py_edges = PyList_New(NULL); - PyObject *_wrap_SShape_viewShape(PyObject *self , PyObject *args) { + vector< FEdge * > edges = self->ss->getEdgeList(); + vector< FEdge * >::iterator it; + + for( it = edges.begin(); it != edges.end(); it++ ) { + PyList_Append( py_edges, BPy_FEdge_from_FEdge(*( *it )) ); + } + + return py_edges; } - - PyObject *_wrap_SShape_importance(PyObject *self , PyObject *args) { +PyObject * SShape_getId( BPy_SShape *self ) { + Id id( self->ss->getId() ); + return BPy_Id_from_Id( id ); } +PyObject * SShape_setId( BPy_SShape *self , PyObject *args) { + PyObject *py_id; - PyObject *_wrap_SShape_getId(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "O", &py_id) && BPy_Id_Check(py_id) )) { + cout << "ERROR: SShape_setId" << endl; + Py_RETURN_NONE; + } + self->ss->setId(*( ((BPy_Id *) py_id)->id )); - PyObject *_wrap_SShape_SetId(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } - PyObject *_wrap_SShape_SetMaterials(PyObject *self , PyObject *args) { -} - +// const Material & material (unsigned i) const +// const vector< Material > & materials () const +// void SetMaterials (const vector< Material > &iMaterials) - PyObject *_wrap_SShape_SetViewShape(PyObject *self , PyObject *args) { -} +/////////////////////////////////////////////////////////////////////////////////////////// - PyObject *_wrap_SShape_SetImportance(PyObject *self , PyObject *args) { +#ifdef __cplusplus } - - +#endif
\ No newline at end of file diff --git a/source/blender/freestyle/intern/python/BPy_SShape.h b/source/blender/freestyle/intern/python/BPy_SShape.h new file mode 100644 index 00000000000..2064b6c4b64 --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_SShape.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_SSHAPE_H +#define FREESTYLE_PYTHON_SSHAPE_H + +#include "../view_map/Silhouette.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject SShape_Type; + +#define BPy_SShape_Check(v) (( (PyObject *) v)->ob_type == &SShape_Type) + +/*---------------------------Python BPy_SShape structure definition----------*/ +typedef struct { + PyObject_HEAD + SShape *ss; +} BPy_SShape; + +/*---------------------------Python BPy_SShape visible prototypes-----------*/ + +PyMODINIT_FUNC SShape_Init( PyObject *module ); + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_SSHAPE_H */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 023ce06f44f..3ac2c02a274 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -1,88 +1,291 @@ - PyObject *_wrap_ViewShape_userdata_set(PyObject *self , PyObject *args) { +#include "BPy_ViewShape.h" + +#include "BPy_Convert.h" +#include "Interface0D/BPy_ViewVertex.h" +#include "Interface1D/BPy_ViewEdge.h" +#include "BPy_SShape.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for ViewShape instance -----------*/ +static int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds); +static void ViewShape___dealloc__(BPy_ViewShape *self); +static PyObject * ViewShape___repr__(BPy_ViewShape* self); + + +/*---------------------- BPy_ViewShape instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewShape_methods[] = { + //{"AddEdge", ( PyCFunction ) ViewShape_AddEdge, METH_VARARGS, "(FEdge fe )Adds a FEdge to the list of FEdges. "}, + + + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewShape type definition ------------------------------*/ + +PyTypeObject ViewShape_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "ViewShape", /* tp_name */ + sizeof( BPy_ViewShape ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + (destructor)ViewShape___dealloc__, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + (reprfunc)ViewShape___repr__, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_ViewShape_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)ViewShape___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + PyType_GenericNew, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//-------------------MODULE INITIALIZATION-------------------------------- +PyMODINIT_FUNC ViewShape_Init( PyObject *module ) +{ + if( module == NULL ) + return; + + if( PyType_Ready( &ViewShape_Type ) < 0 ) + return; + + Py_INCREF( &ViewShape_Type ); + PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type); } - - PyObject *_wrap_ViewShape_userdata_get(PyObject *self , PyObject *args) { +//------------------------INSTANCE METHODS ---------------------------------- + +int ViewShape___init__(BPy_ViewShape *self, PyObject *args, PyObject *kwds) +{ + PyObject *obj; + + if (! PyArg_ParseTuple(args, "|O", &obj) ) + return -1; + + if( !obj ) { + self->vs = new ViewShape(); + + } else if( BPy_ViewShape_Check(obj) ) { + self->vs = new ViewShape( ((BPy_SShape *) obj)->ss ); + + } else if( BPy_ViewShape_Check(obj) ) { + self->vs = new ViewShape(*( ((BPy_ViewShape *) obj)->vs )); + } + + return 0; } - - PyObject *_wrap_new_ViewShape__SWIG_0(PyObject *self , PyObject *args) { +void ViewShape___dealloc__(BPy_ViewShape *self) +{ + delete self->vs; + self->ob_type->tp_free((PyObject*)self); } - - PyObject *_wrap_new_ViewShape__SWIG_1(PyObject *self , PyObject *args) { +PyObject * ViewShape___repr__(BPy_ViewShape *self) +{ + return PyString_FromFormat("ViewShape - address: %p", self->vs ); } - - PyObject *_wrap_new_ViewShape__SWIG_2(PyObject *self , PyObject *args) { +PyObject * ViewShape_sshape( BPy_ViewShape *self ) { + SShape ss(*( self->vs->sshape() )); + return BPy_SShape_from_SShape( ss ); } - PyObject *_wrap_new_ViewShape(PyObject *self, PyObject *args) { -} - +PyObject * ViewShape_vertices( BPy_ViewShape *self ) { + PyObject *py_vertices = PyList_New(NULL); - PyObject *_wrap_ViewShape_dupplicate(PyObject *self , PyObject *args) { + vector< ViewVertex * > vertices = self->vs->vertices(); + vector< ViewVertex * >::iterator it; + + for( it = vertices.begin(); it != vertices.end(); it++ ) { + PyList_Append( py_vertices, BPy_ViewVertex_from_ViewVertex_ptr( *it ) ); + } + + return py_vertices; } - PyObject *_wrap_delete_ViewShape(PyObject *self , PyObject *args) { -} - +PyObject * ViewShape_edges( BPy_ViewShape *self ) { + PyObject *py_edges = PyList_New(NULL); - PyObject *_wrap_ViewShape_SplitEdge(PyObject *self , PyObject *args) { + vector< ViewEdge * > edges = self->vs->edges(); + vector< ViewEdge * >::iterator it; + + for( it = edges.begin(); it != edges.end(); it++ ) { + PyList_Append( py_edges, BPy_ViewEdge_from_ViewEdge(*( *it )) ); + } + + return py_edges; } - - PyObject *_wrap_ViewShape_sshape__SWIG_0(PyObject *self , PyObject *args) { +PyObject * ViewShape_getId( BPy_ViewShape *self ) { + Id id( self->vs->getId() ); + return BPy_Id_from_Id( id ); } +PyObject * ViewShape_setSShape( BPy_ViewShape *self , PyObject *args) { + PyObject *py_ss = 0; - PyObject *_wrap_ViewShape_sshape__SWIG_1(PyObject *self , PyObject *args) { -} - + if(!( PyArg_ParseTuple(args, "O", &py_ss) && BPy_SShape_Check(py_ss) )) { + cout << "ERROR: ViewShape_SetSShape" << endl; + Py_RETURN_NONE; + } + + self->vs->setSShape( ((BPy_SShape *) py_ss)->ss ); - PyObject *_wrap_ViewShape_sshape(PyObject *self, PyObject *args) { + Py_RETURN_NONE; } - - PyObject *_wrap_ViewShape_vertices(PyObject *self , PyObject *args) { +PyObject * ViewShape_setVertices( BPy_ViewShape *self , PyObject *args) { + PyObject *list = 0; + PyObject *tmp; + + if(!( PyArg_ParseTuple(args, "O", &list) && PyList_Check(list) )) { + cout << "ERROR: ViewShape_SetVertices" << endl; + Py_RETURN_NONE; + } + + vector< ViewVertex *> v; + + for( int i=0; i < PyList_Size(list); i++ ) { + tmp = PyList_GetItem(list, i); + if( BPy_ViewVertex_Check(tmp) ) + v.push_back( ((BPy_ViewVertex *) tmp)->vv ); + else + Py_RETURN_NONE; + } + + self->vs->setVertices( v ); + + Py_RETURN_NONE; } +//void SetEdges (const vector< ViewEdge * > &iEdges) +PyObject * ViewShape_setEdges( BPy_ViewShape *self , PyObject *args) { + PyObject *list = 0; + PyObject *tmp; - PyObject *_wrap_ViewShape_edges(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "O", &list) && PyList_Check(list) )) { + cout << "ERROR: ViewShape_SetVertices" << endl; + Py_RETURN_NONE; + } + vector<ViewEdge *> v; - PyObject *_wrap_ViewShape_getId(PyObject *self , PyObject *args) { -} + for( int i=0; i < PyList_Size(list); i++ ) { + tmp = PyList_GetItem(list, i); + if( BPy_ViewEdge_Check(tmp) ) + v.push_back( ((BPy_ViewEdge *) tmp)->ve ); + else + Py_RETURN_NONE; + } + self->vs->setEdges( v ); - PyObject *_wrap_ViewShape_SetSShape(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * ViewShape_AddEdge( BPy_ViewShape *self , PyObject *args) { + PyObject *py_ve = 0; - PyObject *_wrap_ViewShape_SetVertices(PyObject *self , PyObject *args) { -} - + if(!( PyArg_ParseTuple(args, "O", &py_ve) && BPy_ViewEdge_Check(py_ve) )) { + cout << "ERROR: ViewShape_AddEdge" << endl; + Py_RETURN_NONE; + } + + self->vs->AddEdge( ((BPy_ViewEdge *) py_ve)->ve ); - PyObject *_wrap_ViewShape_SetEdges(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +PyObject * ViewShape_AddVertex( BPy_ViewShape *self , PyObject *args) { + PyObject *py_vv = 0; - PyObject *_wrap_ViewShape_AddVertex(PyObject *self , PyObject *args) { -} + if(!( PyArg_ParseTuple(args, "O", &py_vv) && BPy_ViewVertex_Check(py_vv) )) { + cout << "ERROR: ViewShape_AddNewVertex" << endl; + Py_RETURN_NONE; + } + + self->vs->AddVertex( ((BPy_ViewVertex *) py_vv)->vv ); - - PyObject *_wrap_ViewShape_AddEdge(PyObject *self , PyObject *args) { + Py_RETURN_NONE; } +// virtual ViewShape * dupplicate () - PyObject *_wrap_ViewShape_RemoveEdge(PyObject *self , PyObject *args) { -} - +/////////////////////////////////////////////////////////////////////////////////////////// - PyObject *_wrap_ViewShape_RemoveVertex(PyObject *self , PyObject *args) { +#ifdef __cplusplus } - - +#endif
\ No newline at end of file diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.h b/source/blender/freestyle/intern/python/BPy_ViewShape.h new file mode 100644 index 00000000000..20490cd71aa --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_VIEWSHAPE_H +#define FREESTYLE_PYTHON_VIEWSHAPE_H + +#include "../view_map/ViewMap.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ViewShape_Type; + +#define BPy_ViewShape_Check(v) (( (PyObject *) v)->ob_type == &ViewShape_Type) + +/*---------------------------Python BPy_ViewShape structure definition----------*/ +typedef struct { + PyObject_HEAD + ViewShape *vs; +} BPy_ViewShape; + +/*---------------------------Python BPy_ViewShape visible prototypes-----------*/ + +PyMODINIT_FUNC ViewShape_Init( PyObject *module ); + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_VIEWSHAPE_H */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h index 841040af180..592a46186c2 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h @@ -4,7 +4,6 @@ #include "../../view_map/ViewMap.h" #include "../BPy_Interface0D.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index 1b55b601c89..02d06757fcb 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -1,236 +1,317 @@ - PyObject *_wrap_ViewEdge_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_getId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_getNature(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_userdata_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_userdata_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewEdge__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewEdge__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewEdge__SWIG_2(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewEdge__SWIG_3(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_ViewEdge(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_delete_ViewEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_A(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_B(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_fedgeA(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_fedgeB(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_viewShape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_aShape__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_isClosed(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_getChainingTimeStamp(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_aShape__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_aShape(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_bShape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluders(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_splittingId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetA(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetB(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetNature(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetFEdgeA(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetFEdgeB(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetShape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_UpdateFEdges(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetaShape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_SetQI(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_setChainingTimeStamp(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_AddOccluder(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_setSplittingId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_intersect_2d_area(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_include_in_2d_area(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_getLength2D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_qi(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluders_begin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluders_end(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluders_size(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluders_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occludee(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occluded_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_occludee_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_shape_id(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_shape_importance(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_verticesBegin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_verticesEnd(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsBegin__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsBegin__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsBegin(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsEnd__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsEnd__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ViewEdge_pointsEnd(PyObject *self, PyObject *args) { -} - - +#include "BPy_ViewEdge.h" + +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for ViewEdge instance -----------*/ +static int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds); + +static PyObject * ViewEdge_A( BPy_ViewEdge *self ); +static PyObject * ViewEdge_B( BPy_ViewEdge *self ); + + +/*----------------------ViewEdge instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewEdge_methods[] = { + + {"A", ( PyCFunction ) ViewEdge_A, METH_NOARGS, "() Returns the first ViewVertex."}, + {"B", ( PyCFunction ) ViewEdge_B, METH_NOARGS, "() Returns the second ViewVertex."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewEdge type definition ------------------------------*/ + +PyTypeObject ViewEdge_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "ViewEdge", /* tp_name */ + sizeof( BPy_ViewEdge ), /* tp_basicsize */ + 0, /* tp_itemsize */ + + /* methods */ + NULL, /* tp_dealloc */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* tp_compare */ + NULL, /* tp_repr */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_ViewEdge_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Interface1D_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)ViewEdge___init__, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + NULL, /* newfunc tp_new; */ + + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL +}; + +//------------------------INSTANCE METHODS ---------------------------------- + +int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) +{ + self->ve = new ViewEdge(); + self->py_if1D.if1D = self->ve; + + return 0; +} + + +PyObject * ViewEdge_A( BPy_ViewEdge *self ) { + // if( self->ve->A() ){ + // return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->A() ); + // } + // + Py_RETURN_NONE; +} + +PyObject * ViewEdge_B( BPy_ViewEdge *self ) { + // if( self->ve->B() ){ + // return BPy_ViewVertex_from_ViewVertex_ptr( self->ve->B() ); + // } + + Py_RETURN_NONE; +} + +// +// PyObject * ViewEdge___getitem__( BPy_ViewEdge *self, PyObject *args ) { +// int i; +// +// if(!( PyArg_ParseTuple(args, "i", &i) && (i == 0 || i == 1) )) { +// cout << "ERROR: ViewEdge___getitem__" << endl; +// Py_RETURN_NONE; +// } +// +// if( SVertex *v = self->ve->operator[](i) ) +// return BPy_SVertex_from_SVertex( *v ); +// +// Py_RETURN_NONE; +// } +// +// PyObject * ViewEdge_nextEdge( BPy_ViewEdge *self ) { +// if( ViewEdge *fe = self->ve->nextEdge() ) +// return BPy_ViewEdge_from_ViewEdge( *fe ); +// +// Py_RETURN_NONE; +// } +// +// PyObject * ViewEdge_previousEdge( BPy_ViewEdge *self ) { +// if( ViewEdge *fe = self->ve->previousEdge() ) +// return BPy_ViewEdge_from_ViewEdge( *fe ); +// +// Py_RETURN_NONE; +// } +// +// PyObject * ViewEdge_isSmooth( BPy_ViewEdge *self ) { +// return PyBool_from_bool( self->ve->isSmooth() ); +// } +// +// PyObject *ViewEdge_setVertexA( BPy_ViewEdge *self , PyObject *args) { +// PyObject *py_sv; +// +// if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { +// cout << "ERROR: ViewEdge_setVertexA" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setVertexA( ((BPy_SVertex *) py_sv)->sv ); +// +// Py_RETURN_NONE; +// } +// +// PyObject *ViewEdge_setVertexB( BPy_ViewEdge *self , PyObject *args) { +// PyObject *py_sv; +// +// if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { +// cout << "ERROR: ViewEdge_setVertexB" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setVertexB( ((BPy_SVertex *) py_sv)->sv ); +// +// Py_RETURN_NONE; +// } +// +// PyObject *ViewEdge_setId( BPy_ViewEdge *self , PyObject *args) { +// PyObject *py_id; +// +// if(!( PyArg_ParseTuple(args, "O", &py_id) && BPy_Id_Check(py_id) )) { +// cout << "ERROR: ViewEdge_setId" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setId(*( ((BPy_Id *) py_id)->id )); +// +// Py_RETURN_NONE; +// } +// +// +// PyObject *ViewEdge_setNextEdge( BPy_ViewEdge *self , PyObject *args) { +// PyObject *py_fe; +// +// if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_ViewEdge_Check(py_fe) )) { +// cout << "ERROR: ViewEdge_setNextEdge" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setNextEdge( ((BPy_ViewEdge *) py_fe)->ve ); +// +// Py_RETURN_NONE; +// } +// +// PyObject *ViewEdge_setPreviousEdge( BPy_ViewEdge *self , PyObject *args) { +// PyObject *py_fe; +// +// if(!( PyArg_ParseTuple(args, "O", &py_fe) && BPy_ViewEdge_Check(py_fe) )) { +// cout << "ERROR: ViewEdge_setPreviousEdge" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setPreviousEdge( ((BPy_ViewEdge *) py_fe)->ve ); +// +// Py_RETURN_NONE; +// } +// +// PyObject *ViewEdge_setSmooth( BPy_ViewEdge *self , PyObject *args) { +// int b; +// +// if(!( PyArg_ParseTuple(args, "i", &b) )) { +// cout << "ERROR: ViewEdge_setSmooth" << endl; +// Py_RETURN_NONE; +// } +// +// self->ve->setSmooth( (bool) b ); +// +// Py_RETURN_NONE; +// } +// +// PyObject * ViewEdge_setNature( BPy_ViewEdge *self, PyObject *args ) { +// PyObject *py_n; +// +// if(!( PyArg_ParseTuple(args, "O", &py_n) && BPy_Nature_Check(py_n) )) { +// cout << "ERROR: ViewEdge_setNature" << endl; +// Py_RETURN_NONE; +// } +// +// PyObject *i = (PyObject *) &( ((BPy_Nature *) py_n)->i ); +// ((ViewEdge *) self->py_if1D.if1D)->setNature( PyInt_AsLong(i) ); +// +// Py_RETURN_NONE; +// } +// +// PyObject *ViewEdge_getVertices( BPy_ViewEdge *self ) { +// PyObject *py_vertices = PyList_New(NULL); +// +// for( Interface0DIterator it = self->ve->verticesBegin(); it != self->ve->verticesEnd(); it++ ) { +// PyList_Append( py_vertices, BPy_Interface0D_from_Interface0D( *it ) ); +// } +// +// return py_vertices; +// } +// +// PyObject *ViewEdge_getPoints( BPy_ViewEdge *self ) { +// PyObject *py_points = PyList_New(NULL); +// +// for( Interface0DIterator it = self->ve->pointsBegin(); it != self->ve->pointsEnd(); it++ ) { +// PyList_Append( py_points, BPy_Interface0D_from_Interface0D( *it ) ); +// } +// +// return py_points; +// } +// +// +// +// +// +// FEdge * fedgeA () +// FEdge * fedgeB () +// ViewShape * viewShape () +// ViewShape * aShape () +// bool isClosed () +// unsigned getChainingTimeStamp () +// void SetA (ViewVertex *iA) +// void SetB (ViewVertex *iB) +// void SetNature (Nature::EdgeNature iNature) +// void SetFEdgeA (FEdge *iFEdge) +// void SetFEdgeB (FEdge *iFEdge) +// void SetShape (ViewShape *iVShape) +// void SetId (const Id &id) +// void UpdateFEdges () +// void SetaShape (ViewShape *iShape) +// void SetQI (int qi) +// void setChainingTimeStamp (unsigned ts) +// real getLength2D () const +// virtual Interface0DIterator verticesBegin () +// virtual Interface0DIterator verticesEnd () +// virtual Interface0DIterator pointsBegin (float t=0.f) +// virtual Interface0DIterator pointsEnd (float t=0.f) + + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h new file mode 100644 index 00000000000..a7e7455b764 --- /dev/null +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h @@ -0,0 +1,32 @@ +#ifndef FREESTYLE_PYTHON_VIEWEDGE_H +#define FREESTYLE_PYTHON_VIEWEDGE_H + +#include "../../view_map/ViewMap.h" + +#include "../BPy_Interface1D.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ViewEdge_Type; + +#define BPy_ViewEdge_Check(v) (( (PyObject *) v)->ob_type == &ViewEdge_Type) + +/*---------------------------Python BPy_ViewEdge structure definition----------*/ +typedef struct { + BPy_Interface1D py_if1D; + ViewEdge *ve; +} BPy_ViewEdge; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_VIEWEDGE_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index b1b33b347bc..72273e73a65 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -1,6 +1,5 @@ #include "BPy_CurvePointIterator.h" -#include "../BPy_Convert.h" #include "BPy_Interface0DIterator.h" #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index b2b6d67aa0f..c88ba7773ab 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -1,7 +1,5 @@ #include "BPy_Interface0DIterator.h" -#include "../BPy_Convert.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index da8b1453102..be1f946302f 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -1,6 +1,5 @@ #include "BPy_SVertexIterator.h" -#include "../BPy_Convert.h" #include "../Interface0D/BPy_SVertex.h" #include "../Interface1D/BPy_FEdge.h" diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index 895aaee2323..72e41a37301 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -1,6 +1,5 @@ #include "BPy_StrokeVertexIterator.h" -#include "../BPy_Convert.h" #include "BPy_Interface0DIterator.h" #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index 25ae25d52a9..e5de7769fbb 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -1,6 +1,7 @@ #include "BPy_ViewEdgeIterator.h" #include "../BPy_Convert.h" +#include "../Interface1D/BPy_ViewEdge.h" #ifdef __cplusplus extern "C" { diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 9a32f384be9..0622481f412 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -1,7 +1,5 @@ #include "BPy_orientedViewEdgeIterator.h" -#include "../BPy_Convert.h" - #ifdef __cplusplus extern "C" { #endif |