diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-28 04:29:30 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-28 04:29:30 +0400 |
commit | bf0365ceb0140a9127f59ff6bc1a0a9c113e0a1a (patch) | |
tree | 73d9149a3808b6f60444be07883e4e11561009ca /source | |
parent | 9f79d8ae6766e6a8b155674ad1b9e747f4b70235 (diff) |
* BPy_IntegrationType.cpp: Added a Python wrapper of integrate function.
* Fixed uninitialized fields in the "__init__" methods of UnaryFunction0D
types. Also added missing argument validation codes to some of the types,
and removed redundant validation error messages.
Diffstat (limited to 'source')
27 files changed, 200 insertions, 66 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index d2f16e427a5..d794b0c560e 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -1,6 +1,10 @@ #include "BPy_IntegrationType.h" #include "BPy_Convert.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DFloat.h" +#include "UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h" +#include "Iterator/BPy_Interface0DIterator.h" #ifdef __cplusplus extern "C" { @@ -10,6 +14,19 @@ extern "C" { static PyObject *BPy_IntegrationType_new(PyTypeObject *type, PyObject *args, PyObject *kwds); +static PyObject * Integrator_integrate( PyObject *self, PyObject *args ); + +/*-----------------------Integrator module docstring---------------------------------------*/ + +static char module_docstring[] = "The Blender.Freestyle.Integrator submodule"; + +/*-----------------------Integrator module functions definitions---------------------------*/ + +static PyMethodDef module_functions[] = { + {"integrate", (PyCFunction)Integrator_integrate, METH_VARARGS, ""}, + {NULL, NULL, 0, NULL} +}; + /*-----------------------BPy_IntegrationType type definition ------------------------------*/ PyTypeObject IntegrationType_Type = { @@ -121,7 +138,7 @@ BPy_IntegrationType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) //-------------------MODULE INITIALIZATION-------------------------------- PyMODINIT_FUNC IntegrationType_Init( PyObject *module ) { - PyObject *tmp; + PyObject *tmp, *m, *d, *f; if( module == NULL ) return; @@ -151,7 +168,76 @@ PyMODINIT_FUNC IntegrationType_Init( PyObject *module ) PyDict_SetItemString( IntegrationType_Type.tp_dict, "LAST", tmp); Py_DECREF(tmp); - + m = Py_InitModule3("Blender.Freestyle.Integrator", module_functions, module_docstring); + if (m == NULL) + return; + PyModule_AddObject(module, "Integrator", m); + + // from Integrator import * + d = PyModule_GetDict(m); + for (PyMethodDef *p = module_functions; p->ml_name; p++) { + f = PyDict_GetItemString(d, p->ml_name); + Py_INCREF(f); + PyModule_AddObject(module, p->ml_name, f); + } +} + +//------------------------ MODULE FUNCTIONS ---------------------------------- + +static PyObject * Integrator_integrate( PyObject *self, PyObject *args ) +{ + PyObject *obj1, *obj4 = 0; + BPy_Interface0DIterator *obj2, *obj3; + +#if 1 + if(!( PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1, + &Interface0DIterator_Type, &obj2, &Interface0DIterator_Type, &obj3, + &IntegrationType_Type, &obj4) )) + return NULL; +#else + if(!( PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4) )) + return NULL; + if(!BPy_UnaryFunction0D_Check(obj1)) { + PyErr_SetString(PyExc_TypeError, "argument 1 must be a UnaryFunction0D object"); + return NULL; + } + if(!BPy_Interface0DIterator_Check(obj2)) { + PyErr_SetString(PyExc_TypeError, "argument 2 must be a Interface0DIterator object"); + return NULL; + } + if(!BPy_Interface0DIterator_Check(obj3)) { + PyErr_SetString(PyExc_TypeError, "argument 3 must be a Interface0DIterator object"); + return NULL; + } + if(obj4 && !BPy_IntegrationType_Check(obj4)) { + PyErr_SetString(PyExc_TypeError, "argument 4 must be a IntegrationType object"); + return NULL; + } +#endif + + Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); + IntegrationType t = ( obj4 ) ? IntegrationType_from_BPy_IntegrationType( obj4 ) : MEAN; + + if( BPy_UnaryFunction0DDouble_Check(obj1) ) { + UnaryFunction0D<double> *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; + double res = integrate( *fun, it, it_end, t ); + return PyFloat_FromDouble( res ); + + } else if( BPy_UnaryFunction0DFloat_Check(obj1) ) { + UnaryFunction0D<float> *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; + float res = integrate( *fun, it, it_end, t ); + return PyFloat_FromDouble( res ); + + } else if( BPy_UnaryFunction0DUnsigned_Check(obj1) ) { + UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + unsigned int res = integrate( *fun, it, it_end, t ); + return PyInt_FromLong( res ); + + } else { + string msg("unsupported function type: " + string(obj1->ob_type->tp_name)); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; + } } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp index 2ca5f7899f9..2c58cad73bb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for ShapeIdF0D instance -----------*/ - static int ShapeIdF0D___init__(BPy_ShapeIdF0D* self); + static int ShapeIdF0D___init__(BPy_ShapeIdF0D* self, PyObject *args); /*-----------------------BPy_ShapeIdF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject ShapeIdF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int ShapeIdF0D___init__( BPy_ShapeIdF0D* self ) +int ShapeIdF0D___init__( BPy_ShapeIdF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_id.uf0D_id = new Functions0D::ShapeIdF0D(); + self->py_uf0D_id.uf0D_id->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp index d28fc2f4363..b3fbca6031b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for MaterialF0D instance -----------*/ - static int MaterialF0D___init__(BPy_MaterialF0D* self); + static int MaterialF0D___init__(BPy_MaterialF0D* self, PyObject *args); /*-----------------------BPy_MaterialF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject MaterialF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int MaterialF0D___init__( BPy_MaterialF0D* self ) +int MaterialF0D___init__( BPy_MaterialF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_material.uf0D_material = new Functions0D::MaterialF0D(); + self->py_uf0D_material.uf0D_material->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp index 449a4234548..30b5dc1641b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for CurveNatureF0D instance -----------*/ - static int CurveNatureF0D___init__(BPy_CurveNatureF0D* self); + static int CurveNatureF0D___init__(BPy_CurveNatureF0D* self, PyObject *args); /*-----------------------BPy_CurveNatureF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject CurveNatureF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int CurveNatureF0D___init__( BPy_CurveNatureF0D* self ) +int CurveNatureF0D___init__( BPy_CurveNatureF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_edgenature.uf0D_edgenature = new Functions0D::CurveNatureF0D(); + self->py_uf0D_edgenature.uf0D_edgenature->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp index 141dd3274a4..4c597ea4e02 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for Normal2DF0D instance -----------*/ - static int Normal2DF0D___init__(BPy_Normal2DF0D* self); + static int Normal2DF0D___init__(BPy_Normal2DF0D* self, PyObject *args); /*-----------------------BPy_Normal2DF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject Normal2DF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int Normal2DF0D___init__( BPy_Normal2DF0D* self ) +int Normal2DF0D___init__( BPy_Normal2DF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::Normal2DF0D(); + self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp index 2637ae17f2b..630fdf8d982 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for VertexOrientation2DF0D instance -----------*/ - static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D* self); + static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D* self, PyObject *args); /*-----------------------BPy_VertexOrientation2DF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject VertexOrientation2DF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int VertexOrientation2DF0D___init__( BPy_VertexOrientation2DF0D* self ) +int VertexOrientation2DF0D___init__( BPy_VertexOrientation2DF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::VertexOrientation2DF0D(); + self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp index 2c7eba1900a..51685b6bbea 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for VertexOrientation3DF0D instance -----------*/ - static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D* self); + static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D* self, PyObject *args); /*-----------------------BPy_VertexOrientation3DF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject VertexOrientation3DF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int VertexOrientation3DF0D___init__( BPy_VertexOrientation3DF0D* self ) +int VertexOrientation3DF0D___init__( BPy_VertexOrientation3DF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_vec3f.uf0D_vec3f = new Functions0D::VertexOrientation3DF0D(); + self->py_uf0D_vec3f.uf0D_vec3f->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp index cc36d377768..19576f97276 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetOccludeeF0D instance -----------*/ - static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D* self); + static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D* self, PyObject *args); /*-----------------------BPy_GetOccludeeF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetOccludeeF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetOccludeeF0D___init__( BPy_GetOccludeeF0D* self ) +int GetOccludeeF0D___init__( BPy_GetOccludeeF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetOccludeeF0D(); + self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp index 2bd4bbae039..bc095bdf227 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetShapeF0D instance -----------*/ - static int GetShapeF0D___init__(BPy_GetShapeF0D* self); + static int GetShapeF0D___init__(BPy_GetShapeF0D* self, PyObject *args); /*-----------------------BPy_GetShapeF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetShapeF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetShapeF0D___init__( BPy_GetShapeF0D* self ) +int GetShapeF0D___init__( BPy_GetShapeF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetShapeF0D(); + self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index 70bf4d677e6..e610f7c8a5a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for Curvature2DAngleF0D instance -----------*/ - static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D* self); + static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D* self, PyObject *args); /*-----------------------BPy_Curvature2DAngleF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject Curvature2DAngleF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self ) +int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::Curvature2DAngleF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index dd335d03fa8..b136f0bcdf5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -102,12 +102,10 @@ int DensityF0D___init__( BPy_DensityF0D* self, PyObject *args) { double d = 2; - if( !PyArg_ParseTuple(args, "|d", &d) ) { - cout << "ERROR: DensityF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "|d", &d) ) return -1; - } - self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index 7bc2e368fb5..6c87e205381 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetProjectedXF0D instance -----------*/ - static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D* self); + static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D* self, PyObject *args); /*-----------------------BPy_GetProjectedXF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetProjectedXF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self ) +int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedXF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index b0a4f1d82db..9b672f87568 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetProjectedYF0D instance -----------*/ - static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D* self); + static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D* self, PyObject *args); /*-----------------------BPy_GetProjectedYF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetProjectedYF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self ) +int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedYF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index b452a32e987..3904c798aee 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetProjectedZF0D instance -----------*/ - static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D* self); + static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D* self, PyObject *args); /*-----------------------BPy_GetProjectedZF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetProjectedZF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self ) +int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedZF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index b5ac0a0b08c..3798f635f2c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetXF0D instance -----------*/ - static int GetXF0D___init__(BPy_GetXF0D* self); + static int GetXF0D___init__(BPy_GetXF0D* self, PyObject *args); /*-----------------------BPy_GetXF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetXF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetXF0D___init__( BPy_GetXF0D* self ) +int GetXF0D___init__( BPy_GetXF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetXF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index 45bb5450fbd..c0124d7be9d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetYF0D instance -----------*/ - static int GetYF0D___init__(BPy_GetYF0D* self); + static int GetYF0D___init__(BPy_GetYF0D* self, PyObject *args); /*-----------------------BPy_GetYF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetYF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetYF0D___init__( BPy_GetYF0D* self ) +int GetYF0D___init__( BPy_GetYF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetYF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 83605b1b356..49010ccd72e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetZF0D instance -----------*/ - static int GetZF0D___init__(BPy_GetZF0D* self); + static int GetZF0D___init__(BPy_GetZF0D* self, PyObject *args); /*-----------------------BPy_GetZF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetZF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetZF0D___init__( BPy_GetZF0D* self ) +int GetZF0D___init__( BPy_GetZF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetZF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index 3a9c516cd17..6166e0027d4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -102,12 +102,10 @@ int LocalAverageDepthF0D___init__( BPy_LocalAverageDepthF0D* self, PyObject *arg { double d = 5.0; - if( !PyArg_ParseTuple(args, "|d", &d) ) { - cout << "ERROR: LocalAverageDepthF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "|d", &d) ) return -1; - } - self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index 0d6222c8a9a..ce614eaf76f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for ZDiscontinuityF0D instance -----------*/ - static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D* self); + static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D* self, PyObject *args); /*-----------------------BPy_ZDiscontinuityF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject ZDiscontinuityF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self ) +int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_double.uf0D_double = new Functions0D::ZDiscontinuityF0D(); + self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index 0a0702cf1b8..9f01cba96a0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetCurvilinearAbscissaF0D instance -----------*/ - static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D* self); + static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D* self, PyObject *args); /*-----------------------BPy_GetCurvilinearAbscissaF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetCurvilinearAbscissaF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self ) +int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D(); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index eab08495810..2cce6d75b8f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetParameterF0D instance -----------*/ - static int GetParameterF0D___init__(BPy_GetParameterF0D* self); + static int GetParameterF0D___init__(BPy_GetParameterF0D* self, PyObject *args); /*-----------------------BPy_GetParameterF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetParameterF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetParameterF0D___init__( BPy_GetParameterF0D* self ) +int GetParameterF0D___init__( BPy_GetParameterF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D(); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index 796abed5298..428aa1a5342 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -102,12 +102,10 @@ int GetViewMapGradientNormF0D___init__( BPy_GetViewMapGradientNormF0D* self, PyO { int i; - if( !PyArg_ParseTuple(args, "i", &i) ) { - cout << "ERROR: GetViewMapGradientNormF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "i", &i) ) return -1; - } - self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index 0ca3cdffb78..e0d5a865e79 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -102,12 +102,10 @@ int ReadCompleteViewMapPixelF0D___init__( BPy_ReadCompleteViewMapPixelF0D* self, { int i; - if( !PyArg_ParseTuple(args, "i", &i) ) { - cout << "ERROR: ReadCompleteViewMapPixelF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "i", &i) ) return -1; - } - self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index 216ac3da8da..419adcb3f66 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -103,12 +103,10 @@ int ReadMapPixelF0D___init__( BPy_ReadMapPixelF0D* self, PyObject *args) const char *s; int i; - if( !PyArg_ParseTuple(args, "si", &s, &i) ) { - cout << "ERROR: ReadMapPixelF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "si", &s, &i) ) return -1; - } - self->py_uf0D_float.uf0D_float = new Functions0D::ReadMapPixelF0D(s,i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index 114ffa6aab0..4479bbddc66 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -103,12 +103,10 @@ int ReadSteerableViewMapPixelF0D___init__( BPy_ReadSteerableViewMapPixelF0D* sel unsigned int u; int i; - if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) { - cout << "ERROR: ReadSteerableViewMapPixelF0D___init__" << endl; + if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) return -1; - } - self->py_uf0D_float.uf0D_float = new Functions0D::ReadSteerableViewMapPixelF0D(u,i); + self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp index a81822f08ac..97fe5bf1db9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for QuantitativeInvisibilityF0D instance -----------*/ - static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D* self); + static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D* self, PyObject *args); /*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject QuantitativeInvisibilityF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int QuantitativeInvisibilityF0D___init__( BPy_QuantitativeInvisibilityF0D* self ) +int QuantitativeInvisibilityF0D___init__( BPy_QuantitativeInvisibilityF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_unsigned.uf0D_unsigned = new Functions0D::QuantitativeInvisibilityF0D(); + self->py_uf0D_unsigned.uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index 6d7b903a37f..b576aa127a1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -9,7 +9,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// /*--------------- Python API function prototypes for GetOccludersF0D instance -----------*/ - static int GetOccludersF0D___init__(BPy_GetOccludersF0D* self); + static int GetOccludersF0D___init__(BPy_GetOccludersF0D* self, PyObject *args); /*-----------------------BPy_GetOccludersF0D type definition ------------------------------*/ @@ -98,9 +98,12 @@ PyTypeObject GetOccludersF0D_Type = { //------------------------INSTANCE METHODS ---------------------------------- -int GetOccludersF0D___init__( BPy_GetOccludersF0D* self ) +int GetOccludersF0D___init__( BPy_GetOccludersF0D* self, PyObject *args ) { + if( !PyArg_ParseTuple(args, "") ) + return -1; self->py_uf0D_vectorviewshape.uf0D_vectorviewshape = new Functions0D::GetOccludersF0D(); + self->py_uf0D_vectorviewshape.uf0D_vectorviewshape->py_uf0D = (PyObject *)self; return 0; } |