diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-22 06:48:41 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-22 06:48:41 +0400 |
commit | a4a7341aef2e772b7a233ade5dbccfbb959fd8e4 (patch) | |
tree | 0011931ebb83858aeb53b15f1b3ddc69bd4f71dd /source/blender/freestyle/intern/python | |
parent | 33f34e1a7bc08f123d76198ae0671e3da1ded401 (diff) |
Missing code updates in the previous commit.
Also improved __repr__() so that the .getName() is no longer necessary in user-defined
Function0D and Function1D subclasses.
Diffstat (limited to 'source/blender/freestyle/intern/python')
18 files changed, 93 insertions, 162 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index 34c57e0bbd0..441b7be3664 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -119,7 +119,7 @@ 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", Py_TYPE(self)->tp_name, self->uf0D_double); } static PyObject * UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 7522b05e3e4..be33fcd9932 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -63,7 +63,7 @@ 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", Py_TYPE(self)->tp_name, self->uf0D_edgenature); } static PyObject * UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) @@ -73,7 +73,7 @@ static PyObject * UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNatu if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - + if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D<Nature::EdgeNature>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index f2707bf3ae8..d4858fcf250 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -93,7 +93,7 @@ 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", Py_TYPE(self)->tp_name, self->uf0D_float); } static PyObject * UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) @@ -103,7 +103,7 @@ static PyObject * UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - + if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D<float>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index a7a67710869..6c2261afe8b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -63,7 +63,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_id); } static PyObject * UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) @@ -73,7 +73,7 @@ static PyObject * UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObje if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - + if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D<Id>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 5206a61a820..8a612658d13 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -64,7 +64,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_material); } static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) @@ -74,7 +74,7 @@ static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial * if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - + if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D<FrsMaterial>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; @@ -87,7 +87,6 @@ static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial * return NULL; } return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result); - } static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 5d9a2f4517c..318e6007087 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -63,7 +63,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_unsigned); } static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) @@ -73,7 +73,7 @@ static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned * if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) return NULL; - + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; @@ -86,7 +86,6 @@ static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned * return NULL; } return PyLong_FromLong(self->uf0D_unsigned->result); - } static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index d8518844d00..86df60a24b2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -14,24 +14,24 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DVec2f_Init( PyObject *module ) { +int UnaryFunction0DVec2f_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DVec2f_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DVec2f_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DVec2f_Type ); + Py_INCREF(&UnaryFunction0DVec2f_Type); PyModule_AddObject(module, "UnaryFunction0DVec2f", (PyObject *)&UnaryFunction0DVec2f_Type); - if( PyType_Ready( &Normal2DF0D_Type ) < 0 ) + if (PyType_Ready(&Normal2DF0D_Type) < 0) return -1; - Py_INCREF( &Normal2DF0D_Type ); + Py_INCREF(&Normal2DF0D_Type); PyModule_AddObject(module, "Normal2DF0D", (PyObject *)&Normal2DF0D_Type); - if( PyType_Ready( &VertexOrientation2DF0D_Type ) < 0 ) + if (PyType_Ready(&VertexOrientation2DF0D_Type) < 0) return -1; - Py_INCREF( &VertexOrientation2DF0D_Type ); + Py_INCREF(&VertexOrientation2DF0D_Type); PyModule_AddObject(module, "VertexOrientation2DF0D", (PyObject *)&VertexOrientation2DF0D_Type); return 0; @@ -51,8 +51,10 @@ static char UnaryFunction0DVec2f___doc__[] = static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* 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_vec2f = new UnaryFunction0D<Vec2f>(); self->uf0D_vec2f->py_uf0D = (PyObject *)self; return 0; @@ -67,51 +69,32 @@ static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self) static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec2f->getName().c_str(), self->uf0D_vec2f ); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec2f); } -static char UnaryFunction0DVec2f_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 * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self ) -{ - return PyUnicode_FromString( self->uf0D_vec2f->getName().c_str() ); -} - -static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *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_vec2f)) == typeid(UnaryFunction0D<Vec2f>) ) { + + if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D<Vec2f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_vec2f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_vec2f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { 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->uf0D_vec2f->result ); - + return Vector_from_Vec2f(self->uf0D_vec2f->result); } -/*----------------------UnaryFunction0DVec2f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVec2f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVec2f_getName, METH_NOARGS, UnaryFunction0DVec2f_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 2f3c5d0f7e9..3474860a067 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DVec3f_Init( PyObject *module ) { +int UnaryFunction0DVec3f_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DVec3f_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DVec3f_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DVec3f_Type ); + Py_INCREF(&UnaryFunction0DVec3f_Type); PyModule_AddObject(module, "UnaryFunction0DVec3f", (PyObject *)&UnaryFunction0DVec3f_Type); - if( PyType_Ready( &VertexOrientation3DF0D_Type ) < 0 ) + if (PyType_Ready(&VertexOrientation3DF0D_Type) < 0) return -1; - Py_INCREF( &VertexOrientation3DF0D_Type ); + Py_INCREF(&VertexOrientation3DF0D_Type); PyModule_AddObject(module, "VertexOrientation3DF0D", (PyObject *)&VertexOrientation3DF0D_Type); return 0; @@ -45,8 +45,10 @@ static char UnaryFunction0DVec3f___doc__[] = static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* 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_vec3f = new UnaryFunction0D<Vec3f>(); self->uf0D_vec3f->py_uf0D = (PyObject *)self; return 0; @@ -61,51 +63,32 @@ static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self) static PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec3f->getName().c_str(), self->uf0D_vec3f ); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec3f); } -static char UnaryFunction0DVec3f_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 * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self ) -{ - return PyUnicode_FromString( self->uf0D_vec3f->getName().c_str() ); -} - -static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *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_vec3f)) == typeid(UnaryFunction0D<Vec3f>) ) { + + if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D<Vec3f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_vec3f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_vec3f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { 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->uf0D_vec3f->result ); - + return Vector_from_Vec3f(self->uf0D_vec3f->result); } -/*----------------------UnaryFunction0DVec3f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVec3f_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVec3f_getName, METH_NOARGS, UnaryFunction0DVec3f_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 688c9851d30..01c884f8de2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -13,19 +13,19 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DVectorViewShape_Init( PyObject *module ) { +int UnaryFunction0DVectorViewShape_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DVectorViewShape_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DVectorViewShape_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DVectorViewShape_Type ); + Py_INCREF(&UnaryFunction0DVectorViewShape_Type); PyModule_AddObject(module, "UnaryFunction0DVectorViewShape", (PyObject *)&UnaryFunction0DVectorViewShape_Type); - if( PyType_Ready( &GetOccludersF0D_Type ) < 0 ) + if (PyType_Ready(&GetOccludersF0D_Type) < 0) return -1; - Py_INCREF( &GetOccludersF0D_Type ); + Py_INCREF(&GetOccludersF0D_Type); PyModule_AddObject(module, "GetOccludersF0D", (PyObject *)&GetOccludersF0D_Type); return 0; @@ -46,8 +46,10 @@ static char UnaryFunction0DVectorViewShape___doc__[] = static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* 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_vectorviewshape = new UnaryFunction0D< std::vector<ViewShape*> >(); self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self; return 0; @@ -62,38 +64,22 @@ static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVector static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vectorviewshape->getName().c_str(), self->uf0D_vectorviewshape ); -} - -static char UnaryFunction0DVectorViewShape_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 * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self ) -{ - return PyUnicode_FromString( self->uf0D_vectorviewshape->getName().c_str() ); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vectorviewshape); } -static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVectorViewShape *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_vectorviewshape)) == typeid(UnaryFunction0D< std::vector<ViewShape*> >) ) { + if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D< std::vector<ViewShape*> >)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_vectorviewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_vectorviewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); @@ -102,7 +88,7 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe } PyObject *list = PyList_New(0); PyObject *item; - for( unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) { + for(unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) { ViewShape *v = self->uf0D_vectorviewshape->result[i]; if (v) { item = BPy_ViewShape_from_ViewShape(*v); @@ -116,9 +102,7 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe return list; } -/*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, UnaryFunction0DVectorViewShape_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 1fbe23a1d6d..96bb4c65701 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -14,24 +14,24 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- -int UnaryFunction0DViewShape_Init( PyObject *module ) { +int UnaryFunction0DViewShape_Init(PyObject *module) { - if( module == NULL ) + if (module == NULL) return -1; - if( PyType_Ready( &UnaryFunction0DViewShape_Type ) < 0 ) + if (PyType_Ready(&UnaryFunction0DViewShape_Type) < 0) return -1; - Py_INCREF( &UnaryFunction0DViewShape_Type ); + Py_INCREF(&UnaryFunction0DViewShape_Type); PyModule_AddObject(module, "UnaryFunction0DViewShape", (PyObject *)&UnaryFunction0DViewShape_Type); - if( PyType_Ready( &GetOccludeeF0D_Type ) < 0 ) + if (PyType_Ready(&GetOccludeeF0D_Type) < 0) return -1; - Py_INCREF( &GetOccludeeF0D_Type ); + Py_INCREF(&GetOccludeeF0D_Type); PyModule_AddObject(module, "GetOccludeeF0D", (PyObject *)&GetOccludeeF0D_Type); - if( PyType_Ready( &GetShapeF0D_Type ) < 0 ) + if (PyType_Ready(&GetShapeF0D_Type) < 0) return -1; - Py_INCREF( &GetShapeF0D_Type ); + Py_INCREF(&GetShapeF0D_Type); PyModule_AddObject(module, "GetShapeF0D", (PyObject *)&GetShapeF0D_Type); return 0; @@ -51,8 +51,10 @@ static char UnaryFunction0DViewShape___doc__[] = static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* 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_viewshape = new UnaryFunction0D<ViewShape*>(); self->uf0D_viewshape->py_uf0D = (PyObject *)self; return 0; @@ -67,51 +69,32 @@ static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* s static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_viewshape->getName().c_str(), self->uf0D_viewshape ); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_viewshape); } -static char UnaryFunction0DViewShape_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 * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self ) -{ - return PyUnicode_FromString( self->uf0D_viewshape->getName().c_str() ); -} - -static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) +static PyObject * UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape *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_viewshape)) == typeid(UnaryFunction0D<ViewShape*>) ) { + if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape*>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } - if (self->uf0D_viewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (self->uf0D_viewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } - return BPy_ViewShape_from_ViewShape( *(self->uf0D_viewshape->result) ); - + return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result)); } -/*----------------------UnaryFunction0DViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DViewShape_methods[] = { - {"getName", ( PyCFunction ) UnaryFunction0DViewShape_getName, METH_NOARGS, UnaryFunction0DViewShape_getName___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 180f39c5e59..583cfd8a092 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -159,7 +159,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_double); } static PyObject * UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 5a7c7aebe18..9b9fd384395 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -80,7 +80,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_edgenature); } static PyObject * UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 1898212337a..3cbb45da28c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -73,7 +73,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_float); } static PyObject * UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index fc6c792b4b1..8cce3cb8bbb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -80,7 +80,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_unsigned); } static PyObject * UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index d67c960db8e..d6d9439b444 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -86,7 +86,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec2f); } static PyObject * UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index fde04cc128c..3fa1a24f004 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -80,7 +80,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec3f); } static PyObject * UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index bf2c882d7cd..2f4d23435b8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -93,7 +93,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vectorviewshape); } static PyObject * UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index b1dae992812..e6f794d1e43 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -93,7 +93,7 @@ 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); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_void); } static PyObject * UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) |