Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-26 20:15:28 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-07-26 20:15:28 +0400
commit730fb1021c8b189229625866dac0f6e83db6418c (patch)
tree7985373b62cea17b3247a4e80842fbd372181058 /source/blender/freestyle/intern/python/UnaryFunction1D
parent78ce17fce88c23ba2c32b561bd9cc398a60a8278 (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/blender/freestyle/intern/python/UnaryFunction1D')
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp15
8 files changed, 88 insertions, 32 deletions
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");