diff options
28 files changed, 1326 insertions, 715 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 843bdc7c7d1..89fa677aac0 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -12,6 +12,9 @@ PyObject * PyBool_from_bool( bool b ){ return PyBool_FromLong( b ? 1 : 0); } +bool bool_from_PyBool( PyObject *b ) { + return b == Py_True; +} PyObject * Vector_from_Vec2f( Vec2f& vec ) { float vec_data[2]; // because vec->_coord is protected diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 8e935f6e229..16f991e0e51 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -25,6 +25,7 @@ extern "C" { #include "api2_2x/gen_utils.h" PyObject * PyBool_from_bool( bool b ); +bool bool_from_PyBool( PyObject *b ); PyObject * Vector_from_Vec2f( Vec2f& v ); PyObject * Vector_from_Vec3f( Vec3f& v ); diff --git a/source/blender/freestyle/intern/python/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/BPy_CurvePointIterator.cpp deleted file mode 100644 index 57dc86ea5e4..00000000000 --- a/source/blender/freestyle/intern/python/BPy_CurvePointIterator.cpp +++ /dev/null @@ -1,284 +0,0 @@ - PyObject *_wrap_CurvePointIterator__CurvilinearLength_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__CurvilinearLength_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__step_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__step_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___A_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___A_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___B_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___B_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__begin_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__begin_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__end_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__end_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__n_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__n_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__currentn_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__currentn_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__t_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__t_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__Point_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__Point_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__CurveLength_set(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator__CurveLength_get(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_CurvePointIterator__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_CurvePointIterator__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_CurvePointIterator__SWIG_2(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_new_CurvePointIterator(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_delete_CurvePointIterator(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_copy(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_CastToInterface0DIterator(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___eq__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getObject(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator___deref__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_isBegin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_isEnd(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getPoint3D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getProjectedX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getProjectedY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getProjectedZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getPoint2D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getFEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_getNature(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_castToSVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_castToViewVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_castToNonTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_castToTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_A(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_B(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_t2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_SetA(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_SetB(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_SetT2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_fedge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_point2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_point3d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_normal(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occluders_begin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occluders_end(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occluders_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occluders_size(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occludee(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occluded_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_occludee_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_z_discontinuity(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_curvatureFredo(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_CurvePointIterator_directionFredo(PyObject *self , PyObject *args) { -} - - diff --git a/source/blender/freestyle/intern/python/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/BPy_Interface0DIterator.cpp deleted file mode 100644 index 48b7560acea..00000000000 --- a/source/blender/freestyle/intern/python/BPy_Interface0DIterator.cpp +++ /dev/null @@ -1,104 +0,0 @@ - PyObject *_wrap_Interface0DIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getObject(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator___deref__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_increment(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_decrement(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_isBegin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_isEnd(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator___eq__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator___ne__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_t(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_u(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getPoint3D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getProjectedX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getProjectedY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getProjectedZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getPoint2D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getFEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_getNature(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_castToSVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_castToViewVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_castToNonTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_Interface0DIterator_castToTVertex(PyObject *self , PyObject *args) { -} - - diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index aebf5e45630..6a613c5f5ab 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -1,7 +1,15 @@ #include "BPy_Iterator.h" #include "BPy_Convert.h" +#include "Iterator/BPy_AdjacencyIterator.h" +#include "Iterator/BPy_Interface0DIterator.h" +#include "Iterator/BPy_CurvePointIterator.h" +#include "Iterator/BPy_StrokeVertexIterator.h" +#include "Iterator/BPy_SVertexIterator.h" +#include "Iterator/BPy_orientedViewEdgeIterator.h" +#include "Iterator/BPy_ViewEdgeIterator.h" + #ifdef __cplusplus extern "C" { #endif @@ -115,8 +123,7 @@ PyTypeObject Iterator_Type = { //-------------------MODULE INITIALIZATION-------------------------------- PyMODINIT_FUNC Iterator_Init( PyObject *module ) -{ - +{ if( module == NULL ) return; @@ -124,6 +131,42 @@ PyMODINIT_FUNC Iterator_Init( PyObject *module ) return; Py_INCREF( &Iterator_Type ); PyModule_AddObject(module, "Iterator", (PyObject *)&Iterator_Type); + + if( PyType_Ready( &AdjacencyIterator_Type ) < 0 ) + return; + Py_INCREF( &AdjacencyIterator_Type ); + PyModule_AddObject(module, "AdjacencyIterator", (PyObject *)&AdjacencyIterator_Type); + + if( PyType_Ready( &Interface0DIterator_Type ) < 0 ) + return; + Py_INCREF( &Interface0DIterator_Type ); + PyModule_AddObject(module, "Interface0DIterator", (PyObject *)&Interface0DIterator_Type); + + if( PyType_Ready( &CurvePointIterator_Type ) < 0 ) + return; + Py_INCREF( &CurvePointIterator_Type ); + PyModule_AddObject(module, "CurvePointIterator", (PyObject *)&CurvePointIterator_Type); + + if( PyType_Ready( &StrokeVertexIterator_Type ) < 0 ) + return; + Py_INCREF( &StrokeVertexIterator_Type ); + PyModule_AddObject(module, "StrokeVertexIterator", (PyObject *)&StrokeVertexIterator_Type); + + if( PyType_Ready( &SVertexIterator_Type ) < 0 ) + return; + Py_INCREF( &SVertexIterator_Type ); + PyModule_AddObject(module, "SVertexIterator", (PyObject *)&SVertexIterator_Type); + + if( PyType_Ready( &orientedViewEdgeIterator_Type ) < 0 ) + return; + Py_INCREF( &orientedViewEdgeIterator_Type ); + PyModule_AddObject(module, "orientedViewEdgeIterator", (PyObject *)&orientedViewEdgeIterator_Type); + + if( PyType_Ready( &ViewEdgeIterator_Type ) < 0 ) + return; + Py_INCREF( &ViewEdgeIterator_Type ); + PyModule_AddObject(module, "ViewEdgeIterator", (PyObject *)&ViewEdgeIterator_Type); + } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/BPy_StrokeVertexIterator.cpp deleted file mode 100644 index 3fae5a34060..00000000000 --- a/source/blender/freestyle/intern/python/BPy_StrokeVertexIterator.cpp +++ /dev/null @@ -1,260 +0,0 @@ - PyObject *_wrap_StrokeVertexIterator_castToInterface0DIterator(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getObject(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator___deref__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_increment(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_decrement(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_isBegin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_isEnd(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator___eq__(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_t(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_u(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_copy(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getIt(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_x(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_y(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getPoint(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_attribute__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_attribute__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_attribute(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_curvilinearAbscissa(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_strokeLength(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetPoint__SWIG_0(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetPoint__SWIG_1(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetPoint(PyObject *self, PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetAttribute(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetCurvilinearAbscissa(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetStrokeLength(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getPoint3D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getProjectedX(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getProjectedY(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getProjectedZ(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getPoint2D(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getFEdge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getId(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_getNature(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_castToSVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_castToViewVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_castToNonTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_castToTVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_A(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_B(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_t2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetA(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetB(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_SetT2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_fedge(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_point2d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_point3d(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_normal(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occluders_begin(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occluders_end(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occluders_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occluders_size(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occludee(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occluded_shape(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_occludee_empty(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_z_discontinuity(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_curvatureFredo(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_StrokeVertexIterator_directionFredo(PyObject *self , PyObject *args) { -} - - diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h index b70a69c95e7..841040af180 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h @@ -20,6 +20,7 @@ extern PyTypeObject ViewVertex_Type; /*---------------------------Python BPy_ViewVertex structure definition----------*/ typedef struct { BPy_Interface0D py_if0D; + ViewVertex *vv; } BPy_ViewVertex; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 8027f625cc5..7574c8d7fc1 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -282,7 +282,7 @@ PyObject *Stroke_setTips( BPy_Stroke *self , PyObject *args) { Py_RETURN_NONE; } - self->s->setTips( py_b == Py_True ); + self->s->setTips( bool_from_PyBool(py_b) ); Py_RETURN_NONE; } diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp new file mode 100644 index 00000000000..cc7ce17f4cf --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -0,0 +1,142 @@ +#include "BPy_AdjacencyIterator.h" + +#include "../BPy_Convert.h" +#include "../Interface0D/BPy_ViewVertex.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for AdjacencyIterator instance -----------*/ +static int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args); + +/*----------------------AdjacencyIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_AdjacencyIterator_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/ + +PyTypeObject AdjacencyIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "AdjacencyIterator", /* tp_name */ + sizeof( BPy_AdjacencyIterator ), /* 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_AdjacencyIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)AdjacencyIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args ) +{ + PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0; + + if (! PyArg_ParseTuple(args, "|OOO", &obj1, &obj2, &obj3) ) + return -1; + + if( !obj1 && !obj2 && !obj3 ){ + self->ai = new AdjacencyIterator(); + + } else if( BPy_AdjacencyIterator_Check(obj1) ) { + self->ai = new AdjacencyIterator(*( ((BPy_AdjacencyIterator *) obj1)->ai )); + + } else if( BPy_ViewVertex_Check(obj1) ) { + bool restrictToSelection = ( obj2 && PyBool_Check(obj2) ) ? bool_from_PyBool(obj2) : true; + bool restrictToUnvisited = ( obj3 && PyBool_Check(obj3) ) ? bool_from_PyBool(obj3) : true; + + self->ai = new AdjacencyIterator( ((BPy_ViewVertex *) obj1)->vv, restrictToSelection, restrictToUnvisited ); + + } else { + return -1; + } + + self->py_it.it = self->ai; + return 0; + +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h new file mode 100644 index 00000000000..91319ff9c92 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h @@ -0,0 +1,32 @@ +#ifndef FREESTYLE_PYTHON_ADJACENCYITERATOR_H +#define FREESTYLE_PYTHON_ADJACENCYITERATOR_H + +#include "../../stroke/ChainingIterators.h" +#include "../BPy_Iterator.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject AdjacencyIterator_Type; + +#define BPy_AdjacencyIterator_Check(v) (( (PyObject *) v)->ob_type == &AdjacencyIterator_Type) + +/*---------------------------Python BPy_AdjacencyIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + AdjacencyIterator *ai; +} BPy_AdjacencyIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ADJACENCYITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index e69de29bb2d..e69de29bb2d 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp diff --git a/source/blender/freestyle/intern/python/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingPredicateIterator.cpp index e69de29bb2d..e69de29bb2d 100644 --- a/source/blender/freestyle/intern/python/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingPredicateIterator.cpp diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingSilhouetteIterator.cpp new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingSilhouetteIterator.cpp diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp new file mode 100644 index 00000000000..b1b33b347bc --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -0,0 +1,162 @@ +#include "BPy_CurvePointIterator.h" + +#include "../BPy_Convert.h" +#include "BPy_Interface0DIterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for CurvePointIterator instance -----------*/ +static int CurvePointIterator___init__(BPy_CurvePointIterator *self, PyObject *args); +static PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self ); +static PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self ); +static PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self ); + + +/*----------------------CurvePointIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_CurvePointIterator_methods[] = { + {"t", ( PyCFunction ) CurvePointIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."}, + {"u", ( PyCFunction ) CurvePointIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."}, + {"castToInterface0DIterator", ( PyCFunction ) CurvePointIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this CurvePointIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_CurvePointIterator type definition ------------------------------*/ + +PyTypeObject CurvePointIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "CurvePointIterator", /* tp_name */ + sizeof( BPy_CurvePointIterator ), /* 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_CurvePointIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)CurvePointIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int CurvePointIterator___init__(BPy_CurvePointIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (! PyArg_ParseTuple(args, "|O", &obj) ) + return -1; + + if( !obj ){ + self->cp_it = new CurvePointIterator(); + + } else if( BPy_CurvePointIterator_Check(obj) ) { + self->cp_it = new CurvePointIterator(*( ((BPy_CurvePointIterator *) obj)->cp_it )); + + } else if( PyFloat_Check(obj) ) { + self->cp_it = new CurvePointIterator( PyFloat_AsDouble(obj) ); + + } else { + return -1; + } + + self->py_it.it = self->cp_it; + + return 0; +} + +PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self ) { + return PyFloat_FromDouble( self->cp_it->t() ); +} + +PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self ) { + return PyFloat_FromDouble( self->cp_it->u() ); +} + +PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self ) { + PyObject *py_if0D_it = Interface0DIterator_Type.tp_new( &Interface0DIterator_Type, 0, 0 ); + ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it = new Interface0DIterator( self->cp_it->castToInterface0DIterator() ); + + return py_if0D_it; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h new file mode 100644 index 00000000000..652f6fffb97 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h @@ -0,0 +1,33 @@ +#ifndef FREESTYLE_PYTHON_CURVEPOINTITERATOR_H +#define FREESTYLE_PYTHON_CURVEPOINTITERATOR_H + +#include "../../stroke/CurveIterators.h" +using namespace CurveInternal; + +#include "../BPy_Iterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject CurvePointIterator_Type; + +#define BPy_CurvePointIterator_Check(v) (( (PyObject *) v)->ob_type == &CurvePointIterator_Type) + +/*---------------------------Python BPy_CurvePointIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + CurvePointIterator *cp_it; +} BPy_CurvePointIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_CURVEPOINTITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp new file mode 100644 index 00000000000..b2b6d67aa0f --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -0,0 +1,139 @@ +#include "BPy_Interface0DIterator.h" + +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for Interface0DIterator instance -----------*/ +static int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject *args); + +static PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self ); +static PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ); + +/*----------------------Interface0DIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_Interface0DIterator_methods[] = { + {"t", ( PyCFunction ) Interface0DIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."}, + {"u", ( PyCFunction ) Interface0DIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_Interface0DIterator type definition ------------------------------*/ + +PyTypeObject Interface0DIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "Interface0DIterator", /* tp_name */ + sizeof( BPy_Interface0DIterator ), /* 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_Interface0DIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)Interface0DIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (!( PyArg_ParseTuple(args, "O", &obj) && BPy_Interface0DIterator_Check(obj) )) + return -1; + + self->if0D_it = new Interface0DIterator(*( ((BPy_Interface0DIterator *) obj)->if0D_it )); + self->py_it.it = self->if0D_it; + return 0; + +} + +PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self ) { + return PyFloat_FromDouble( self->if0D_it->t() ); +} + +PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) { + return PyFloat_FromDouble( self->if0D_it->u() ); +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h new file mode 100644 index 00000000000..16edb2c3d68 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h @@ -0,0 +1,32 @@ +#ifndef FREESTYLE_PYTHON_INTERFACE0DITERATOR_H +#define FREESTYLE_PYTHON_INTERFACE0DITERATOR_H + +#include "../../view_map/Interface0D.h" +#include "../BPy_Iterator.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Interface0DIterator_Type; + +#define BPy_Interface0DIterator_Check(v) (( (PyObject *) v)->ob_type == &Interface0DIterator_Type) + +/*---------------------------Python BPy_Interface0DIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + Interface0DIterator *if0D_it; +} BPy_Interface0DIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_INTERFACE0DITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp new file mode 100644 index 00000000000..da8b1453102 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -0,0 +1,162 @@ +#include "BPy_SVertexIterator.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 SVertexIterator instance -----------*/ +static int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args); + +static PyObject * SVertexIterator_t( BPy_SVertexIterator *self ); +static PyObject * SVertexIterator_u( BPy_SVertexIterator *self ); + +/*----------------------SVertexIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_SVertexIterator_methods[] = { + {"t", ( PyCFunction ) SVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."}, + {"u", ( PyCFunction ) SVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_SVertexIterator type definition ------------------------------*/ + +PyTypeObject SVertexIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "SVertexIterator", /* tp_name */ + sizeof( BPy_SVertexIterator ), /* 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_SVertexIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)SVertexIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args ) +{ + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; + float f; + + if (! PyArg_ParseTuple(args, "|OOOOf", &obj1, &obj2, &obj3, &obj4, f) ) + return -1; + + if( !obj1 ){ + self->sv_it = new SVertexIterator(); + + } else if( BPy_SVertexIterator_Check(obj1) ) { + self->sv_it = new SVertexIterator(*( ((BPy_SVertexIterator *) obj1)->sv_it )); + + } else if( obj1 && BPy_SVertex_Check(obj1) && + obj2 && BPy_SVertex_Check(obj2) && + obj3 && BPy_FEdge_Check(obj3) && + obj4 && BPy_FEdge_Check(obj4) ) { + + self->sv_it = new SVertexIterator( ((BPy_SVertex *) obj1)->sv, + ((BPy_SVertex *) obj2)->sv, + ((BPy_FEdge *) obj3)->fe, + ((BPy_FEdge *) obj4)->fe, + f ); + + } else { + return -1; + } + + self->py_it.it = self->sv_it; + + return 0; +} + +PyObject * SVertexIterator_t( BPy_SVertexIterator *self ) { + return PyFloat_FromDouble( self->sv_it->t() ); +} + +PyObject * SVertexIterator_u( BPy_SVertexIterator *self ) { + return PyFloat_FromDouble( self->sv_it->u() ); +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h new file mode 100644 index 00000000000..662685571eb --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_SVERTEXITERATOR_H +#define FREESTYLE_PYTHON_SVERTEXITERATOR_H + +#include "../../view_map/ViewMapIterators.h" +using namespace ViewEdgeInternal; + +#include "../BPy_Iterator.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject SVertexIterator_Type; + +#define BPy_SVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &SVertexIterator_Type) + +/*---------------------------Python BPy_SVertexIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + SVertexIterator *sv_it; +} BPy_SVertexIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_SVERTEXITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp new file mode 100644 index 00000000000..895aaee2323 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -0,0 +1,158 @@ +#include "BPy_StrokeVertexIterator.h" + +#include "../BPy_Convert.h" +#include "BPy_Interface0DIterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for StrokeVertexIterator instance -----------*/ +static int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args); +static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ); +static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self ); +static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self ); + +/*----------------------StrokeVertexIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_StrokeVertexIterator_methods[] = { + {"t", ( PyCFunction ) StrokeVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."}, + {"u", ( PyCFunction ) StrokeVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."}, + {"castToInterface0DIterator", ( PyCFunction ) StrokeVertexIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this StrokeVertexIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."}, + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/ + +PyTypeObject StrokeVertexIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "StrokeVertexIterator", /* tp_name */ + sizeof( BPy_StrokeVertexIterator ), /* 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_StrokeVertexIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)StrokeVertexIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int StrokeVertexIterator___init__(BPy_StrokeVertexIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (! PyArg_ParseTuple(args, "|O", &obj) ) + return -1; + + if( !obj ){ + self->sv_it = new StrokeVertexIterator(); + + } else if( BPy_StrokeVertexIterator_Check(obj) ) { + self->sv_it = new StrokeVertexIterator(*( ((BPy_StrokeVertexIterator *) obj)->sv_it )); + + } else { + return -1; + } + + self->py_it.it = self->sv_it; + + return 0; +} + +PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self ) { + return PyFloat_FromDouble( self->sv_it->t() ); +} + +PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self ) { + return PyFloat_FromDouble( self->sv_it->u() ); +} + +PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self ) { + PyObject *py_if0D_it = Interface0DIterator_Type.tp_new( &Interface0DIterator_Type, 0, 0 ); + ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it = new Interface0DIterator( self->sv_it->castToInterface0DIterator() ); + + return py_if0D_it; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h new file mode 100644 index 00000000000..8d9ffc56018 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h @@ -0,0 +1,33 @@ +#ifndef FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H +#define FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H + +#include "../../stroke/StrokeIterators.h" +using namespace StrokeInternal; + +#include "../BPy_Iterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject StrokeVertexIterator_Type; + +#define BPy_StrokeVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &StrokeVertexIterator_Type) + +/*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + StrokeVertexIterator *sv_it; +} BPy_StrokeVertexIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_STROKEVERTEXITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp new file mode 100644 index 00000000000..25ae25d52a9 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -0,0 +1,150 @@ +#include "BPy_ViewEdgeIterator.h" + +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for ViewEdgeIterator instance -----------*/ +static int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args); + +/*----------------------ViewEdgeIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_ViewEdgeIterator_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_ViewEdgeIterator type definition ------------------------------*/ + +PyTypeObject ViewEdgeIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "ViewEdgeIterator", /* tp_name */ + sizeof( BPy_ViewEdgeIterator ), /* 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_ViewEdgeIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)ViewEdgeIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int ViewEdgeIterator___init__(BPy_ViewEdgeIterator *self, PyObject *args ) +{ + PyObject *obj1 = 0, *obj2 = 0; + + if (!( PyArg_ParseTuple(args, "O|O", &obj1, &obj2) )) + return -1; + + if( obj1 && BPy_ViewEdgeIterator_Check(obj1) ) { + self->ve_it = new ViewEdgeIterator(*( ((BPy_ViewEdgeIterator *) obj1)->ve_it )); + + } else { + ViewEdge *begin = ( obj1 && BPy_ViewEdge_Check(obj1) ) ? ((BPy_ViewEdge *) obj1)->ve : 0; + bool orientation = ( obj2 && PyBool_Check(obj2) ) ? bool_from_PyBool(obj2) : true; + + self->ve_it = new ViewEdgeIterator( begin, orientation); + + } + + self->py_it.it = self->ve_it; + + return 0; +} + + + +// ViewEdge * getCurrentEdge () +// void setCurrentEdge (ViewEdge *edge) +// ViewEdge * getBegin () +// bool getOrientation () const + + + +// void setCurrentEdge (ViewEdge *edge) +// void setBegin (ViewEdge *begin) +// void setOrientation (bool orientation) +// void changeOrientation () + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h new file mode 100644 index 00000000000..35d2f3f255b --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_VIEWEDGEITERATOR_H +#define FREESTYLE_PYTHON_VIEWEDGEITERATOR_H + + +#include "../../view_map/ViewMapIterators.h" +using namespace ViewEdgeInternal; + +#include "../BPy_Iterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject ViewEdgeIterator_Type; + +#define BPy_ViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &ViewEdgeIterator_Type) + +/*---------------------------Python BPy_ViewEdgeIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + ViewEdgeIterator *ve_it; +} BPy_ViewEdgeIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_VIEWEDGEITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp new file mode 100644 index 00000000000..9a32f384be9 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -0,0 +1,130 @@ +#include "BPy_orientedViewEdgeIterator.h" + +#include "../BPy_Convert.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +/*--------------- Python API function prototypes for orientedViewEdgeIterator instance -----------*/ +static int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args); + +/*----------------------orientedViewEdgeIterator instance definitions ----------------------------*/ +static PyMethodDef BPy_orientedViewEdgeIterator_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*-----------------------BPy_orientedViewEdgeIterator type definition ------------------------------*/ + +PyTypeObject orientedViewEdgeIterator_Type = { + PyObject_HEAD_INIT( NULL ) + 0, /* ob_size */ + "orientedViewEdgeIterator", /* tp_name */ + sizeof( BPy_orientedViewEdgeIterator ), /* 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_orientedViewEdgeIterator_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + NULL, /* struct PyGetSetDef *tp_getset; */ + &Iterator_Type, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + (initproc)orientedViewEdgeIterator___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 +}; + +//-------------------MODULE INITIALIZATION-------------------------------- + + +//------------------------INSTANCE METHODS ---------------------------------- + +int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args ) +{ + PyObject *obj = 0; + + if (!( PyArg_ParseTuple(args, "|O", &obj) )) + return -1; + + if( !obj ) + self->ove_it = new orientedViewEdgeIterator(); + else if( BPy_orientedViewEdgeIterator_Check(obj) ) + self->ove_it = new orientedViewEdgeIterator(*( ((BPy_orientedViewEdgeIterator *) obj)->ove_it )); + + self->py_it.it = self->ove_it; + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h new file mode 100644 index 00000000000..60754939220 --- /dev/null +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h @@ -0,0 +1,34 @@ +#ifndef FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H +#define FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H + +#include "../../stroke/Stroke.h" +#include "../../view_map/ViewMapIterators.h" +using namespace ViewVertexInternal; + +#include "../BPy_Iterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject orientedViewEdgeIterator_Type; + +#define BPy_orientedViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &orientedViewEdgeIterator_Type) + +/*---------------------------Python BPy_orientedViewEdgeIterator structure definition----------*/ +typedef struct { + BPy_Iterator py_it; + orientedViewEdgeIterator *ove_it; +} BPy_orientedViewEdgeIterator; + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ORIENTEDVIEWEDGEITERATOR_H */ diff --git a/source/blender/freestyle/intern/python/ViewEdgeIterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/ViewEdgeIterator/BPy_ChainingIterator.cpp deleted file mode 100644 index 18ab37aeecd..00000000000 --- a/source/blender/freestyle/intern/python/ViewEdgeIterator/BPy_ChainingIterator.cpp +++ /dev/null @@ -1,36 +0,0 @@ - PyObject *_wrap_ChainingIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_init(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_traverse(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_getVertex(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_isIncrementing(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_increment(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainingIterator_decrement(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_delete_ChainingIterator(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_disown_ChainingIterator(PyObject *self , PyObject *args) { -} - - diff --git a/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainPredicateIterator.cpp deleted file mode 100644 index 3b3b4433e59..00000000000 --- a/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainPredicateIterator.cpp +++ /dev/null @@ -1,12 +0,0 @@ - PyObject *_wrap_ChainPredicateIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainPredicateIterator_traverse(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_disown_ChainPredicateIterator(PyObject *self , PyObject *args) { -} - - diff --git a/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainSilhouetteIterator.cpp deleted file mode 100644 index 53d37c1578c..00000000000 --- a/source/blender/freestyle/intern/python/ViewEdgeIterator/ChainingIterator/BPy_ChainSilhouetteIterator.cpp +++ /dev/null @@ -1,16 +0,0 @@ - PyObject *_wrap_ChainSilhouetteIterator_getExactTypeName(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_ChainSilhouetteIterator_traverse(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_delete_ChainSilhouetteIterator(PyObject *self , PyObject *args) { -} - - - PyObject *_wrap_disown_ChainSilhouetteIterator(PyObject *self , PyObject *args) { -} - - |