Missing code updates in the previous commit.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Fri, 22 Feb 2013 02:48:41 +0000 (02:48 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Fri, 22 Feb 2013 02:48:41 +0000 (02:48 +0000)
Also improved __repr__() so that the .getName() is no longer necessary in user-defined
Function0D and Function1D subclasses.

18 files changed:
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp

index 34c57e0bbd09c052e19e23c27afac74d58d4576b..441b7be3664fd8fe218677dbb36bf5be93de1cd8 100644 (file)
@@ -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)
index 7522b05e3e45f78546cef4f89c65a95a53591fb1..be33fcd9932bae2eaa8aedf41516220c8fe1105b 100644 (file)
@@ -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;
index f2707bf3ae80213f9e7b511d405af03916f1e851..d4858fcf250dddf741e942945ea126d1189d53c9 100644 (file)
@@ -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;
index a7a67710869e8f11847e2ca82ab32c766ff2fcbc..6c2261afe8b7bc2aa06d85bb63ad6d30f73d782a 100644 (file)
@@ -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;
index 5206a61a82097d450fb76af52cd1be85cf23d0bf..8a612658d1334407e12eb33b5f8d5e2ad19c2c6e 100644 (file)
@@ -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[] = {
index 5d9a2f4517c37d9193af3ae52d9c0cd995531f4d..318e6007087e5f91292427590610b367b1ca8a81 100644 (file)
@@ -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[] = {
index d8518844d0082541e29ea1bed54b4c85110690ca..86df60a24b2beda51957ece6d1132af1afa6d93e 100644 (file)
@@ -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}
 };
 
index 2f3c5d0f7e94e0b9b7f99add5dedadf559372ddc..3474860a0676712b23ed8a10992af027965be189 100644 (file)
@@ -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}
 };
 
index 688c9851d30fc912c9efd8d6f64e5b60be28ce83..01c884f8de22e79cf75c2af487d9a318c9c4606e 100644 (file)
@@ -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}
 };
 
index 1fbe23a1d6debd0b91ff30a3d1fb156a3bdb9c05..96bb4c6570108d0069c672b6d794db73e938e964 100644 (file)
@@ -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}
 };
 
index 180f39c5e59a9a734fc5bc1465ddfbaaad2b9e6d..583cfd8a0921cc52035a5926deeb60f9e3c738c6 100644 (file)
@@ -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)
index 5a7c7aebe18b62345c2baa52542a43dd9a06317c..9b9fd384395d1d90888d35c761622458da297b6d 100644 (file)
@@ -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)
index 1898212337adcb13e709f7402d015b8f4f7f90ba..3cbb45da28c06b31375132051852474fb7c450be 100644 (file)
@@ -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)
index fc6c792b4b16978c87023ac54084d75349b0eec1..8cce3cb8bbba5b7fbc853bc12176b527ba41b1e4 100644 (file)
@@ -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)
index d67c960db8ed4952ad453ae38a098ba7c9096763..d6d9439b444089e7e082b74acc2c4ba84417cc63 100644 (file)
@@ -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)
index fde04cc128ca1143fee48adbfc1b338209224726..3fa1a24f0044ba81eeae6e61333fba326ccaf0b8 100644 (file)
@@ -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)
index bf2c882d7cd024bc4582c896759fc585c00525f9..2f4d23435b80fcdc380046dd256c6c77873031a5 100644 (file)
@@ -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)
index b1dae9928121ed70a8f714ff0e30c2f67262be64..e6f794d1e437214c28ebbcedc9a3600b30ff7bde 100644 (file)
@@ -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)