From 33f34e1a7bc08f123d76198ae0671e3da1ded401 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Fri, 22 Feb 2013 01:57:20 +0000 Subject: Freestyle Python API improvements - part 6. Fix for PyGetSetDef and proper handling of keyword arguments were done in Function0D and Function1D classes. Additional code clean-up was also made. --- .../intern/python/BPy_UnaryFunction0D.cpp | 52 +++--- .../intern/python/BPy_UnaryFunction1D.cpp | 47 ++++-- .../UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp | 95 +++++------ .../BPy_UnaryFunction0DEdgeNature.cpp | 57 +++---- .../UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp | 77 ++++----- .../UnaryFunction0D/BPy_UnaryFunction0DId.cpp | 56 +++---- .../BPy_UnaryFunction0DMaterial.cpp | 56 +++---- .../BPy_UnaryFunction0DUnsigned.cpp | 56 +++---- .../UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp | 4 +- .../UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp | 4 +- .../BPy_UnaryFunction0DVectorViewShape.cpp | 4 +- .../BPy_UnaryFunction0DViewShape.cpp | 4 +- .../UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp | 6 +- .../UnaryFunction0D_Material/BPy_MaterialF0D.cpp | 6 +- .../BPy_CurveNatureF0D.cpp | 6 +- .../UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp | 6 +- .../BPy_VertexOrientation2DF0D.cpp | 6 +- .../BPy_VertexOrientation3DF0D.cpp | 6 +- .../BPy_GetOccludeeF0D.cpp | 6 +- .../UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp | 6 +- .../BPy_Curvature2DAngleF0D.cpp | 6 +- .../UnaryFunction0D_double/BPy_DensityF0D.cpp | 5 +- .../BPy_GetProjectedXF0D.cpp | 6 +- .../BPy_GetProjectedYF0D.cpp | 6 +- .../BPy_GetProjectedZF0D.cpp | 6 +- .../UnaryFunction0D_double/BPy_GetXF0D.cpp | 6 +- .../UnaryFunction0D_double/BPy_GetYF0D.cpp | 6 +- .../UnaryFunction0D_double/BPy_GetZF0D.cpp | 6 +- .../BPy_LocalAverageDepthF0D.cpp | 11 +- .../BPy_ZDiscontinuityF0D.cpp | 6 +- .../BPy_GetCurvilinearAbscissaF0D.cpp | 6 +- .../UnaryFunction0D_float/BPy_GetParameterF0D.cpp | 6 +- .../BPy_GetViewMapGradientNormF0D.cpp | 5 +- .../BPy_ReadCompleteViewMapPixelF0D.cpp | 5 +- .../UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp | 11 +- .../BPy_ReadSteerableViewMapPixelF0D.cpp | 11 +- .../BPy_QuantitativeInvisibilityF0D.cpp | 6 +- .../BPy_GetOccludersF0D.cpp | 6 +- .../UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp | 174 +++++++++------------ .../BPy_UnaryFunction1DEdgeNature.cpp | 121 ++++++-------- .../UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp | 117 ++++++-------- .../BPy_UnaryFunction1DUnsigned.cpp | 121 ++++++-------- .../UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp | 125 ++++++--------- .../UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp | 121 ++++++-------- .../BPy_UnaryFunction1DVectorViewShape.cpp | 129 +++++++-------- .../UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp | 127 ++++++--------- .../BPy_CurveNatureF1D.cpp | 14 +- .../UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp | 14 +- .../UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp | 16 +- .../UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp | 14 +- .../BPy_Curvature2DAngleF1D.cpp | 14 +- .../UnaryFunction1D_double/BPy_DensityF1D.cpp | 16 +- .../BPy_GetCompleteViewMapDensityF1D.cpp | 19 ++- .../BPy_GetDirectionalViewMapDensityF1D.cpp | 21 ++- .../BPy_GetProjectedXF1D.cpp | 14 +- .../BPy_GetProjectedYF1D.cpp | 14 +- .../BPy_GetProjectedZF1D.cpp | 14 +- .../BPy_GetSteerableViewMapDensityF1D.cpp | 17 +- .../BPy_GetViewMapGradientNormF1D.cpp | 17 +- .../UnaryFunction1D_double/BPy_GetXF1D.cpp | 14 +- .../UnaryFunction1D_double/BPy_GetYF1D.cpp | 14 +- .../UnaryFunction1D_double/BPy_GetZF1D.cpp | 14 +- .../BPy_LocalAverageDepthF1D.cpp | 15 +- .../BPy_ZDiscontinuityF1D.cpp | 14 +- .../BPy_QuantitativeInvisibilityF1D.cpp | 15 +- .../BPy_GetOccludeeF1D.cpp | 6 +- .../BPy_GetOccludersF1D.cpp | 6 +- .../BPy_GetShapeF1D.cpp | 6 +- .../BPy_ChainingTimeStampF1D.cpp | 6 +- .../BPy_IncrementChainingTimeStampF1D.cpp | 6 +- .../UnaryFunction1D_void/BPy_TimeStampF1D.cpp | 6 +- 71 files changed, 921 insertions(+), 1120 deletions(-) diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 9cb855f32ae..69d57e96d7c 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -19,26 +19,26 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0D_Init( PyObject *module ) +int UnaryFunction0D_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0D_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0D_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0D_Type ); + Py_INCREF(&UnaryFunction0D_Type); PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); - UnaryFunction0DDouble_Init( module ); - UnaryFunction0DEdgeNature_Init( module ); - UnaryFunction0DFloat_Init( module ); - UnaryFunction0DId_Init( module ); - UnaryFunction0DMaterial_Init( module ); - UnaryFunction0DUnsigned_Init( module ); - UnaryFunction0DVec2f_Init( module ); - UnaryFunction0DVec3f_Init( module ); - UnaryFunction0DVectorViewShape_Init( module ); - UnaryFunction0DViewShape_Init( module ); + UnaryFunction0DDouble_Init(module); + UnaryFunction0DEdgeNature_Init(module); + UnaryFunction0DFloat_Init(module); + UnaryFunction0DId_Init(module); + UnaryFunction0DMaterial_Init(module); + UnaryFunction0DUnsigned_Init(module); + UnaryFunction0DVec2f_Init(module); + UnaryFunction0DVec3f_Init(module); + UnaryFunction0DVectorViewShape_Init(module); + UnaryFunction0DViewShape_Init(module); return 0; } @@ -67,15 +67,31 @@ static char UnaryFunction0D___doc__[] = static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D* self) { - Py_TYPE(self)->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } - static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D* self) { - return PyUnicode_FromString("UnaryFunction0D"); + return PyUnicode_FromString("UnaryFunction0D"); } +/*----------------------UnaryFunction0D get/setters ----------------------------*/ + +PyDoc_STRVAR(UnaryFunction0D_name_doc, +"The name of the unary 0D function.\n" +"\n" +":type: str"); + +static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure)) +{ + return PyUnicode_FromString(Py_TYPE(self)->tp_name); +} + +static PyGetSetDef BPy_UnaryFunction0D_getseters[] = { + {(char *)"name", (getter)UnaryFunction0D_name_get, (setter)NULL, (char *)UnaryFunction0D_name_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; + /*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/ PyTypeObject UnaryFunction0D_Type = { @@ -108,7 +124,7 @@ PyTypeObject UnaryFunction0D_Type = { 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction0D_getseters, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index f4de9edb962..91c566dc369 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -16,24 +16,24 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////////////////// //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1D_Init( PyObject *module ) +int UnaryFunction1D_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1D_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1D_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1D_Type ); + Py_INCREF(&UnaryFunction1D_Type); PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type); - UnaryFunction1DDouble_Init( module ); - UnaryFunction1DEdgeNature_Init( module ); - UnaryFunction1DFloat_Init( module ); - UnaryFunction1DUnsigned_Init( module ); - UnaryFunction1DVec2f_Init( module ); - UnaryFunction1DVec3f_Init( module ); - UnaryFunction1DVectorViewShape_Init( module ); - UnaryFunction1DVoid_Init( module ); + UnaryFunction1DDouble_Init(module); + UnaryFunction1DEdgeNature_Init(module); + UnaryFunction1DFloat_Init(module); + UnaryFunction1DUnsigned_Init(module); + UnaryFunction1DVec2f_Init(module); + UnaryFunction1DVec3f_Init(module); + UnaryFunction1DVectorViewShape_Init(module); + UnaryFunction1DVoid_Init(module); return 0; } @@ -59,14 +59,31 @@ static char UnaryFunction1D___doc__[] = static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D* self) { - Py_TYPE(self)->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D* self) { - return PyUnicode_FromString("UnaryFunction1D"); + return PyUnicode_FromString("UnaryFunction1D"); } +/*----------------------UnaryFunction1D get/setters ----------------------------*/ + +PyDoc_STRVAR(UnaryFunction1D_name_doc, +"The name of the unary 1D function.\n" +"\n" +":type: str"); + +static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *UNUSED(closure)) +{ + return PyUnicode_FromString(Py_TYPE(self)->tp_name); +} + +static PyGetSetDef BPy_UnaryFunction1D_getseters[] = { + {(char *)"name", (getter)UnaryFunction1D_name_get, (setter)NULL, (char *)UnaryFunction1D_name_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; + /*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/ PyTypeObject UnaryFunction1D_Type = { @@ -99,7 +116,7 @@ PyTypeObject UnaryFunction1D_Type = { 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1D_getseters, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index b61b9baf033..34c57e0bbd0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -24,64 +24,64 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DDouble_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DDouble_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DDouble_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DDouble_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DDouble_Type ); + Py_INCREF(&UnaryFunction0DDouble_Type); PyModule_AddObject(module, "UnaryFunction0DDouble", (PyObject *)&UnaryFunction0DDouble_Type); - if( PyType_Ready( &DensityF0D_Type ) < 0 ) + if (PyType_Ready(&DensityF0D_Type) < 0) return -1; - Py_INCREF( &DensityF0D_Type ); + Py_INCREF(&DensityF0D_Type); PyModule_AddObject(module, "DensityF0D", (PyObject *)&DensityF0D_Type); - if( PyType_Ready( &LocalAverageDepthF0D_Type ) < 0 ) + if (PyType_Ready(&LocalAverageDepthF0D_Type) < 0) return -1; - Py_INCREF( &LocalAverageDepthF0D_Type ); + Py_INCREF(&LocalAverageDepthF0D_Type); PyModule_AddObject(module, "LocalAverageDepthF0D", (PyObject *)&LocalAverageDepthF0D_Type); - if( PyType_Ready( &Curvature2DAngleF0D_Type ) < 0 ) + if (PyType_Ready(&Curvature2DAngleF0D_Type) < 0) return -1; - Py_INCREF( &Curvature2DAngleF0D_Type ); + Py_INCREF(&Curvature2DAngleF0D_Type); PyModule_AddObject(module, "Curvature2DAngleF0D", (PyObject *)&Curvature2DAngleF0D_Type); - if( PyType_Ready( &GetProjectedXF0D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedXF0D_Type) < 0) return -1; - Py_INCREF( &GetProjectedXF0D_Type ); + Py_INCREF(&GetProjectedXF0D_Type); PyModule_AddObject(module, "GetProjectedXF0D", (PyObject *)&GetProjectedXF0D_Type); - if( PyType_Ready( &GetProjectedYF0D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedYF0D_Type) < 0) return -1; - Py_INCREF( &GetProjectedYF0D_Type ); + Py_INCREF(&GetProjectedYF0D_Type); PyModule_AddObject(module, "GetProjectedYF0D", (PyObject *)&GetProjectedYF0D_Type); - if( PyType_Ready( &GetProjectedZF0D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedZF0D_Type) < 0) return -1; - Py_INCREF( &GetProjectedZF0D_Type ); + Py_INCREF(&GetProjectedZF0D_Type); PyModule_AddObject(module, "GetProjectedZF0D", (PyObject *)&GetProjectedZF0D_Type); - if( PyType_Ready( &GetXF0D_Type ) < 0 ) + if (PyType_Ready(&GetXF0D_Type) < 0) return -1; - Py_INCREF( &GetXF0D_Type ); + Py_INCREF(&GetXF0D_Type); PyModule_AddObject(module, "GetXF0D", (PyObject *)&GetXF0D_Type); - if( PyType_Ready( &GetYF0D_Type ) < 0 ) + if (PyType_Ready(&GetYF0D_Type) < 0) return -1; - Py_INCREF( &GetYF0D_Type ); + Py_INCREF(&GetYF0D_Type); PyModule_AddObject(module, "GetYF0D", (PyObject *)&GetYF0D_Type); - if( PyType_Ready( &GetZF0D_Type ) < 0 ) + if (PyType_Ready(&GetZF0D_Type) < 0) return -1; - Py_INCREF( &GetZF0D_Type ); + Py_INCREF(&GetZF0D_Type); PyModule_AddObject(module, "GetZF0D", (PyObject *)&GetZF0D_Type); - if( PyType_Ready( &ZDiscontinuityF0D_Type ) < 0 ) + if (PyType_Ready(&ZDiscontinuityF0D_Type) < 0) return -1; - Py_INCREF( &ZDiscontinuityF0D_Type ); + Py_INCREF(&ZDiscontinuityF0D_Type); PyModule_AddObject(module, "ZDiscontinuityF0D", (PyObject *)&ZDiscontinuityF0D_Type); return 0; @@ -101,8 +101,10 @@ static char UnaryFunction0DDouble___doc__[] = static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_double = new UnaryFunction0D(); self->uf0D_double->py_uf0D = (PyObject *)self; return 0; @@ -117,51 +119,32 @@ static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self) static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_double->getName().c_str(), self->uf0D_double ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_double->getName().c_str(), self->uf0D_double); } -static char UnaryFunction0DDouble_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self ) -{ - return PyUnicode_FromString( self->uf0D_double->getName().c_str() ); -} - -static PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - - if( typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D) ) { + + if (typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it)) < 0) { + if (self->uf0D_double->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_double->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyFloat_FromDouble( self->uf0D_double->result ); - + return PyFloat_FromDouble(self->uf0D_double->result); } -/*----------------------UnaryFunction0DDouble instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DDouble_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DDouble_getName, METH_NOARGS, UnaryFunction0DDouble_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index a5ecd46b3bd..7522b05e3e4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DEdgeNature_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DEdgeNature_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DEdgeNature_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DEdgeNature_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DEdgeNature_Type ); + Py_INCREF(&UnaryFunction0DEdgeNature_Type); PyModule_AddObject(module, "UnaryFunction0DEdgeNature", (PyObject *)&UnaryFunction0DEdgeNature_Type); - if( PyType_Ready( &CurveNatureF0D_Type ) < 0 ) + if (PyType_Ready(&CurveNatureF0D_Type) < 0) return -1; - Py_INCREF( &CurveNatureF0D_Type ); + Py_INCREF(&CurveNatureF0D_Type); PyModule_AddObject(module, "CurveNatureF0D", (PyObject *)&CurveNatureF0D_Type); return 0; @@ -45,8 +45,10 @@ static char UnaryFunction0DEdgeNature___doc__[] = static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_edgenature = new UnaryFunction0D(); self->uf0D_edgenature->py_uf0D = (PyObject *)self; return 0; @@ -61,51 +63,32 @@ static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_edgenature->getName().c_str(), self->uf0D_edgenature ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_edgenature->getName().c_str(), self->uf0D_edgenature); } -static char UnaryFunction0DEdgeNature_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *self ) -{ - return PyUnicode_FromString( self->uf0D_edgenature->getName().c_str() ); -} - -static PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - if( typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D) ) { + if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_edgenature->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_edgenature->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return BPy_Nature_from_Nature( self->uf0D_edgenature->result ); - + return BPy_Nature_from_Nature(self->uf0D_edgenature->result); } -/*----------------------UnaryFunction0DEdgeNature instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DEdgeNature_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DEdgeNature_getName, METH_NOARGS, UnaryFunction0DEdgeNature_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 72ca2acf3b7..f2707bf3ae8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -18,44 +18,44 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DFloat_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DFloat_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DFloat_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DFloat_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DFloat_Type ); + Py_INCREF(&UnaryFunction0DFloat_Type); PyModule_AddObject(module, "UnaryFunction0DFloat", (PyObject *)&UnaryFunction0DFloat_Type); - if( PyType_Ready( &GetCurvilinearAbscissaF0D_Type ) < 0 ) + if (PyType_Ready(&GetCurvilinearAbscissaF0D_Type) < 0) return -1; - Py_INCREF( &GetCurvilinearAbscissaF0D_Type ); + Py_INCREF(&GetCurvilinearAbscissaF0D_Type); PyModule_AddObject(module, "GetCurvilinearAbscissaF0D", (PyObject *)&GetCurvilinearAbscissaF0D_Type); - if( PyType_Ready( &GetParameterF0D_Type ) < 0 ) + if (PyType_Ready(&GetParameterF0D_Type) < 0) return -1; - Py_INCREF( &GetParameterF0D_Type ); + Py_INCREF(&GetParameterF0D_Type); PyModule_AddObject(module, "GetParameterF0D", (PyObject *)&GetParameterF0D_Type); - if( PyType_Ready( &GetViewMapGradientNormF0D_Type ) < 0 ) + if (PyType_Ready(&GetViewMapGradientNormF0D_Type) < 0) return -1; - Py_INCREF( &GetViewMapGradientNormF0D_Type ); + Py_INCREF(&GetViewMapGradientNormF0D_Type); PyModule_AddObject(module, "GetViewMapGradientNormF0D", (PyObject *)&GetViewMapGradientNormF0D_Type); - if( PyType_Ready( &ReadCompleteViewMapPixelF0D_Type ) < 0 ) + if (PyType_Ready(&ReadCompleteViewMapPixelF0D_Type) < 0) return -1; - Py_INCREF( &ReadCompleteViewMapPixelF0D_Type ); + Py_INCREF(&ReadCompleteViewMapPixelF0D_Type); PyModule_AddObject(module, "ReadCompleteViewMapPixelF0D", (PyObject *)&ReadCompleteViewMapPixelF0D_Type); - if( PyType_Ready( &ReadMapPixelF0D_Type ) < 0 ) + if (PyType_Ready(&ReadMapPixelF0D_Type) < 0) return -1; - Py_INCREF( &ReadMapPixelF0D_Type ); + Py_INCREF(&ReadMapPixelF0D_Type); PyModule_AddObject(module, "ReadMapPixelF0D", (PyObject *)&ReadMapPixelF0D_Type); - if( PyType_Ready( &ReadSteerableViewMapPixelF0D_Type ) < 0 ) + if (PyType_Ready(&ReadSteerableViewMapPixelF0D_Type) < 0) return -1; - Py_INCREF( &ReadSteerableViewMapPixelF0D_Type ); + Py_INCREF(&ReadSteerableViewMapPixelF0D_Type); PyModule_AddObject(module, "ReadSteerableViewMapPixelF0D", (PyObject *)&ReadSteerableViewMapPixelF0D_Type); return 0; @@ -75,8 +75,10 @@ static char UnaryFunction0DFloat___doc__[] = static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_float = new UnaryFunction0D(); self->uf0D_float->py_uf0D = (PyObject *)self; return 0; @@ -91,51 +93,32 @@ static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self) static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_float->getName().c_str(), self->uf0D_float ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_float->getName().c_str(), self->uf0D_float); } -static char UnaryFunction0DFloat_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self ) -{ - return PyUnicode_FromString( self->uf0D_float->getName().c_str() ); -} - -static PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - if( typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D) ) { + if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_float->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_float->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_float->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyFloat_FromDouble( self->uf0D_float->result ); - + return PyFloat_FromDouble(self->uf0D_float->result); } -/*----------------------UnaryFunction0DFloat instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DFloat_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DFloat_getName, METH_NOARGS, UnaryFunction0DFloat_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 3c4ccdbcbf1..a7a67710869 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DId_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DId_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DId_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DId_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DId_Type ); + Py_INCREF(&UnaryFunction0DId_Type); PyModule_AddObject(module, "UnaryFunction0DId", (PyObject *)&UnaryFunction0DId_Type); - if( PyType_Ready( &ShapeIdF0D_Type ) < 0 ) + if (PyType_Ready(&ShapeIdF0D_Type) < 0) return -1; - Py_INCREF( &ShapeIdF0D_Type ); + Py_INCREF(&ShapeIdF0D_Type); PyModule_AddObject(module, "ShapeIdF0D", (PyObject *)&ShapeIdF0D_Type); return 0; @@ -45,8 +45,10 @@ static char UnaryFunction0DId___doc__[] = static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_id = new UnaryFunction0D(); self->uf0D_id->py_uf0D = (PyObject *)self; return 0; @@ -61,50 +63,32 @@ static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self) static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_id->getName().c_str(), self->uf0D_id ); -} - -static char UnaryFunction0DId_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self ) -{ - return PyUnicode_FromString( self->uf0D_id->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_id->getName().c_str(), self->uf0D_id); } -static PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - if( typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D) ) { + if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_id->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_id->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_id->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return BPy_Id_from_Id( self->uf0D_id->result ); + return BPy_Id_from_Id(self->uf0D_id->result); } -/*----------------------UnaryFunction0DId instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DId_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DId_getName, METH_NOARGS, UnaryFunction0DId_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index d61453172b9..5206a61a820 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DMaterial_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DMaterial_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DMaterial_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DMaterial_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DMaterial_Type ); + Py_INCREF(&UnaryFunction0DMaterial_Type); PyModule_AddObject(module, "UnaryFunction0DMaterial", (PyObject *)&UnaryFunction0DMaterial_Type); - if( PyType_Ready( &MaterialF0D_Type ) < 0 ) + if (PyType_Ready(&MaterialF0D_Type) < 0) return -1; - Py_INCREF( &MaterialF0D_Type ); + Py_INCREF(&MaterialF0D_Type); PyModule_AddObject(module, "MaterialF0D", (PyObject *)&MaterialF0D_Type); return 0; @@ -45,8 +45,10 @@ static char UnaryFunction0DMaterial___doc__[] = static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_material = new UnaryFunction0D(); self->uf0D_material->py_uf0D = (PyObject *)self; return 0; @@ -62,51 +64,33 @@ static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* sel static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_material->getName().c_str(), self->uf0D_material ); -} - -static char UnaryFunction0DMaterial_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self ) -{ - return PyUnicode_FromString( self->uf0D_material->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_material->getName().c_str(), self->uf0D_material); } -static PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - if( typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D) ) { + if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_material->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_material->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_material->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return BPy_FrsMaterial_from_FrsMaterial( self->uf0D_material->result ); + return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result); } -/*----------------------UnaryFunction0DMaterial instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DMaterial_getName, METH_NOARGS, UnaryFunction0DMaterial_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 37f6a2ab342..5d9a2f4517c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DUnsigned_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction0DUnsigned_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DUnsigned_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DUnsigned_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DUnsigned_Type ); + Py_INCREF(&UnaryFunction0DUnsigned_Type); PyModule_AddObject(module, "UnaryFunction0DUnsigned", (PyObject *)&UnaryFunction0DUnsigned_Type); - if( PyType_Ready( &QuantitativeInvisibilityF0D_Type ) < 0 ) + if (PyType_Ready(&QuantitativeInvisibilityF0D_Type) < 0) return -1; - Py_INCREF( &QuantitativeInvisibilityF0D_Type ); + Py_INCREF(&QuantitativeInvisibilityF0D_Type); PyModule_AddObject(module, "QuantitativeInvisibilityF0D", (PyObject *)&QuantitativeInvisibilityF0D_Type); return 0; @@ -45,8 +45,10 @@ static char UnaryFunction0DUnsigned___doc__[] = static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self, PyObject *args, PyObject *kwds) { - if ( !PyArg_ParseTuple(args, "") ) - return -1; + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; self->uf0D_unsigned = new UnaryFunction0D(); self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; @@ -61,51 +63,33 @@ static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* sel static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_unsigned->getName().c_str(), self->uf0D_unsigned ); -} - -static char UnaryFunction0DUnsigned_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 0D predicate.\n" -"\n" -" :return: The name of the unary 0D predicate.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self ) -{ - return PyUnicode_FromString( self->uf0D_unsigned->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_unsigned->getName().c_str(), self->uf0D_unsigned); } -static PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"it", NULL}; PyObject *obj; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - if( typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D) ) { + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_unsigned->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_unsigned->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_unsigned->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyLong_FromLong( self->uf0D_unsigned->result ); + return PyLong_FromLong(self->uf0D_unsigned->result); } -/*----------------------UnaryFunction0DUnsigned instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DUnsigned_getName, METH_NOARGS, UnaryFunction0DUnsigned_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index 9c9e2e85568..d8518844d00 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -100,8 +100,8 @@ static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, } if (self->uf0D_vec2f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_vec2f->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 13f8dd69fa1..2f3c5d0f7e9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -94,8 +94,8 @@ static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, } if (self->uf0D_vec3f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_vec3f->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 40564b018d6..688c9851d30 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -95,8 +95,8 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe } if (self->uf0D_vectorviewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_vectorviewshape->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 5f3f18453ba..1fbe23a1d6d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -100,8 +100,8 @@ static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShap } if (self->uf0D_viewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf0D_viewshape->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").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 49e8310380a..d1f29d39d85 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 @@ -33,9 +33,11 @@ static char ShapeIdF0D___doc__[] = " :return: The Id of the Shape the pointed Interface0D belongs to.\n" " :rtype: :class:`Id`\n"; -static int ShapeIdF0D___init__( BPy_ShapeIdF0D* self, PyObject *args ) +static int ShapeIdF0D___init__(BPy_ShapeIdF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_id.uf0D_id = new Functions0D::ShapeIdF0D(); self->py_uf0D_id.uf0D_id->py_uf0D = (PyObject *)self; 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 85ea137134a..aa3491cd428 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 @@ -37,9 +37,11 @@ static char MaterialF0D___doc__[] = " Interface0D.\n" " :rtype: :class:`Material`\n"; -static int MaterialF0D___init__( BPy_MaterialF0D* self, PyObject *args ) +static int MaterialF0D___init__(BPy_MaterialF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_material.uf0D_material = new Functions0D::MaterialF0D(); self->py_uf0D_material.uf0D_material->py_uf0D = (PyObject *)self; 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 0d2023313ca..6e97584c556 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 @@ -28,9 +28,11 @@ static char CurveNatureF0D___doc__[] = " belongs.\n" " :rtype: :class:`Nature`\n"; -static int CurveNatureF0D___init__( BPy_CurveNatureF0D* self, PyObject *args ) +static int CurveNatureF0D___init__(BPy_CurveNatureF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_edgenature.uf0D_edgenature = new Functions0D::CurveNatureF0D(); self->py_uf0D_edgenature.uf0D_edgenature->py_uf0D = (PyObject *)self; 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 fdec2c324c6..81801c57747 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 @@ -30,9 +30,11 @@ static char Normal2DF0D___doc__[] = " Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int Normal2DF0D___init__( BPy_Normal2DF0D* self, PyObject *args ) +static int Normal2DF0D___init__(BPy_Normal2DF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::Normal2DF0D(); self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; 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 f362293e179..27412d3ccf1 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 @@ -30,9 +30,11 @@ static char VertexOrientation2DF0D___doc__[] = " pointed Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int VertexOrientation2DF0D___init__( BPy_VertexOrientation2DF0D* self, PyObject *args ) +static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::VertexOrientation2DF0D(); self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self; 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 8cb3e88efe3..1ed509c8b66 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 @@ -30,9 +30,11 @@ static char VertexOrientation3DF0D___doc__[] = " pointed Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int VertexOrientation3DF0D___init__( BPy_VertexOrientation3DF0D* self, PyObject *args ) +static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_vec3f.uf0D_vec3f = new Functions0D::VertexOrientation3DF0D(); self->py_uf0D_vec3f.uf0D_vec3f->py_uf0D = (PyObject *)self; 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 8bfd2bb2638..3cb32391c7e 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 @@ -27,9 +27,11 @@ static char GetOccludeeF0D___doc__[] = " :return: The ViewShape occluded by the pointed Interface0D.\n" " :rtype: :class:`ViewShape`\n"; -static int GetOccludeeF0D___init__( BPy_GetOccludeeF0D* self, PyObject *args ) +static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetOccludeeF0D(); self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; 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 3cc931edec5..7b74669302c 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 @@ -27,9 +27,11 @@ static char GetShapeF0D___doc__[] = " :return: The ViewShape containing the pointed Interface0D.\n" " :rtype: :class:`ViewShape`\n"; -static int GetShapeF0D___init__( BPy_GetShapeF0D* self, PyObject *args ) +static int GetShapeF0D___init__(BPy_GetShapeF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetShapeF0D(); self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self; 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 e28b1ca138a..1e2e78852cf 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 @@ -30,9 +30,11 @@ static char Curvature2DAngleF0D___doc__[] = " pointed Interface0D.\n" " :rtype: float\n"; -static int Curvature2DAngleF0D___init__( BPy_Curvature2DAngleF0D* self, PyObject *args ) +static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::Curvature2DAngleF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 64c2d453552..213dc77446f 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 @@ -35,11 +35,12 @@ static char DensityF0D___doc__[] = " Interface0D.\n" " :rtype: float\n"; -static int DensityF0D___init__( BPy_DensityF0D* self, PyObject *args) +static int DensityF0D___init__(BPy_DensityF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"sigma", NULL}; double d = 2; - if( !PyArg_ParseTuple(args, "|d", &d) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 e539ca10dc8..99c9f43eecb 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 @@ -27,9 +27,11 @@ static char GetProjectedXF0D___doc__[] = " :return: The X 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedXF0D___init__( BPy_GetProjectedXF0D* self, PyObject *args ) +static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedXF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 4e1fbbd699c..da328a79ab9 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 @@ -27,9 +27,11 @@ static char GetProjectedYF0D___doc__[] = " :return: The Y 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedYF0D___init__( BPy_GetProjectedYF0D* self, PyObject *args ) +static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedYF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 73a68b8f6a8..9c761a58e38 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 @@ -27,9 +27,11 @@ static char GetProjectedZF0D___doc__[] = " :return: The Z 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetProjectedZF0D___init__( BPy_GetProjectedZF0D* self, PyObject *args ) +static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedZF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 099977e35eb..fb2c8be6a9a 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 @@ -27,9 +27,11 @@ static char GetXF0D___doc__[] = " :return: The X 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetXF0D___init__( BPy_GetXF0D* self, PyObject *args ) +static int GetXF0D___init__(BPy_GetXF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetXF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 7640dafef6f..97882fc51e2 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 @@ -27,9 +27,11 @@ static char GetYF0D___doc__[] = " :return: The Y 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetYF0D___init__( BPy_GetYF0D* self, PyObject *args ) +static int GetYF0D___init__(BPy_GetYF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetYF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 01932c2b4ed..58eea1d5240 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 @@ -27,9 +27,11 @@ static char GetZF0D___doc__[] = " :return: The Z 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetZF0D___init__( BPy_GetZF0D* self, PyObject *args ) +static int GetZF0D___init__(BPy_GetZF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::GetZF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 f268fdf7003..0c4c4135b7c 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 @@ -13,12 +13,12 @@ extern "C" { static char LocalAverageDepthF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" "\n" -".. method:: __init__(maskSize=5.0)\n" +".. method:: __init__(mask_size=5.0)\n" "\n" " Builds a LocalAverageDepthF0D object.\n" "\n" -" :arg maskSize: The size of the mask.\n" -" :type maskSize: float\n" +" :arg mask_size: The size of the mask.\n" +" :type mask_size: float\n" "\n" ".. method:: __call__(it)\n" "\n" @@ -31,11 +31,12 @@ static char LocalAverageDepthF0D___doc__[] = " :return: The average depth around the pointed Interface0D.\n" " :rtype: float\n"; -static int LocalAverageDepthF0D___init__( BPy_LocalAverageDepthF0D* self, PyObject *args) +static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"mask_size", NULL}; double d = 5.0; - if( !PyArg_ParseTuple(args, "|d", &d) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 20e2ab31bda..599ba5ee76b 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 @@ -32,9 +32,11 @@ static char ZDiscontinuityF0D___doc__[] = " and the occludee.\n" " :rtype: float\n"; -static int ZDiscontinuityF0D___init__( BPy_ZDiscontinuityF0D* self, PyObject *args ) +static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_double.uf0D_double = new Functions0D::ZDiscontinuityF0D(); self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self; 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 4aaceb3559a..5e37c81306c 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 @@ -28,9 +28,11 @@ static char GetCurvilinearAbscissaF0D___doc__[] = " :return: The curvilinear abscissa of the pointed Interface0D.\n" " :rtype: float\n"; -static int GetCurvilinearAbscissaF0D___init__( BPy_GetCurvilinearAbscissaF0D* self, PyObject *args ) +static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D(); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; 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 aeea47deffc..54aba274936 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 @@ -27,9 +27,11 @@ static char GetParameterF0D___doc__[] = " :return: The parameter of an Interface0D.\n" " :rtype: float\n"; -static int GetParameterF0D___init__( BPy_GetParameterF0D* self, PyObject *args ) +static int GetParameterF0D___init__(BPy_GetParameterF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D(); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; 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 bac65716ba9..29c1373870e 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 @@ -32,11 +32,12 @@ static char GetViewMapGradientNormF0D___doc__[] = " image.\n" " :rtype: float\n"; -static int GetViewMapGradientNormF0D___init__( BPy_GetViewMapGradientNormF0D* self, PyObject *args) +static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", NULL}; int i; - if( !PyArg_ParseTuple(args, "i", &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; 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 6a40266cf7b..3c9b9b52253 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 @@ -30,11 +30,12 @@ static char ReadCompleteViewMapPixelF0D___doc__[] = " :return: A pixel in one of the level of the complete viewmap.\n" " :rtype: float\n"; -static int ReadCompleteViewMapPixelF0D___init__( BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args) +static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", NULL}; int i; - if( !PyArg_ParseTuple(args, "i", &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) return -1; self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i); self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self; 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 74cf688507e..189a7c525c7 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 @@ -13,12 +13,12 @@ extern "C" { static char ReadMapPixelF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" "\n" -".. method:: __init__(iMapName, level)\n" +".. method:: __init__(map_name, level)\n" "\n" " Builds a ReadMapPixelF0D object.\n" "\n" -" :arg iMapName: The name of the map to be read.\n" -" :type iMapName: str\n" +" :arg map_name: The name of the map to be read.\n" +" :type map_name: str\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" @@ -32,12 +32,13 @@ static char ReadMapPixelF0D___doc__[] = " :return: A pixel in a map.\n" " :rtype: float\n"; -static int ReadMapPixelF0D___init__( BPy_ReadMapPixelF0D* self, PyObject *args) +static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"map_name", "level", NULL}; const char *s; int i; - if( !PyArg_ParseTuple(args, "si", &s, &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "si", (char **)kwlist, &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; 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 db0145e3e2a..f42a65e4bf7 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 @@ -13,13 +13,13 @@ extern "C" { static char ReadSteerableViewMapPixelF0D___doc__[] = "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" "\n" -".. method:: __init__(nOrientation, level)\n" +".. method:: __init__(orientation, level)\n" "\n" " Builds a ReadSteerableViewMapPixelF0D object.\n" "\n" -" :arg nOrientation: The integer belonging to [0, 4] indicating the\n" +" :arg orientation: The integer belonging to [0, 4] indicating the\n" " orientation (E, NE, N, NW) we are interested in.\n" -" :type nOrientation: int\n" +" :type orientation: int\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" @@ -33,12 +33,13 @@ static char ReadSteerableViewMapPixelF0D___doc__[] = " :return: A pixel in one of the level of one of the steerable viewmaps.\n" " :rtype: float\n"; -static int ReadSteerableViewMapPixelF0D___init__( BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args) +static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"orientation", "level", NULL}; unsigned int u; int i; - if( !PyArg_ParseTuple(args, "Ii", &u, &i) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &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; 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 e993a99c1d8..80e05d1010b 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 @@ -33,9 +33,11 @@ static char QuantitativeInvisibilityF0D___doc__[] = " :return: The quantitative invisibility of the pointed Interface0D.\n" " :rtype: int\n"; -static int QuantitativeInvisibilityF0D___init__( BPy_QuantitativeInvisibilityF0D* self, PyObject *args ) +static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_unsigned.uf0D_unsigned = new Functions0D::QuantitativeInvisibilityF0D(); self->py_uf0D_unsigned.uf0D_unsigned->py_uf0D = (PyObject *)self; 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 50686ce92f9..9b232c77ec9 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 @@ -28,9 +28,11 @@ static char GetOccludersF0D___doc__[] = " Interface0D.\n" " :rtype: list of :class:`ViewShape` objects\n"; -static int GetOccludersF0D___init__( BPy_GetOccludersF0D* self, PyObject *args ) +static int GetOccludersF0D___init__(BPy_GetOccludersF0D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf0D_vectorviewshape.uf0D_vectorviewshape = new Functions0D::GetOccludersF0D(); self->py_uf0D_vectorviewshape.uf0D_vectorviewshape->py_uf0D = (PyObject *)self; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 07fb48dd9a8..180f39c5e59 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -28,84 +28,84 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DDouble_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DDouble_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DDouble_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DDouble_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DDouble_Type ); + Py_INCREF(&UnaryFunction1DDouble_Type); PyModule_AddObject(module, "UnaryFunction1DDouble", (PyObject *)&UnaryFunction1DDouble_Type); - if( PyType_Ready( &DensityF1D_Type ) < 0 ) + if (PyType_Ready(&DensityF1D_Type) < 0) return -1; - Py_INCREF( &DensityF1D_Type ); + Py_INCREF(&DensityF1D_Type); PyModule_AddObject(module, "DensityF1D", (PyObject *)&DensityF1D_Type); - if( PyType_Ready( &Curvature2DAngleF1D_Type ) < 0 ) + if (PyType_Ready(&Curvature2DAngleF1D_Type) < 0) return -1; - Py_INCREF( &Curvature2DAngleF1D_Type ); + Py_INCREF(&Curvature2DAngleF1D_Type); PyModule_AddObject(module, "Curvature2DAngleF1D", (PyObject *)&Curvature2DAngleF1D_Type); - if( PyType_Ready( &GetCompleteViewMapDensityF1D_Type ) < 0 ) + if (PyType_Ready(&GetCompleteViewMapDensityF1D_Type) < 0) return -1; - Py_INCREF( &GetCompleteViewMapDensityF1D_Type ); + Py_INCREF(&GetCompleteViewMapDensityF1D_Type); PyModule_AddObject(module, "GetCompleteViewMapDensityF1D", (PyObject *)&GetCompleteViewMapDensityF1D_Type); - if( PyType_Ready( &GetDirectionalViewMapDensityF1D_Type ) < 0 ) + if (PyType_Ready(&GetDirectionalViewMapDensityF1D_Type) < 0) return -1; - Py_INCREF( &GetDirectionalViewMapDensityF1D_Type ); + Py_INCREF(&GetDirectionalViewMapDensityF1D_Type); PyModule_AddObject(module, "GetDirectionalViewMapDensityF1D", (PyObject *)&GetDirectionalViewMapDensityF1D_Type); - if( PyType_Ready( &GetProjectedXF1D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedXF1D_Type) < 0) return -1; - Py_INCREF( &GetProjectedXF1D_Type ); + Py_INCREF(&GetProjectedXF1D_Type); PyModule_AddObject(module, "GetProjectedXF1D", (PyObject *)&GetProjectedXF1D_Type); - if( PyType_Ready( &GetProjectedYF1D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedYF1D_Type) < 0) return -1; - Py_INCREF( &GetProjectedYF1D_Type ); + Py_INCREF(&GetProjectedYF1D_Type); PyModule_AddObject(module, "GetProjectedYF1D", (PyObject *)&GetProjectedYF1D_Type); - if( PyType_Ready( &GetProjectedZF1D_Type ) < 0 ) + if (PyType_Ready(&GetProjectedZF1D_Type) < 0) return -1; - Py_INCREF( &GetProjectedZF1D_Type ); + Py_INCREF(&GetProjectedZF1D_Type); PyModule_AddObject(module, "GetProjectedZF1D", (PyObject *)&GetProjectedZF1D_Type); - if( PyType_Ready( &GetSteerableViewMapDensityF1D_Type ) < 0 ) + if (PyType_Ready(&GetSteerableViewMapDensityF1D_Type) < 0) return -1; - Py_INCREF( &GetSteerableViewMapDensityF1D_Type ); + Py_INCREF(&GetSteerableViewMapDensityF1D_Type); PyModule_AddObject(module, "GetSteerableViewMapDensityF1D", (PyObject *)&GetSteerableViewMapDensityF1D_Type); - if( PyType_Ready( &GetViewMapGradientNormF1D_Type ) < 0 ) + if (PyType_Ready(&GetViewMapGradientNormF1D_Type) < 0) return -1; - Py_INCREF( &GetViewMapGradientNormF1D_Type ); + Py_INCREF(&GetViewMapGradientNormF1D_Type); PyModule_AddObject(module, "GetViewMapGradientNormF1D", (PyObject *)&GetViewMapGradientNormF1D_Type); - if( PyType_Ready( &GetXF1D_Type ) < 0 ) + if (PyType_Ready(&GetXF1D_Type) < 0) return -1; - Py_INCREF( &GetXF1D_Type ); + Py_INCREF(&GetXF1D_Type); PyModule_AddObject(module, "GetXF1D", (PyObject *)&GetXF1D_Type); - if( PyType_Ready( &GetYF1D_Type ) < 0 ) + if (PyType_Ready(&GetYF1D_Type) < 0) return -1; - Py_INCREF( &GetYF1D_Type ); + Py_INCREF(&GetYF1D_Type); PyModule_AddObject(module, "GetYF1D", (PyObject *)&GetYF1D_Type); - if( PyType_Ready( &GetZF1D_Type ) < 0 ) + if (PyType_Ready(&GetZF1D_Type) < 0) return -1; - Py_INCREF( &GetZF1D_Type ); + Py_INCREF(&GetZF1D_Type); PyModule_AddObject(module, "GetZF1D", (PyObject *)&GetZF1D_Type); - if( PyType_Ready( &LocalAverageDepthF1D_Type ) < 0 ) + if (PyType_Ready(&LocalAverageDepthF1D_Type) < 0) return -1; - Py_INCREF( &LocalAverageDepthF1D_Type ); + Py_INCREF(&LocalAverageDepthF1D_Type); PyModule_AddObject(module, "LocalAverageDepthF1D", (PyObject *)&LocalAverageDepthF1D_Type); - if( PyType_Ready( &ZDiscontinuityF1D_Type ) < 0 ) + if (PyType_Ready(&ZDiscontinuityF1D_Type) < 0) return -1; - Py_INCREF( &ZDiscontinuityF1D_Type ); + Py_INCREF(&ZDiscontinuityF1D_Type); PyModule_AddObject(module, "ZDiscontinuityF1D", (PyObject *)&ZDiscontinuityF1D_Type); return 0; @@ -123,25 +123,26 @@ static char UnaryFunction1DDouble___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *args) +static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_double = new UnaryFunction1D(); else { - self->uf1D_double = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_double = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_double->py_uf1D = (PyObject *)self; @@ -158,85 +159,60 @@ static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self) static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_double->getName().c_str(), self->uf1D_double ); -} - -static char UnaryFunction1DDouble_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self ) -{ - return PyUnicode_FromString( self->uf1D_double->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_double->getName().c_str(), self->uf1D_double); } -static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_double->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_double->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_double->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyFloat_FromDouble( self->uf1D_double->result ); - + return PyFloat_FromDouble(self->uf1D_double->result); } -static char UnaryFunction1DDouble_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DDouble_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DDouble get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DDouble *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_double->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_double->getIntegrationType()); } -static char UnaryFunction1DDouble_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DDouble_getIntegrationType(BPy_UnaryFunction1DDouble* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_double->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DDouble *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_double->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DDouble instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DDouble_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DDouble_getName, METH_NOARGS, UnaryFunction1DDouble_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_setIntegrationType, METH_VARARGS, UnaryFunction1DDouble_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_getIntegrationType, METH_NOARGS, UnaryFunction1DDouble_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DDouble_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DDouble type definition ------------------------------*/ @@ -271,7 +247,7 @@ PyTypeObject UnaryFunction1DDouble_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DDouble_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DDouble_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 4f6a672857a..5a7c7aebe18 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -14,19 +14,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DEdgeNature_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DEdgeNature_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DEdgeNature_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DEdgeNature_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DEdgeNature_Type ); + Py_INCREF(&UnaryFunction1DEdgeNature_Type); PyModule_AddObject(module, "UnaryFunction1DEdgeNature", (PyObject *)&UnaryFunction1DEdgeNature_Type); - if( PyType_Ready( &CurveNatureF1D_Type ) < 0 ) + if (PyType_Ready(&CurveNatureF1D_Type) < 0) return -1; - Py_INCREF( &CurveNatureF1D_Type ); + Py_INCREF(&CurveNatureF1D_Type); PyModule_AddObject(module, "CurveNatureF1D", (PyObject *)&CurveNatureF1D_Type); return 0; @@ -44,25 +44,26 @@ static char UnaryFunction1DEdgeNature___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_edgenature = new UnaryFunction1D(); else { - self->uf1D_edgenature = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_edgenature = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_edgenature->py_uf1D = (PyObject *)self; @@ -79,85 +80,61 @@ static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_edgenature->getName().c_str(), self->uf1D_edgenature ); -} - -static char UnaryFunction1DEdgeNature_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self ) -{ - return PyUnicode_FromString( self->uf1D_edgenature->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_edgenature->getName().c_str(), self->uf1D_edgenature); } -static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_edgenature->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_edgenature->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_edgenature->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return BPy_Nature_from_Nature( self->uf1D_edgenature->result ); + return BPy_Nature_from_Nature(self->uf1D_edgenature->result); } -static char UnaryFunction1DEdgeNature_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DEdgeNature_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DEdgeNature get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeNature* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DEdgeNature *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_edgenature->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_edgenature->getIntegrationType()); } -static char UnaryFunction1DEdgeNature_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DEdgeNature_getIntegrationType(BPy_UnaryFunction1DEdgeNature* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_edgenature->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DEdgeNature *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_edgenature->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DEdgeNature instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DEdgeNature_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DEdgeNature_getName, METH_NOARGS, UnaryFunction1DEdgeNature_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_setIntegrationType, METH_VARARGS, UnaryFunction1DEdgeNature_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_getIntegrationType, METH_NOARGS, UnaryFunction1DEdgeNature_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DEdgeNature_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DEdgeNature type definition ------------------------------*/ @@ -192,7 +169,7 @@ PyTypeObject UnaryFunction1DEdgeNature_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DEdgeNature_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DEdgeNature_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 9f16ed9ce36..1898212337a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -12,14 +12,14 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DFloat_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DFloat_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DFloat_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DFloat_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DFloat_Type ); + Py_INCREF(&UnaryFunction1DFloat_Type); PyModule_AddObject(module, "UnaryFunction1DFloat", (PyObject *)&UnaryFunction1DFloat_Type); return 0; @@ -37,25 +37,26 @@ static char UnaryFunction1DFloat___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args) +static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_float = new UnaryFunction1D(); else { - self->uf1D_float = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_float = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_float->py_uf1D = (PyObject *)self; @@ -72,85 +73,61 @@ static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_float->getName().c_str(), self->uf1D_float ); -} - -static char UnaryFunction1DFloat_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self ) -{ - return PyUnicode_FromString( self->uf1D_float->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_float->getName().c_str(), self->uf1D_float); } -static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_float->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_float->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_float->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyFloat_FromDouble( self->uf1D_float->result ); + return PyFloat_FromDouble(self->uf1D_float->result); } -static char UnaryFunction1DFloat_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DFloat_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DFloat get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DFloat *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_float->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_float->getIntegrationType()); } -static char UnaryFunction1DFloat_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DFloat_getIntegrationType(BPy_UnaryFunction1DFloat* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_float->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DFloat *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_float->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DFloat instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DFloat_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DFloat_getName, METH_NOARGS, UnaryFunction1DFloat_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_setIntegrationType, METH_VARARGS, UnaryFunction1DFloat_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_getIntegrationType, METH_NOARGS, UnaryFunction1DFloat_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DFloat_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DFloat type definition ------------------------------*/ @@ -185,7 +162,7 @@ PyTypeObject UnaryFunction1DFloat_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DFloat_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DFloat_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 98615728c63..fc6c792b4b1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -14,19 +14,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DUnsigned_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DUnsigned_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DUnsigned_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DUnsigned_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DUnsigned_Type ); + Py_INCREF(&UnaryFunction1DUnsigned_Type); PyModule_AddObject(module, "UnaryFunction1DUnsigned", (PyObject *)&UnaryFunction1DUnsigned_Type); - if( PyType_Ready( &QuantitativeInvisibilityF1D_Type ) < 0 ) + if (PyType_Ready(&QuantitativeInvisibilityF1D_Type) < 0) return -1; - Py_INCREF( &QuantitativeInvisibilityF1D_Type ); + Py_INCREF(&QuantitativeInvisibilityF1D_Type); PyModule_AddObject(module, "QuantitativeInvisibilityF1D", (PyObject *)&QuantitativeInvisibilityF1D_Type); return 0; @@ -44,25 +44,26 @@ static char UnaryFunction1DUnsigned___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_unsigned = new UnaryFunction1D(); else { - self->uf1D_unsigned = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_unsigned = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_unsigned->py_uf1D = (PyObject *)self; @@ -79,85 +80,61 @@ static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* sel static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_unsigned->getName().c_str(), self->uf1D_unsigned ); -} - -static char UnaryFunction1DUnsigned_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self ) -{ - return PyUnicode_FromString( self->uf1D_unsigned->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_unsigned->getName().c_str(), self->uf1D_unsigned); } -static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_unsigned->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_unsigned->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_unsigned->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return PyLong_FromLong( self->uf1D_unsigned->result ); + return PyLong_FromLong(self->uf1D_unsigned->result); } -static char UnaryFunction1DUnsigned_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DUnsigned_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DUnsigned get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigned* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DUnsigned *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_unsigned->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_unsigned->getIntegrationType()); } -static char UnaryFunction1DUnsigned_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DUnsigned_getIntegrationType(BPy_UnaryFunction1DUnsigned* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_unsigned->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DUnsigned *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_unsigned->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DUnsigned instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DUnsigned_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DUnsigned_getName, METH_NOARGS, UnaryFunction1DUnsigned_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_setIntegrationType, METH_VARARGS, UnaryFunction1DUnsigned_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_getIntegrationType, METH_NOARGS, UnaryFunction1DUnsigned_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DUnsigned_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DUnsigned type definition ------------------------------*/ @@ -192,7 +169,7 @@ PyTypeObject UnaryFunction1DUnsigned_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DUnsigned_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DUnsigned_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 9f2c52c6f44..d67c960db8e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -15,24 +15,24 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DVec2f_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DVec2f_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DVec2f_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DVec2f_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DVec2f_Type ); + Py_INCREF(&UnaryFunction1DVec2f_Type); PyModule_AddObject(module, "UnaryFunction1DVec2f", (PyObject *)&UnaryFunction1DVec2f_Type); - if( PyType_Ready( &Normal2DF1D_Type ) < 0 ) + if (PyType_Ready(&Normal2DF1D_Type) < 0) return -1; - Py_INCREF( &Normal2DF1D_Type ); + Py_INCREF(&Normal2DF1D_Type); PyModule_AddObject(module, "Normal2DF1D", (PyObject *)&Normal2DF1D_Type); - if( PyType_Ready( &Orientation2DF1D_Type ) < 0 ) + if (PyType_Ready(&Orientation2DF1D_Type) < 0) return -1; - Py_INCREF( &Orientation2DF1D_Type ); + Py_INCREF(&Orientation2DF1D_Type); PyModule_AddObject(module, "Orientation2DF1D", (PyObject *)&Orientation2DF1D_Type); return 0; @@ -50,25 +50,26 @@ static char UnaryFunction1DVec2f___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args) +static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_vec2f = new UnaryFunction1D(); else { - self->uf1D_vec2f = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_vec2f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_vec2f->py_uf1D = (PyObject *)self; @@ -85,85 +86,61 @@ static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec2f->getName().c_str(), self->uf1D_vec2f ); -} - -static char UnaryFunction1DVec2f_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self ) -{ - return PyUnicode_FromString( self->uf1D_vec2f->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec2f->getName().c_str(), self->uf1D_vec2f); } -static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_vec2f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_vec2f->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_vec2f->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return Vector_from_Vec2f( self->uf1D_vec2f->result ); + return Vector_from_Vec2f(self->uf1D_vec2f->result); } -static char UnaryFunction1DVec2f_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DVec2f_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DVec2f get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DVec2f *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_vec2f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec2f->getIntegrationType()); } -static char UnaryFunction1DVec2f_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DVec2f_getIntegrationType(BPy_UnaryFunction1DVec2f* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_vec2f->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DVec2f *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vec2f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DVec2f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVec2f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVec2f_getName, METH_NOARGS, UnaryFunction1DVec2f_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_setIntegrationType, METH_VARARGS, UnaryFunction1DVec2f_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_getIntegrationType, METH_NOARGS, UnaryFunction1DVec2f_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DVec2f_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec2f type definition ------------------------------*/ @@ -198,7 +175,7 @@ PyTypeObject UnaryFunction1DVec2f_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DVec2f_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DVec2f_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 6d50a1ed437..fde04cc128c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -14,19 +14,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DVec3f_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DVec3f_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DVec3f_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DVec3f_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DVec3f_Type ); + Py_INCREF(&UnaryFunction1DVec3f_Type); PyModule_AddObject(module, "UnaryFunction1DVec3f", (PyObject *)&UnaryFunction1DVec3f_Type); - if( PyType_Ready( &Orientation3DF1D_Type ) < 0 ) + if (PyType_Ready(&Orientation3DF1D_Type) < 0) return -1; - Py_INCREF( &Orientation3DF1D_Type ); + Py_INCREF(&Orientation3DF1D_Type); PyModule_AddObject(module, "Orientation3DF1D", (PyObject *)&Orientation3DF1D_Type); return 0; @@ -44,25 +44,26 @@ static char UnaryFunction1DVec3f___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args) +static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_vec3f = new UnaryFunction1D(); else { - self->uf1D_vec3f = new UnaryFunction1D( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_vec3f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_vec3f->py_uf1D = (PyObject *)self; @@ -79,85 +80,61 @@ static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self) static PyObject * UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec3f->getName().c_str(), self->uf1D_vec3f ); -} - -static char UnaryFunction1DVec3f_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self ) -{ - return PyUnicode_FromString( self->uf1D_vec3f->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec3f->getName().c_str(), self->uf1D_vec3f); } -static PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D) ) { + + if (typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_vec3f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_vec3f->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_vec3f->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return Vector_from_Vec3f( self->uf1D_vec3f->result ); + return Vector_from_Vec3f(self->uf1D_vec3f->result); } -static char UnaryFunction1DVec3f_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DVec3f_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DVec3f get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DVec3f *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_vec3f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec3f->getIntegrationType()); } -static char UnaryFunction1DVec3f_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DVec3f_getIntegrationType(BPy_UnaryFunction1DVec3f* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_vec3f->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DVec3f *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vec3f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DVec3f instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVec3f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVec3f_getName, METH_NOARGS, UnaryFunction1DVec3f_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_setIntegrationType, METH_VARARGS, UnaryFunction1DVec3f_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_getIntegrationType, METH_NOARGS, UnaryFunction1DVec3f_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DVec3f_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec3f type definition ------------------------------*/ @@ -192,7 +169,7 @@ PyTypeObject UnaryFunction1DVec3f_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DVec3f_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DVec3f_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index 5555f401cbf..bf2c882d7cd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -16,29 +16,29 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DVectorViewShape_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DVectorViewShape_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DVectorViewShape_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DVectorViewShape_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DVectorViewShape_Type ); + Py_INCREF(&UnaryFunction1DVectorViewShape_Type); PyModule_AddObject(module, "UnaryFunction1DVectorViewShape", (PyObject *)&UnaryFunction1DVectorViewShape_Type); - if( PyType_Ready( &GetOccludeeF1D_Type ) < 0 ) + if (PyType_Ready(&GetOccludeeF1D_Type) < 0) return -1; - Py_INCREF( &GetOccludeeF1D_Type ); + Py_INCREF(&GetOccludeeF1D_Type); PyModule_AddObject(module, "GetOccludeeF1D", (PyObject *)&GetOccludeeF1D_Type); - if( PyType_Ready( &GetOccludersF1D_Type ) < 0 ) + if (PyType_Ready(&GetOccludersF1D_Type) < 0) return -1; - Py_INCREF( &GetOccludersF1D_Type ); + Py_INCREF(&GetOccludersF1D_Type); PyModule_AddObject(module, "GetOccludersF1D", (PyObject *)&GetOccludersF1D_Type); - if( PyType_Ready( &GetShapeF1D_Type ) < 0 ) + if (PyType_Ready(&GetShapeF1D_Type) < 0) return -1; - Py_INCREF( &GetShapeF1D_Type ); + Py_INCREF(&GetShapeF1D_Type); PyModule_AddObject(module, "GetShapeF1D", (PyObject *)&GetShapeF1D_Type); return 0; @@ -57,25 +57,26 @@ static char UnaryFunction1DVectorViewShape___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >(); else { - self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; @@ -92,47 +93,31 @@ static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVector static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vectorviewshape->getName().c_str(), self->uf1D_vectorviewshape ); -} - -static char UnaryFunction1DVectorViewShape_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self ) -{ - return PyUnicode_FromString( self->uf1D_vectorviewshape->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vectorviewshape->getName().c_str(), self->uf1D_vectorviewshape); } -static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D< std::vector >) ) { + + if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D< std::vector >)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_vectorviewshape->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_vectorviewshape->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_vectorviewshape->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } PyObject *list = PyList_New(0); PyObject *item; - for( unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) { + for(unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; if (v) { item = BPy_ViewShape_from_ViewShape(*v); @@ -146,43 +131,35 @@ static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVe return list; } -static char UnaryFunction1DVectorViewShape_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DVectorViewShape_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DVectorViewShape get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_vectorviewshape->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_vectorviewshape->getIntegrationType()); } -static char UnaryFunction1DVectorViewShape_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DVectorViewShape_getIntegrationType(BPy_UnaryFunction1DVectorViewShape* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_vectorviewshape->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DVectorViewShape *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vectorviewshape->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DVectorViewShape instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVectorViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVectorViewShape_getName, METH_NOARGS, UnaryFunction1DVectorViewShape_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_setIntegrationType, METH_VARARGS, UnaryFunction1DVectorViewShape_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_getIntegrationType, METH_NOARGS, UnaryFunction1DVectorViewShape_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DVectorViewShape_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ------------------------------*/ @@ -217,7 +194,7 @@ PyTypeObject UnaryFunction1DVectorViewShape_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DVectorViewShape_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DVectorViewShape_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index f18421d8754..b1dae992812 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -17,29 +17,29 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction1DVoid_Init( PyObject *module ) { - - if( module == NULL ) +int UnaryFunction1DVoid_Init(PyObject *module) +{ + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction1DVoid_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction1DVoid_Type) < 0) return -1; - Py_INCREF( &UnaryFunction1DVoid_Type ); + Py_INCREF(&UnaryFunction1DVoid_Type); PyModule_AddObject(module, "UnaryFunction1DVoid", (PyObject *)&UnaryFunction1DVoid_Type); - if( PyType_Ready( &ChainingTimeStampF1D_Type ) < 0 ) + if (PyType_Ready(&ChainingTimeStampF1D_Type) < 0) return -1; - Py_INCREF( &ChainingTimeStampF1D_Type ); + Py_INCREF(&ChainingTimeStampF1D_Type); PyModule_AddObject(module, "ChainingTimeStampF1D", (PyObject *)&ChainingTimeStampF1D_Type); - if( PyType_Ready( &IncrementChainingTimeStampF1D_Type ) < 0 ) + if (PyType_Ready(&IncrementChainingTimeStampF1D_Type) < 0) return -1; - Py_INCREF( &IncrementChainingTimeStampF1D_Type ); + Py_INCREF(&IncrementChainingTimeStampF1D_Type); PyModule_AddObject(module, "IncrementChainingTimeStampF1D", (PyObject *)&IncrementChainingTimeStampF1D_Type); - if( PyType_Ready( &TimeStampF1D_Type ) < 0 ) + if (PyType_Ready(&TimeStampF1D_Type) < 0) return -1; - Py_INCREF( &TimeStampF1D_Type ); + Py_INCREF(&TimeStampF1D_Type); PyModule_AddObject(module, "TimeStampF1D", (PyObject *)&TimeStampF1D_Type); return 0; @@ -57,25 +57,26 @@ static char UnaryFunction1DVoid___doc__[] = "\n" " Default constructor.\n" "\n" -".. method:: __init__(integration)\n" +".. method:: __init__(integration_type)\n" "\n" " Builds a unary 1D function using the integration method given as\n" " argument.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +" :arg integration_type: An integration method.\n" +" :type integration_type: :class:`IntegrationType`\n"; -static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) +static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - if( !obj ) + if (!obj) self->uf1D_void = new UnaryFunction1D_void(); else { - self->uf1D_void = new UnaryFunction1D_void( IntegrationType_from_BPy_IntegrationType(obj) ); + self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_void->py_uf1D = (PyObject *)self; @@ -92,84 +93,60 @@ static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self) static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_void->getName().c_str(), self->uf1D_void ); -} - -static char UnaryFunction1DVoid_getName___doc__[] = -".. method:: getName()\n" -"\n" -" Returns the name of the unary 1D function.\n" -"\n" -" :return: The name of the unary 1D function.\n" -" :rtype: str\n"; - -static PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self ) -{ - return PyUnicode_FromString( self->uf1D_void->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_void->getName().c_str(), self->uf1D_void); } -static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) { - PyObject *obj; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; - if( kwds != NULL ) { - PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); - return NULL; - } - if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; - - if( typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void) ) { + + if (typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf1D_void->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { + if (self->uf1D_void->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { if (!PyErr_Occurred()) { - string msg(self->uf1D_void->getName() + " __call__ method failed"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } Py_RETURN_NONE; } -static char UnaryFunction1DVoid_setIntegrationType___doc__[] = -".. method:: setIntegrationType(integration)\n" -"\n" -" Sets the integration method.\n" +static PyMethodDef BPy_UnaryFunction1DVoid_methods[] = { + {NULL, NULL, 0, NULL} +}; + +/*----------------------UnaryFunction1DVoid get/setters ----------------------------*/ + +PyDoc_STRVAR(integration_type_doc, +"The integration method.\n" "\n" -" :arg integration: An integration method.\n" -" :type integration: :class:`IntegrationType`\n"; +":type: :class:`IntegrationType`"); -static PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, PyObject *args) +static PyObject *integration_type_get(BPy_UnaryFunction1DVoid *self, void *UNUSED(closure)) { - PyObject *obj; - - if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) - return NULL; - - self->uf1D_void->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) ); - Py_RETURN_NONE; + return BPy_IntegrationType_from_IntegrationType(self->uf1D_void->getIntegrationType()); } -static char UnaryFunction1DVoid_getIntegrationType___doc__[] = -".. method:: getIntegrationType(integration)\n" -"\n" -" Returns the integration method.\n" -"\n" -" :return: The integration method.\n" -" :rtype: :class:`IntegrationType`\n"; - -static PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid* self) { - return BPy_IntegrationType_from_IntegrationType( self->uf1D_void->getIntegrationType() ); +static int integration_type_set(BPy_UnaryFunction1DVoid *self, PyObject *value, void *UNUSED(closure)) +{ + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_void->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } -/*----------------------UnaryFunction1DVoid instance definitions ----------------------------*/ -static PyMethodDef BPy_UnaryFunction1DVoid_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction1DVoid_getName, METH_NOARGS, UnaryFunction1DVoid_getName___doc__}, - {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_setIntegrationType, METH_VARARGS, UnaryFunction1DVoid_setIntegrationType___doc__}, - {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_getIntegrationType, METH_NOARGS, UnaryFunction1DVoid_getIntegrationType___doc__}, - {NULL, NULL, 0, NULL} +static PyGetSetDef BPy_UnaryFunction1DVoid_getseters[] = { + {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, (char *)integration_type_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVoid type definition ------------------------------*/ @@ -204,7 +181,7 @@ PyTypeObject UnaryFunction1DVoid_Type = { 0, /* tp_iternext */ BPy_UnaryFunction1DVoid_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + BPy_UnaryFunction1DVoid_getseters, /* tp_getset */ &UnaryFunction1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp index a31d96ad1a4..8bf4162c4ed 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char CurveNatureF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DEdgeNature` > :class:`CurveNatureF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a CurveNatureF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -37,14 +37,14 @@ static char CurveNatureF1D___doc__[] = " :return: The nature of the Interface1D.\n" " :rtype: :class:`Nature`\n"; -static int CurveNatureF1D___init__( BPy_CurveNatureF1D* self, PyObject *args) +static int CurveNatureF1D___init__(BPy_CurveNatureF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_edgenature.uf1D_edgenature = new Functions1D::CurveNatureF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp index 92ba5b05e75..b2605b67f44 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char Normal2DF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f` > :class:`Normal2DF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a Normal2DF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char Normal2DF1D___doc__[] = " :return: The 2D normal for the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int Normal2DF1D___init__( BPy_Normal2DF1D* self, PyObject *args) +static int Normal2DF1D___init__(BPy_Normal2DF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Normal2DF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp index a1b87b9cf17..925a407c298 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char Orientation2DF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f` > :class:`Orientation2DF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds an Orientation2DF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,20 +32,18 @@ static char Orientation2DF1D___doc__[] = " :return: The 2D orientation of the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int Orientation2DF1D___init__( BPy_Orientation2DF1D* self, PyObject *args) +static int Orientation2DF1D___init__(BPy_Orientation2DF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Orientation2DF1D(t); return 0; - } - /*-----------------------BPy_Orientation2DF1D type definition ------------------------------*/ PyTypeObject Orientation2DF1D_Type = { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp index a55c1f7a542..4101f08e8fc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char Orientation3DF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec3f` > :class:`Orientation3DF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds an Orientation3DF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char Orientation3DF1D___doc__[] = " :return: The 3D orientation of the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; -static int Orientation3DF1D___init__( BPy_Orientation3DF1D* self, PyObject *args) +static int Orientation3DF1D___init__(BPy_Orientation3DF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_vec3f.uf1D_vec3f = new Functions1D::Orientation3DF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp index aec76c2888c..d7b50b43035 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char Curvature2DAngleF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`Curvature2DAngleF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a Curvature2DAngleF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char Curvature2DAngleF1D___doc__[] = " :return: The 2D curvature as an angle.\n" " :rtype: float\n"; -static int Curvature2DAngleF1D___init__( BPy_Curvature2DAngleF1D* self, PyObject *args) +static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::Curvature2DAngleF1D(t); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp index 360f98fa361..785f4a006fe 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -15,20 +15,20 @@ extern "C" { static char DensityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`DensityF1D`\n" "\n" -".. method:: __init__(sigma=2.0, iType=IntegrationType.MEAN, sampling=2.0)\n" +".. method:: __init__(sigma=2.0, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" " Builds a DensityF1D object.\n" "\n" " :arg sigma: The sigma used in DensityF0D and determining the window size\n" " used in each density query.\n" " :type sigma: float\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by iType.\n" +" single one, following the method specified by integration_type.\n" " :type sampling: float\n" "\n" ".. method:: __call__(inter)\n" @@ -44,16 +44,16 @@ static char DensityF1D___doc__[] = " :return: The density evaluated for an Interface1D.\n" " :rtype: float\n"; -static int DensityF1D___init__( BPy_DensityF1D* self, PyObject *args) +static int DensityF1D___init__(BPy_DensityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"sigma", "integration_type", "sampling", NULL}; PyObject *obj = 0; double d = 2.0; float f = 2.0; - if( !PyArg_ParseTuple(args, "|dO!f", &d, &IntegrationType_Type, &obj, &f) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|dO!f", (char **)kwlist, &d, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::DensityF1D(d,t,f); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp index b30d26c8516..b1e02ecdb64 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -15,20 +15,20 @@ extern "C" { static char GetCompleteViewMapDensityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetCompleteViewMapDensityF1D`\n" "\n" -".. method:: __init__(level, iType=IntegrationType.MEAN, sampling=2.0)\n" +".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" " Builds a GetCompleteViewMapDensityF1D object.\n" "\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by iType.\n" +" single one, following the method specified by integration_type.\n" " :type sampling: float\n" "\n" ".. method:: __call__(inter)\n" @@ -45,19 +45,18 @@ static char GetCompleteViewMapDensityF1D___doc__[] = " viewmap image.\n" " :rtype: float\n"; -static int GetCompleteViewMapDensityF1D___init__( BPy_GetCompleteViewMapDensityF1D* self, PyObject *args) +static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; PyObject *obj = 0; - unsigned i; + int i; float f = 2.0; - if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetCompleteViewMapDensityF1D(i,t,f); return 0; - } /*-----------------------BPy_GetCompleteViewMapDensityF1D type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index 494297d3a3b..921920088c6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -15,23 +15,23 @@ extern "C" { static char GetDirectionalViewMapDensityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetDirectionalViewMapDensityF1D`\n" "\n" -".. method:: __init__(iOrientation, level, iType=IntegrationType.MEAN, sampling=2.0)\n" +".. method:: __init__(orientation, level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" " Builds a GetDirectionalViewMapDensityF1D object.\n" "\n" -" :arg iOrientation: The number of the directional map we must work\n" +" :arg orientation: The number of the directional map we must work\n" " with.\n" -" :type iOrientation: int\n" +" :type orientation: int\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by iType.\n" +" single one, following the method specified by integration_type.\n" " :type sampling: float\n" "\n" ".. method:: __call__(inter)\n" @@ -49,19 +49,18 @@ static char GetDirectionalViewMapDensityF1D___doc__[] = " steerable viewmaps image.\n" " :rtype: float\n"; -static int GetDirectionalViewMapDensityF1D___init__( BPy_GetDirectionalViewMapDensityF1D* self, PyObject *args) +static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDensityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", NULL}; PyObject *obj = 0; unsigned int u1, u2; float f = 2.0; - if( !PyArg_ParseTuple(args, "II|O!f", &u1, &u2, &IntegrationType_Type, &obj, &f) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "II|O!f", (char **)kwlist, &u1, &u2, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetDirectionalViewMapDensityF1D(u1, u2, t, f); return 0; - } /*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp index 7b1e7193b85..20792a48151 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetProjectedXF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedXF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetProjectedXF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetProjectedXF1D___doc__[] = " :return: The projected X 3D coordinate of an Interface1D.\n" " :rtype: float\n"; -static int GetProjectedXF1D___init__( BPy_GetProjectedXF1D* self, PyObject *args ) +static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedXF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp index df09b32b5b9..522fefdf31b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetProjectedYF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedYF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetProjectedYF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetProjectedYF1D___doc__[] = " :return: The projected Y 3D coordinate of an Interface1D.\n" " :rtype: float\n"; -static int GetProjectedYF1D___init__( BPy_GetProjectedYF1D* self, PyObject *args ) +static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedYF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp index acd03856b2c..2b224b078c0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetProjectedZF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedZF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetProjectedZF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetProjectedZF1D___doc__[] = " :return: The projected Z 3D coordinate of an Interface1D.\n" " :rtype: float\n"; -static int GetProjectedZF1D___init__( BPy_GetProjectedZF1D* self, PyObject *args ) +static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedZF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp index cc3813030ac..95946439d3a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -15,20 +15,20 @@ extern "C" { static char GetSteerableViewMapDensityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetSteerableViewMapDensityF1D`\n" "\n" -".. method:: __init__(level, iType=IntegrationType.MEAN, sampling=2.0)\n" +".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" " Builds a GetSteerableViewMapDensityF1D object.\n" "\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by iType.\n" +" single one, following the method specified by integration_type.\n" " :type sampling: float\n" "\n" ".. method:: __call__(inter)\n" @@ -42,19 +42,18 @@ static char GetSteerableViewMapDensityF1D___doc__[] = " :return: The density of the ViewMap for a given Interface1D.\n" " :rtype: float\n"; -static int GetSteerableViewMapDensityF1D___init__( BPy_GetSteerableViewMapDensityF1D* self, PyObject *args) +static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; PyObject *obj = 0; int i; float f = 2.0; - if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetSteerableViewMapDensityF1D(i,t,f); return 0; - } /*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp index c3e12fd7792..4ef3e03fe2a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -15,20 +15,20 @@ extern "C" { static char GetViewMapGradientNormF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetViewMapGradientNormF1D`\n" "\n" -".. method:: __init__()\n" +".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" " Builds a GetViewMapGradientNormF1D object.\n" "\n" " :arg level: The level of the pyramid from which the pixel must be\n" " read.\n" " :type level: int\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by iType.\n" +" single one, following the method specified by integration_type.\n" " :type sampling: float\n" "\n" ".. method:: __call__(inter)\n" @@ -42,19 +42,18 @@ static char GetViewMapGradientNormF1D___doc__[] = " :return: The density of the ViewMap for a given Interface1D.\n" " :rtype: float\n"; -static int GetViewMapGradientNormF1D___init__( BPy_GetViewMapGradientNormF1D* self, PyObject *args) +static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; PyObject *obj = 0; int i; float f = 2.0; - if( !PyArg_ParseTuple(args, "i|O!f", &i, &IntegrationType_Type, &obj, &f) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetViewMapGradientNormF1D(i,t,f); return 0; - } /*-----------------------BPy_GetViewMapGradientNormF1D type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp index a15c6f59a3b..4c785ed9689 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetXF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetXF1D`\n" "\n" -".. method:: __init__(iType)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetXF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetXF1D___doc__[] = " :return: The X 3D coordinate of the Interface1D.\n" " :rtype: float\n"; -static int GetXF1D___init__( BPy_GetXF1D* self, PyObject *args ) +static int GetXF1D___init__(BPy_GetXF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetXF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp index b8ee3d8be27..1f858c1d49c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetYF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetYF1D`\n" "\n" -".. method:: __init__(iType)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetYF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetYF1D___doc__[] = " :return: The Y 3D coordinate of the Interface1D.\n" " :rtype: float\n"; -static int GetYF1D___init__( BPy_GetYF1D* self, PyObject *args ) +static int GetYF1D___init__(BPy_GetYF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetYF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp index af275c906c4..4866ced23d8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char GetZF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetZF1D`\n" "\n" -".. method:: __init__(iType)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a GetZF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -32,14 +32,14 @@ static char GetZF1D___doc__[] = " :return: The Z 3D coordinate of the Interface1D.\n" " :rtype: float\n"; -static int GetZF1D___init__( BPy_GetZF1D* self, PyObject *args ) +static int GetZF1D___init__(BPy_GetZF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::GetZF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp index a3b15e6b5f7..7af96a2e0a8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -15,16 +15,16 @@ extern "C" { static char LocalAverageDepthF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`LocalAverageDepthF1D`\n" "\n" -".. method:: __init__(sigma, iType=IntegrationType.MEAN)\n" +".. method:: __init__(sigma, integration_type=IntegrationType.MEAN)\n" "\n" " Builds a LocalAverageDepthF1D object.\n" "\n" " :arg sigma: The sigma used in DensityF0D and determining the window\n" " size used in each density query.\n" " :type sigma: float\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -39,18 +39,19 @@ static char LocalAverageDepthF1D___doc__[] = " :return: The average depth evaluated for the Interface1D.\n" " :rtype: float\n"; -static int LocalAverageDepthF1D___init__( BPy_LocalAverageDepthF1D* self, PyObject *args) +static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"sigma", "integration_type", NULL}; PyObject *obj = 0; double d; - if( !PyArg_ParseTuple(args, "d|O!", &d, &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|O!", (char **)kwlist, &d, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::LocalAverageDepthF1D(d,t); return 0; } + /*-----------------------BPy_LocalAverageDepthF1D type definition ------------------------------*/ PyTypeObject LocalAverageDepthF1D_Type = { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp index 32a5106b380..c7bbdefccdc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char ZDiscontinuityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`ZDiscontinuityF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a ZDiscontinuityF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -36,14 +36,14 @@ static char ZDiscontinuityF1D___doc__[] = " :return: The normalized distance between the Interface1D and the occludee.\n" " :rtype: float\n"; -static int ZDiscontinuityF1D___init__( BPy_ZDiscontinuityF1D* self, PyObject *args ) +static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_double.uf1D_double = new Functions1D::ZDiscontinuityF1D(t); return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp index a7379c4f769..a2402135455 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp @@ -15,13 +15,13 @@ extern "C" { static char QuantitativeInvisibilityF1D___doc__[] = "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DUnsigned` > :class:`QuantitativeInvisibilityF1D`\n" "\n" -".. method:: __init__(iType=IntegrationType.MEAN)\n" +".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" " Builds a QuantitativeInvisibilityF1D object.\n" "\n" -" :arg iType: The integration method used to compute a single value\n" +" :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type iType: :class:`IntegrationType`\n" +" :type integration_type: :class:`IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -36,17 +36,16 @@ static char QuantitativeInvisibilityF1D___doc__[] = " :return: The Quantitative Invisibility of the Interface1D.\n" " :rtype: int\n"; -static int QuantitativeInvisibilityF1D___init__( BPy_QuantitativeInvisibilityF1D* self, PyObject *args) +static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D* self, PyObject *args, PyObject *kwds) { + static const char *kwlist[] = {"integration_type", NULL}; PyObject *obj = 0; - if( !PyArg_ParseTuple(args, "|O!", &IntegrationType_Type, &obj) ) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - - IntegrationType t = ( obj ) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; + IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN; self->py_uf1D_unsigned.uf1D_unsigned = new Functions1D::QuantitativeInvisibilityF1D(t); return 0; - } /*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp index 4bd03f8fe75..d6a50d8ad87 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -28,9 +28,11 @@ static char GetOccludeeF1D___doc__[] = " :return: A list of occluded shapes covered by the Interface1D.\n" " :rtype: list of :class:`ViewShape` objects\n"; -static int GetOccludeeF1D___init__( BPy_GetOccludeeF1D* self, PyObject *args ) +static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludeeF1D(); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp index d37102a8447..1d67ee2f916 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -28,9 +28,11 @@ static char GetOccludersF1D___doc__[] = " :return: A list of occluding shapes that cover the Interface1D.\n" " :rtype: list of :class:`ViewShape` objects\n"; -static int GetOccludersF1D___init__( BPy_GetOccludersF1D* self, PyObject *args ) +static int GetOccludersF1D___init__(BPy_GetOccludersF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludersF1D(); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp index 9b2007296f9..1ba19502de6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -28,9 +28,11 @@ static char GetShapeF1D___doc__[] = " :return: A list of shapes covered by the Interface1D.\n" " :rtype: list of :class:`ViewShape` objects\n"; -static int GetShapeF1D___init__( BPy_GetShapeF1D* self, PyObject *args ) +static int GetShapeF1D___init__(BPy_GetShapeF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetShapeF1D(); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp index be774a09d99..9b2d71a8c80 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -26,9 +26,11 @@ static char ChainingTimeStampF1D___doc__[] = " :arg inter: An Interface1D object.\n" " :type inter: :class:`Interface1D`\n"; -static int ChainingTimeStampF1D___init__( BPy_ChainingTimeStampF1D* self, PyObject *args ) +static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_void.uf1D_void = new Functions1D::ChainingTimeStampF1D(); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp index 2d1a1344c4b..a034e0ace48 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -26,9 +26,11 @@ static char IncrementChainingTimeStampF1D___doc__[] = " :arg inter: An Interface1D object.\n" " :type inter: :class:`Interface1D`\n"; -static int IncrementChainingTimeStampF1D___init__( BPy_IncrementChainingTimeStampF1D* self, PyObject *args ) +static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStampF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_void.uf1D_void = new Functions1D::IncrementChainingTimeStampF1D(); return 0; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp index c5311501098..a680dd01f11 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -26,9 +26,11 @@ static char TimeStampF1D___doc__[] = " :arg inter: An Interface1D object.\n" " :type inter: :class:`Interface1D`\n"; -static int TimeStampF1D___init__( BPy_TimeStampF1D* self, PyObject *args ) +static int TimeStampF1D___init__(BPy_TimeStampF1D* self, PyObject *args, PyObject *kwds) { - if( !PyArg_ParseTuple(args, "") ) + static const char *kwlist[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) return -1; self->py_uf1D_void.uf1D_void = new Functions1D::TimeStampF1D(); return 0; -- cgit v1.2.3