diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-26 20:15:28 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-07-26 20:15:28 +0400 |
commit | 730fb1021c8b189229625866dac0f6e83db6418c (patch) | |
tree | 7985373b62cea17b3247a4e80842fbd372181058 /source | |
parent | 78ce17fce88c23ba2c32b561bd9cc398a60a8278 (diff) |
Made predicate and function types callable in the sense that
callable(I, T) returns True when I is an object of a type T or
of a subtype of T. Also implemented a measure to avoid an
infinite loop when user-defined predicate and function classes
do not properly overload the __call__ method (including the
cases of directly instantiating the base classes such as
UnaryPredicate0D and BinaryPredicate1D).
Diffstat (limited to 'source')
22 files changed, 243 insertions, 88 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index e9892825d50..71504903f81 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -15,12 +15,11 @@ static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D *self); static PyObject * BinaryPredicate0D___repr__(BPy_BinaryPredicate0D *self); static PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *args); -static PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args); +static PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds); /*----------------------BinaryPredicate0D instance definitions ----------------------------*/ static PyMethodDef BPy_BinaryPredicate0D_methods[] = { {"getName", ( PyCFunction ) BinaryPredicate0D_getName, METH_NOARGS, "( )Returns the string of the name of the binary predicate."}, - {"__call__", ( PyCFunction ) BinaryPredicate0D___call__, METH_VARARGS, "BinaryPredicate0D(Interface0D, Interface0D ). Must be overloaded by inherited classes. It evaluates a relation between two Interface0D." }, {NULL, NULL, 0, NULL} }; @@ -50,7 +49,7 @@ PyTypeObject BinaryPredicate0D_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)BinaryPredicate0D___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -150,13 +149,21 @@ PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *arg return PyString_FromString( self->bp0D->getName().c_str() ); } -PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args) +PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { BPy_Interface0D *obj1, *obj2; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!O!", &Interface0D_Type, &obj1, &Interface0D_Type, &obj2) ) return NULL; + if( typeid(*(self->bp0D)) == typeid(BinaryPredicate0D) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) ) < 0) { if (!PyErr_Occurred()) { string msg(self->bp0D->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index fd32430b362..1f601d60412 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -21,12 +21,11 @@ static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D *self); static PyObject * BinaryPredicate1D___repr__(BPy_BinaryPredicate1D *self); static PyObject * BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args); -static PyObject * BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args); +static PyObject * BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds); /*----------------------BinaryPredicate1D instance definitions ----------------------------*/ static PyMethodDef BPy_BinaryPredicate1D_methods[] = { {"getName", ( PyCFunction ) BinaryPredicate1D_getName, METH_NOARGS, "( )Returns the string of the name of the binary predicate."}, - {"__call__", ( PyCFunction ) BinaryPredicate1D___call__, METH_VARARGS, "BinaryPredicate1D(Interface1D, Interface1D ). Must be overloaded by inherited classes. It evaluates a relation between two Interface1D." }, {NULL, NULL, 0, NULL} }; @@ -55,7 +54,7 @@ PyTypeObject BinaryPredicate1D_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)BinaryPredicate1D___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -179,13 +178,21 @@ PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args return PyString_FromString( self->bp1D->getName().c_str() ); } -PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args) +PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { BPy_Interface1D *obj1, *obj2; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!O!", &Interface1D_Type, &obj1, &Interface1D_Type, &obj2) ) return NULL; + if( typeid(*(self->bp1D)) == typeid(BinaryPredicate1D) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) ) < 0) { if (!PyErr_Occurred()) { string msg(self->bp1D->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index 19d4a8abdbf..5f3312a1801 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -17,12 +17,11 @@ static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D *self); static PyObject * UnaryPredicate0D___repr__(BPy_UnaryPredicate0D *self); static PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self ); -static PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args); +static PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds); /*----------------------UnaryPredicate0D instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryPredicate0D_methods[] = { {"getName", ( PyCFunction ) UnaryPredicate0D_getName, METH_NOARGS, "Returns the string of the name of the UnaryPredicate0D."}, - {"__call__", ( PyCFunction ) UnaryPredicate0D___call__, METH_VARARGS, "The () operator. Must be overload by inherited classes." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryPredicate0D_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryPredicate0D___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -161,10 +160,14 @@ PyObject * UnaryPredicate0D_getName( BPy_UnaryPredicate0D *self ) return PyString_FromString( self->up0D->getName().c_str() ); } -PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args) +PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { PyObject *py_if0D_it; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &py_if0D_it) ) return NULL; @@ -175,6 +178,10 @@ PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args PyErr_SetString(PyExc_RuntimeError, msg.c_str()); return NULL; } + if( typeid(*(self->up0D)) == typeid(UnaryPredicate0D) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->up0D->operator()(*if0D_it) < 0) { if (!PyErr_Occurred()) { string msg(self->up0D->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 8712b374209..7bf4cfbbc6d 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -25,12 +25,11 @@ static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D *self); static PyObject * UnaryPredicate1D___repr__(BPy_UnaryPredicate1D *self); static PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args); -static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args); +static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds); /*----------------------UnaryPredicate1D instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryPredicate1D_methods[] = { {"getName", ( PyCFunction ) UnaryPredicate1D_getName, METH_NOARGS, ""}, - {"__call__", ( PyCFunction ) UnaryPredicate1D___call__, METH_VARARGS, "" }, {NULL, NULL, 0, NULL} }; @@ -60,7 +59,7 @@ PyTypeObject UnaryPredicate1D_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryPredicate1D___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -203,10 +202,14 @@ PyObject * UnaryPredicate1D_getName( BPy_UnaryPredicate1D *self, PyObject *args) return PyString_FromString( self->up1D->getName().c_str() ); } -PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args) +static PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { PyObject *py_if1D; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &py_if1D) ) return NULL; @@ -217,6 +220,10 @@ PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args PyErr_SetString(PyExc_RuntimeError, msg.c_str()); return NULL; } + if( typeid(*(self->up1D)) == typeid(UnaryPredicate1D) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if( self->up1D->operator()(*if1D) < 0 ) { if (!PyErr_Occurred()) { string msg(self->up1D->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index 822ad6c22bd..cfc4bb24a56 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -28,12 +28,11 @@ static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self); static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self); static PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self); -static PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args); +static PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DDouble instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DDouble_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DDouble_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DDouble___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -63,7 +62,7 @@ PyTypeObject UnaryFunction0DDouble_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DDouble___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -213,13 +212,21 @@ PyObject * UnaryFunction0DDouble_getName( BPy_UnaryFunction0DDouble *self ) return PyString_FromString( self->uf0D_double->getName().c_str() ); } -PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args) +PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D<double>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_double->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 6e3ff1fde4b..ac5b1257167 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self); static PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *self); -static PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args); +static PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DEdgeNature instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DEdgeNature_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DEdgeNature_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DEdgeNature___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DEdgeNature_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DEdgeNature_getName( BPy_UnaryFunction0DEdgeNature *sel return PyString_FromString( self->uf0D_edgenature->getName().c_str() ); } -PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args) +PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D<Nature::EdgeNature>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_edgenature->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index d48ae5205f8..13285bdcf88 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -22,12 +22,11 @@ static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self); static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self); static PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self); -static PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args); +static PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DFloat instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DFloat_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DFloat_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DFloat___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -57,7 +56,7 @@ PyTypeObject UnaryFunction0DFloat_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DFloat___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -185,13 +184,21 @@ PyObject * UnaryFunction0DFloat_getName( BPy_UnaryFunction0DFloat *self ) return PyString_FromString( self->uf0D_float->getName().c_str() ); } -PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args) +PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D<float>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_float->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_float->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index cb988655825..15863eb3600 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self); static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self); static PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self); -static PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args); +static PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DId instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DId_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DId_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DId___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DId_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DId___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DId_getName( BPy_UnaryFunction0DId *self ) return PyString_FromString( self->uf0D_id->getName().c_str() ); } -PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args) +PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D<Id>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_id->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_id->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 10f3e493244..bbb7e2d61a2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* sel static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self); static PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self); -static PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args); +static PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DMaterial instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DMaterial_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DMaterial___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DMaterial_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DMaterial___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DMaterial_getName( BPy_UnaryFunction0DMaterial *self ) return PyString_FromString( self->uf0D_material->getName().c_str() ); } -PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args) +PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D<FrsMaterial>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_material->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_material->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 754a432a336..1b8535318af 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* sel static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self); static PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self); -static PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args); +static PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DUnsigned instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DUnsigned_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DUnsigned___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DUnsigned_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DUnsigned___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DUnsigned_getName( BPy_UnaryFunction0DUnsigned *self ) return PyString_FromString( self->uf0D_unsigned->getName().c_str() ); } -PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args) +PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_unsigned->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_unsigned->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index 9a1c0ba1fd3..a2bda09180a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -18,12 +18,11 @@ static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self); static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self); static PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self); -static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args); +static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DVec2f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVec2f_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DVec2f_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DVec2f___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -53,7 +52,7 @@ PyTypeObject UnaryFunction0DVec2f_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DVec2f___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -162,12 +161,21 @@ PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self ) return PyString_FromString( self->uf0D_vec2f->getName().c_str() ); } -PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args) +PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) { PyObject *obj; + + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D<Vec2f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_vec2f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_vec2f->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 86360293c78..b484d872627 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self); static PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self); static PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self); -static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args); +static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DVec3f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVec3f_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DVec3f_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DVec3f___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DVec3f_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DVec3f___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self ) return PyString_FromString( self->uf0D_vec3f->getName().c_str() ); } -PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args) +PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D<Vec3f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_vec3f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_vec3f->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 8a38db08e95..9640bf23e43 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -17,12 +17,11 @@ static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVector static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self); static PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self); -static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args); +static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DVectorViewShape___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -52,7 +51,7 @@ PyTypeObject UnaryFunction0DVectorViewShape_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -156,13 +155,21 @@ PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorView return PyString_FromString( self->uf0D_vectorviewshape->getName().c_str() ); } -PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args) +PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D<std::vector<ViewShape*>>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_vectorviewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_vectorviewshape->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index abcbdbaebab..d8be0411c9e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -18,12 +18,11 @@ static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* s static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self); static PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self); -static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args); +static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds); /*----------------------UnaryFunction0DViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction0DViewShape_methods[] = { {"getName", ( PyCFunction ) UnaryFunction0DViewShape_getName, METH_NOARGS, "( )Returns the string of the name of the unary 0D function."}, - {"__call__", ( PyCFunction ) UnaryFunction0DViewShape___call__, METH_VARARGS, "(Interface0DIterator it )Executes the operator () on the iterator it pointing onto the point at which we wish to evaluate the function." }, {NULL, NULL, 0, NULL} }; @@ -53,7 +52,7 @@ PyTypeObject UnaryFunction0DViewShape_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction0DViewShape___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -162,13 +161,21 @@ PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self return PyString_FromString( self->uf0D_viewshape->getName().c_str() ); } -PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args) +PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; + if( typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape*>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf0D_viewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf0D_viewshape->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 1dd24b1fbb7..89d79e0b83f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -32,14 +32,13 @@ static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self); static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self); static PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self); -static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args); +static PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* self, PyObject *args); static PyObject * UnaryFunction1DDouble_getIntegrationType(BPy_UnaryFunction1DDouble* self); /*----------------------UnaryFunction1DDouble instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DDouble_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DDouble_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DDouble___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DDouble_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -71,7 +70,7 @@ PyTypeObject UnaryFunction1DDouble_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DDouble___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -253,13 +252,21 @@ PyObject * UnaryFunction1DDouble_getName( BPy_UnaryFunction1DDouble *self ) return PyString_FromString( self->uf1D_double->getName().c_str() ); } -PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args) +PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D<double>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_double->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_double->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index bf1b423715b..7723be839a4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -18,14 +18,13 @@ static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self); static PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *self); -static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args); +static PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeNature* self, PyObject *args); static PyObject * UnaryFunction1DEdgeNature_getIntegrationType(BPy_UnaryFunction1DEdgeNature* self); /*----------------------UnaryFunction1DEdgeNature instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DEdgeNature_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DEdgeNature_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DEdgeNature___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DEdgeNature_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -57,7 +56,7 @@ PyTypeObject UnaryFunction1DEdgeNature_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -173,13 +172,21 @@ PyObject * UnaryFunction1DEdgeNature_getName( BPy_UnaryFunction1DEdgeNature *sel return PyString_FromString( self->uf1D_edgenature->getName().c_str() ); } -PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args) +PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D<Nature::EdgeNature>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_edgenature->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_edgenature->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index f71a0c8af35..2a8d8f9ec75 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -16,14 +16,13 @@ static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self); static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self); static PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self); -static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args); +static PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* self, PyObject *args); static PyObject * UnaryFunction1DFloat_getIntegrationType(BPy_UnaryFunction1DFloat* self); /*----------------------UnaryFunction1DFloat instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DFloat_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DFloat_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DFloat___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DFloat_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -55,7 +54,7 @@ PyTypeObject UnaryFunction1DFloat_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DFloat___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -166,13 +165,21 @@ PyObject * UnaryFunction1DFloat_getName( BPy_UnaryFunction1DFloat *self ) return PyString_FromString( self->uf1D_float->getName().c_str() ); } -PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args) +PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D<float>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_float->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_float->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 6ffcf55f546..44bf1c5d563 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -18,14 +18,13 @@ static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* sel static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self); static PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self); -static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args); +static PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigned* self, PyObject *args); static PyObject * UnaryFunction1DUnsigned_getIntegrationType(BPy_UnaryFunction1DUnsigned* self); /*----------------------UnaryFunction1DUnsigned instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DUnsigned_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DUnsigned_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DUnsigned___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DUnsigned_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -57,7 +56,7 @@ PyTypeObject UnaryFunction1DUnsigned_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DUnsigned___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -173,13 +172,21 @@ PyObject * UnaryFunction1DUnsigned_getName( BPy_UnaryFunction1DUnsigned *self ) return PyString_FromString( self->uf1D_unsigned->getName().c_str() ); } -PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args) +PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_unsigned->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_unsigned->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 93dc395854e..cb4698b1c50 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -19,14 +19,13 @@ static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self); static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self); static PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self); -static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args); +static PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* self, PyObject *args); static PyObject * UnaryFunction1DVec2f_getIntegrationType(BPy_UnaryFunction1DVec2f* self); /*----------------------UnaryFunction1DVec2f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DVec2f_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DVec2f_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DVec2f___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec2f_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -58,7 +57,7 @@ PyTypeObject UnaryFunction1DVec2f_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DVec2f___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -179,13 +178,21 @@ PyObject * UnaryFunction1DVec2f_getName( BPy_UnaryFunction1DVec2f *self ) return PyString_FromString( self->uf1D_vec2f->getName().c_str() ); } -PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args) +PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D<Vec2f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_vec2f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_vec2f->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 99fb88b3b61..0d4ce8c6cf1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -18,14 +18,13 @@ static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self); static PyObject * UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f* self); static PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self); -static PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args); +static PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* self, PyObject *args); static PyObject * UnaryFunction1DVec3f_getIntegrationType(BPy_UnaryFunction1DVec3f* self); /*----------------------UnaryFunction1DVec3f instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DVec3f_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DVec3f_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DVec3f___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVec3f_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -57,7 +56,7 @@ PyTypeObject UnaryFunction1DVec3f_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DVec3f___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -173,13 +172,21 @@ PyObject * UnaryFunction1DVec3f_getName( BPy_UnaryFunction1DVec3f *self ) return PyString_FromString( self->uf1D_vec3f->getName().c_str() ); } -PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args) +PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D<Vec3f>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_vec3f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_vec3f->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index cf0b73d04ed..a79b70e4593 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -20,14 +20,13 @@ static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVector static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self); static PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorViewShape *self); -static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args); +static PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1DVectorViewShape* self, PyObject *args); static PyObject * UnaryFunction1DVectorViewShape_getIntegrationType(BPy_UnaryFunction1DVectorViewShape* self); /*----------------------UnaryFunction1DVectorViewShape instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DVectorViewShape_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DVectorViewShape_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DVectorViewShape___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVectorViewShape_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -59,7 +58,7 @@ PyTypeObject UnaryFunction1DVectorViewShape_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -187,13 +186,21 @@ PyObject * UnaryFunction1DVectorViewShape_getName( BPy_UnaryFunction1DVectorView return PyString_FromString( self->uf1D_vectorviewshape->getName().c_str() ); } -PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args) +PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D<std::vector<ViewShape*>>) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_vectorviewshape->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_vectorviewshape->getName() + " __call__ method failed"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index a353bf76213..4c081b8ad64 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -21,7 +21,7 @@ static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self); static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self); static PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self); -static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args); +static PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds); static PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self, PyObject *args); static PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid* self); @@ -29,7 +29,6 @@ static PyObject * UnaryFunction1DVoid_getIntegrationType(BPy_UnaryFunction1DVoid /*----------------------UnaryFunction1DVoid instance definitions ----------------------------*/ static PyMethodDef BPy_UnaryFunction1DVoid_methods[] = { {"getName", ( PyCFunction ) UnaryFunction1DVoid_getName, METH_NOARGS, "( )Returns the string of the name of the unary 1D function."}, - {"__call__", ( PyCFunction ) UnaryFunction1DVoid___call__, METH_VARARGS, "(Interface1D if1D )Builds a UnaryFunction1D from an integration type. " }, {"setIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_setIntegrationType, METH_VARARGS, "(IntegrationType i )Sets the integration method" }, {"getIntegrationType", ( PyCFunction ) UnaryFunction1DVoid_getIntegrationType, METH_NOARGS, "() Returns the integration method." }, {NULL, NULL, 0, NULL} @@ -61,7 +60,7 @@ PyTypeObject UnaryFunction1DVoid_Type = { /* More standard operations (here for binary compatibility) */ NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ + (ternaryfunc)UnaryFunction1DVoid___call__, /* ternaryfunc tp_call; */ NULL, /* reprfunc tp_str; */ NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ @@ -188,13 +187,21 @@ PyObject * UnaryFunction1DVoid_getName( BPy_UnaryFunction1DVoid *self ) return PyString_FromString( self->uf1D_void->getName().c_str() ); } -PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args) +PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) { PyObject *obj; + if( kwds != NULL ) { + PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported"); + return NULL; + } if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) return NULL; + if( typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void) ) { + PyErr_SetString(PyExc_TypeError, "__call__ method must be overloaded"); + return NULL; + } if (self->uf1D_void->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) { if (!PyErr_Occurred()) { string msg(self->uf1D_void->getName() + " __call__ method failed"); |