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-03-21 01:41:27 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-03-21 01:41:27 +0300
commit0c7e5323e891e5b32b4bfae58115137e805adfeb (patch)
treea92d0320b3bef22e80683cf38d4b241a9e35806e /source/blender/freestyle
parent6ba34d18b55bedbddb750e5231a2aec9a1fbbac0 (diff)
Improvements in error handling at Python-C++ boundaries.
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp15
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp15
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp23
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp23
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp108
-rw-r--r--source/blender/freestyle/intern/python/Director.h18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp15
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp17
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp14
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp20
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp23
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp18
24 files changed, 280 insertions, 227 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
index bcd98a42189..e9892825d50 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
@@ -153,15 +153,18 @@ PyObject * BinaryPredicate0D_getName( BPy_BinaryPredicate0D *self, PyObject *arg
PyObject * BinaryPredicate0D___call__( BPy_BinaryPredicate0D *self, PyObject *args)
{
BPy_Interface0D *obj1, *obj2;
- bool b;
- if( !PyArg_ParseTuple(args,(char *)"OO", &obj1, &obj2) ) {
- cout << "ERROR: BinaryPredicate0D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!O!", &Interface0D_Type, &obj1, &Interface0D_Type, &obj2) )
return NULL;
- }
- b = self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) );
- return PyBool_from_bool( b );
+ if (self->bp0D->operator()( *(obj1->if0D) , *(obj2->if0D) ) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->bp0D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->bp0D->result );
}
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
index 9f7e0359ec8..fd32430b362 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
@@ -182,15 +182,18 @@ PyObject *BinaryPredicate1D_getName( BPy_BinaryPredicate1D *self, PyObject *args
PyObject *BinaryPredicate1D___call__( BPy_BinaryPredicate1D *self, PyObject *args)
{
BPy_Interface1D *obj1, *obj2;
- bool b;
- if( !PyArg_ParseTuple(args,(char *)"OO", &obj1, &obj2) ) {
- cout << "ERROR: BinaryPredicate1D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!O!", &Interface1D_Type, &obj1, &Interface1D_Type, &obj2) )
return NULL;
- }
- b = self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) );
- return PyBool_from_bool( b );
+ if (self->bp1D->operator()( *(obj1->if1D) , *(obj2->if1D) ) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->bp1D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->bp1D->result );
}
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
index f751d092920..19d4a8abdbf 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
@@ -165,19 +165,24 @@ PyObject * UnaryPredicate0D___call__( BPy_UnaryPredicate0D *self, PyObject *args
{
PyObject *py_if0D_it;
- if(!( PyArg_ParseTuple(args, "O", &py_if0D_it) && BPy_Interface0DIterator_Check(py_if0D_it) )) {
- cout << "ERROR: UnaryPredicate0D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &py_if0D_it) )
return NULL;
- }
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *) py_if0D_it)->if0D_it;
- if( if0D_it )
- return PyBool_from_bool( self->up0D->operator()(*if0D_it) );
- else
- cerr << "ERROR: UnaryPredicate0D___call__ (no Interface0DIterator)" << endl;
-
- Py_RETURN_NONE;
+ if( !if0D_it ) {
+ string msg(self->up0D->getName() + " has no Interface0DIterator");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ return NULL;
+ }
+ if (self->up0D->operator()(*if0D_it) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->up0D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->up0D->result );
}
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
index 0ae76b5eae6..8712b374209 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
@@ -207,19 +207,24 @@ PyObject * UnaryPredicate1D___call__( BPy_UnaryPredicate1D *self, PyObject *args
{
PyObject *py_if1D;
- if(!( PyArg_ParseTuple(args, "O", &py_if1D) && BPy_Interface1D_Check(py_if1D) )) {
- cout << "ERROR: UnaryPredicate1D___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &py_if1D) )
return NULL;
- }
Interface1D *if1D = ((BPy_Interface1D *) py_if1D)->if1D;
- if( if1D )
- return PyBool_from_bool( self->up1D->operator()(*if1D) );
- else
- cerr << "ERROR: UnaryPredicate1D___call__ (no Interface1D)" << endl;
-
- Py_RETURN_NONE;
+ if( !if1D ) {
+ string msg(self->up1D->getName() + " has no Interface0DIterator");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ return NULL;
+ }
+ if( self->up1D->operator()(*if1D) < 0 ) {
+ if (!PyErr_Occurred()) {
+ string msg(self->up1D->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyBool_from_bool( self->up1D->result );
}
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index 8535c82be51..ef8ae063024 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -43,123 +43,108 @@
// BinaryPredicate0D: __call__
-bool Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2) {
+int Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2) {
PyObject *arg1 = BPy_Interface0D_from_Interface0D(i1);
PyObject *arg2 = BPy_Interface0D_from_Interface0D(i2);
PyObject *result = PyObject_CallMethod( obj, "__call__", "OO", arg1, arg2 );
Py_DECREF(arg1);
Py_DECREF(arg2);
- if (!result) {
- cerr << "Warning: BinaryPredicate0D::__call__() failed." << endl;
- PyErr_Clear();
- return false;
- }
- bool ret = bool_from_PyBool(result);
+ if (!result)
+ return -1;
+ int ret = PyObject_IsTrue(result);
Py_DECREF(result);
return ret;
}
// BinaryPredicate1D: __call__
-bool Director_BPy_BinaryPredicate1D___call__( PyObject *obj, Interface1D& i1, Interface1D& i2) {
- PyObject *arg1 = BPy_Interface1D_from_Interface1D(i1);
- PyObject *arg2 = BPy_Interface1D_from_Interface1D(i2);
+int Director_BPy_BinaryPredicate1D___call__( PyObject *obj, Interface1D& i1, Interface1D& i2) {
+ PyObject *arg1, *arg2;
PyObject *result = PyObject_CallMethod( obj, "__call__", "OO", arg1, arg2 );
Py_DECREF(arg1);
Py_DECREF(arg2);
- if (!result) {
- cerr << "Warning: BinaryPredicate1D::__call__() failed." << endl;
- PyErr_Clear();
- return false;
- }
- bool ret = bool_from_PyBool(result);
+ if (!result)
+ return -1;
+ int ret = PyObject_IsTrue(result);
Py_DECREF(result);
return ret;
}
// UnaryPredicate0D: __call__
-bool Director_BPy_UnaryPredicate0D___call__( PyObject *obj, Interface0DIterator& if0D_it) {
+int Director_BPy_UnaryPredicate0D___call__( PyObject *obj, Interface0DIterator& if0D_it) {
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it);
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: UnaryPredicate0D::__call__() failed." << endl;
- PyErr_Clear();
- return false;
- }
- bool ret = bool_from_PyBool(result);
+ if (!result)
+ return -1;
+ int ret = PyObject_IsTrue(result);
Py_DECREF(result);
return ret;
}
// UnaryPredicate1D: __call__
-bool Director_BPy_UnaryPredicate1D___call__( PyObject *obj, Interface1D& if1D) {
- PyObject *arg = BPy_Interface1D_from_Interface1D(if1D);
+int Director_BPy_UnaryPredicate1D___call__( PyObject *obj, Interface1D& if1D) {
+ PyObject *arg;
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: UnaryPredicate1D::__call__() failed." << endl;
- PyErr_Clear();
- return false;
- }
- bool ret = bool_from_PyBool(result);
+ if (!result)
+ return -1;
+ int ret = PyObject_IsTrue(result);
Py_DECREF(result);
return ret;
}
// StrokeShader: shade
-void Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s) {
+int Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s) {
PyObject *arg = BPy_Stroke_from_Stroke_ptr(&s);
PyObject *result = PyObject_CallMethod( obj, "shade", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: StrokeShader::shade() failed" << endl;
- PyErr_Clear();
- return;
- }
+ if (!result)
+ return -1;
Py_DECREF(result);
+ return 0;
}
// ChainingIterator: init, traverse
-void Director_BPy_ChainingIterator_init( PyObject *obj ) {
+int Director_BPy_ChainingIterator_init( PyObject *obj ) {
PyObject *result = PyObject_CallMethod( obj, "init", "", 0 );
- if (!result) {
- cerr << "Warning: ChainingIterator::init() failed." << endl;
- PyErr_Clear();
- return;
- }
+ if (!result)
+ return -1;
Py_DECREF(result);
+ return 0;
}
-ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it ) {
+int Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it, ViewEdge **ve ) {
PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it);
PyObject *result = PyObject_CallMethod( obj, "traverse", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: ChainingIterator::traverse() failed." << endl;
- PyErr_Clear();
- return NULL;
+ if (!result)
+ return -1;
+ if (BPy_ViewEdge_Check(result)) {
+ *ve = ((BPy_ViewEdge *) result)->ve;
+ } else if (result == Py_None) {
+ *ve = NULL;
+ } else {
+ PyErr_SetString(PyExc_RuntimeError, "traverse method returned a wrong value");
+ Py_DECREF(result);
+ return -1;
}
- ViewEdge *ret = ((BPy_ViewEdge *) result)->ve;
Py_DECREF(result);
- return ret;
+ return 0;
}
// BPy_UnaryFunction{0D,1D}: __call__
-void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) {
+int Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it) {
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it);
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: UnaryFunction0D::__call__() failed." << endl;
- PyErr_Clear();
- return;
- }
+ if (!result)
+ return -1;
if( BPy_UnaryFunction0DDouble_Check(obj) ) {
((UnaryFunction0D<double> *) uf0D)->result = PyFloat_AsDouble(result);
@@ -204,18 +189,16 @@ void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface
}
Py_DECREF(result);
+ return 0;
}
-void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D) {
+int Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D) {
PyObject *arg = BPy_Interface1D_from_Interface1D(if1D);
PyObject *result = PyObject_CallMethod( obj, "__call__", "O", arg );
Py_DECREF(arg);
- if (!result) {
- cerr << "Warning: UnaryFunction1D::__call__() failed." << endl;
- PyErr_Clear();
- return;
- }
+ if (!result)
+ return -1;
if( BPy_UnaryFunction1DDouble_Check(obj) ) {
((UnaryFunction1D<double> *) uf1D)->result = PyFloat_AsDouble(result);
@@ -251,6 +234,7 @@ void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface
}
Py_DECREF(result);
+ return 0;
}
diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h
index 22bf80c5c14..eecab146a5d 100644
--- a/source/blender/freestyle/intern/python/Director.h
+++ b/source/blender/freestyle/intern/python/Director.h
@@ -29,10 +29,10 @@ extern "C" {
#endif
// BinaryPredicate0D: __call__
-bool Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2);
+int Director_BPy_BinaryPredicate0D___call__( PyObject *obj, Interface0D& i1, Interface0D& i2);
// BinaryPredicate1D: __call__
-bool Director_BPy_BinaryPredicate1D___call__( PyObject *obj, Interface1D& i1, Interface1D& i2);
+int Director_BPy_BinaryPredicate1D___call__( PyObject *obj, Interface1D& i1, Interface1D& i2);
// Interface0D: getX, getY, getZ, getPoint3D, getProjectedX, getProjectedY, getProjectedZ, getPoint2D, getFEdge, getId, getNature, castToSVertex, castToViewVertex, castToNonTVertex, castToTVertex
double Director_BPy_Interface0D_getX( PyObject *obj );
@@ -61,17 +61,17 @@ Id Director_BPy_Interface1D_getId( PyObject *obj );
Nature::EdgeNature Director_BPy_Interface1D_getNature( PyObject *obj );
// UnaryFunction{0D,1D}: __call__
-void Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it);
-void Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D);
+int Director_BPy_UnaryFunction0D___call__( void *uf0D, PyObject *obj, Interface0DIterator& if0D_it);
+int Director_BPy_UnaryFunction1D___call__( void *uf1D, PyObject *obj, Interface1D& if1D);
// UnaryPredicate0D: __call__
-bool Director_BPy_UnaryPredicate0D___call__( PyObject *obj, Interface0DIterator& if0D_it);
+int Director_BPy_UnaryPredicate0D___call__( PyObject *obj, Interface0DIterator& if0D_it);
// UnaryPredicate1D: __call__
-bool Director_BPy_UnaryPredicate1D___call__( PyObject *obj, Interface1D& if1D);
+int Director_BPy_UnaryPredicate1D___call__( PyObject *obj, Interface1D& if1D);
// StrokeShader: shade
-void Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s);
+int Director_BPy_StrokeShader_shade( PyObject *obj, Stroke& s);
// Iterator: increment, decrement, isBegin, isEnd
void Director_BPy_Iterator_increment( PyObject *obj );
@@ -80,8 +80,8 @@ bool Director_BPy_Iterator_isBegin( PyObject *obj );
bool Director_BPy_Iterator_isEnd( PyObject *obj );
// ChainingIterator: init, traverse
-void Director_BPy_ChainingIterator_init( PyObject *obj );
-ViewEdge * Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it );
+int Director_BPy_ChainingIterator_init( PyObject *obj );
+int Director_BPy_ChainingIterator_traverse( PyObject *obj, AdjacencyIterator& a_it, ViewEdge **ve );
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
index 06de17f87e8..822ad6c22bd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
@@ -217,14 +217,17 @@ PyObject * UnaryFunction0DDouble___call__( BPy_UnaryFunction0DDouble *self, PyOb
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DDouble___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- double d = self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it));
-
- return PyFloat_FromDouble( d );
+ if (self->uf0D_double->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it)) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_double->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyFloat_FromDouble( self->uf0D_double->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
index 3796cf64875..6e3ff1fde4b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
@@ -160,13 +160,17 @@ PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *se
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DEdgeNature___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- Nature::EdgeNature n = self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
- return BPy_Nature_from_Nature( n );
+ if (self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_edgenature->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return BPy_Nature_from_Nature( self->uf0D_edgenature->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
index 8cb5d3832cc..d48ae5205f8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
@@ -189,13 +189,17 @@ PyObject * UnaryFunction0DFloat___call__( BPy_UnaryFunction0DFloat *self, PyObje
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DFloat___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- float f = self->uf0D_float->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
- return PyFloat_FromDouble( f );
+ if (self->uf0D_float->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_float->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyFloat_FromDouble( self->uf0D_float->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
index 0582329b8b0..cb988655825 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
@@ -160,13 +160,17 @@ PyObject * UnaryFunction0DId___call__( BPy_UnaryFunction0DId *self, PyObject *ar
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DId___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- Id id( self->uf0D_id->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) );
- return BPy_Id_from_Id( id );
+ if (self->uf0D_id->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_id->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return BPy_Id_from_Id( self->uf0D_id->result );
}
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
index 0006aa80d9d..10f3e493244 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
@@ -160,13 +160,17 @@ PyObject * UnaryFunction0DMaterial___call__( BPy_UnaryFunction0DMaterial *self,
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DMaterial___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- FrsMaterial m( self->uf0D_material->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) );
- return BPy_FrsMaterial_from_FrsMaterial( m );
+ if (self->uf0D_material->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_material->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return BPy_FrsMaterial_from_FrsMaterial( self->uf0D_material->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
index 98cecfa1e77..754a432a336 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
@@ -160,13 +160,17 @@ PyObject * UnaryFunction0DUnsigned___call__( BPy_UnaryFunction0DUnsigned *self,
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DUnsigned___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- unsigned int i = self->uf0D_unsigned->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
- return PyInt_FromLong( i );
+ if (self->uf0D_unsigned->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_unsigned->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyInt_FromLong( self->uf0D_unsigned->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
index 7efb3ff02fb..9a1c0ba1fd3 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
@@ -165,13 +165,17 @@ PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self )
PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self, PyObject *args)
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DVec2f___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- Vec2f v( self->uf0D_vec2f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) );
- return Vector_from_Vec2f( v );
+ if (self->uf0D_vec2f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_vec2f->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return Vector_from_Vec2f( self->uf0D_vec2f->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
index 5f8f21208de..86360293c78 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
@@ -160,13 +160,17 @@ PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self, PyObje
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DVec3f___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
return NULL;
- }
- Vec3f v( self->uf0D_vec3f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) );
- return Vector_from_Vec3f( v );
+ if (self->uf0D_vec3f->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf0D_vec3f->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return Vector_from_Vec3f( self->uf0D_vec3f->result );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index 5620559ddc7..8a38db08e95 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -160,17 +160,20 @@ PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorVie
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DVectorViewShape___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
+ 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");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
return NULL;
}
-
-
- std::vector<ViewShape*> vs( self->uf0D_vectorviewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) );
PyObject *list = PyList_New(NULL);
- for( unsigned int i = 0; i < vs.size(); i++)
- PyList_Append(list, BPy_ViewShape_from_ViewShape(*( vs[i] )) );
+ for( unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++)
+ PyList_Append(list, BPy_ViewShape_from_ViewShape(*( self->uf0D_vectorviewshape->result[i] )) );
return list;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
index e636e554e21..abcbdbaebab 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
@@ -166,13 +166,17 @@ PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShape *self
{
PyObject *obj;
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) {
- cout << "ERROR: UnaryFunction0DViewShape___call__ " << endl;
+ if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
+ 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");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
return NULL;
}
-
- ViewShape *vs = self->uf0D_viewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it ));
- return BPy_ViewShape_from_ViewShape( *vs );
+ return BPy_ViewShape_from_ViewShape( *(self->uf0D_viewshape->result) );
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
index 48725589e68..1dd24b1fbb7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
@@ -257,13 +257,17 @@ PyObject * UnaryFunction1DDouble___call__( BPy_UnaryFunction1DDouble *self, PyOb
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DDouble___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- double d = self->uf1D_double->operator()(*( ((BPy_Interface1D *) obj)->if1D ));
- return PyFloat_FromDouble( d );
+ if (self->uf1D_double->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_double->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyFloat_FromDouble( self->uf1D_double->result );
}
@@ -271,10 +275,8 @@ PyObject * UnaryFunction1DDouble_setIntegrationType(BPy_UnaryFunction1DDouble* s
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DDouble_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_double->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
index 15589ab3e75..bf1b423715b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
@@ -177,13 +177,17 @@ PyObject * UnaryFunction1DEdgeNature___call__( BPy_UnaryFunction1DEdgeNature *se
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DEdgeNature___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- Nature::EdgeNature n = self->uf1D_edgenature->operator()(*( ((BPy_Interface1D *) obj)->if1D ));
- return BPy_Nature_from_Nature( n );
+ if (self->uf1D_edgenature->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_edgenature->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return BPy_Nature_from_Nature( self->uf1D_edgenature->result );
}
@@ -191,10 +195,8 @@ PyObject * UnaryFunction1DEdgeNature_setIntegrationType(BPy_UnaryFunction1DEdgeN
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DEdgeNature_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_edgenature->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
index 50261496d89..f71a0c8af35 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
@@ -170,13 +170,17 @@ PyObject * UnaryFunction1DFloat___call__( BPy_UnaryFunction1DFloat *self, PyObje
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DFloat___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- float f = self->uf1D_float->operator()(*( ((BPy_Interface1D *) obj)->if1D ));
- return PyFloat_FromDouble( f );
+ if (self->uf1D_float->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_float->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyFloat_FromDouble( self->uf1D_float->result );
}
@@ -184,10 +188,8 @@ PyObject * UnaryFunction1DFloat_setIntegrationType(BPy_UnaryFunction1DFloat* sel
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DFloat_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_float->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
index 1761e24985e..6ffcf55f546 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
@@ -177,13 +177,17 @@ PyObject * UnaryFunction1DUnsigned___call__( BPy_UnaryFunction1DUnsigned *self,
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DUnsigned___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- unsigned int i = self->uf1D_unsigned->operator()(*( ((BPy_Interface1D *) obj)->if1D ));
- return PyInt_FromLong( i );
+ if (self->uf1D_unsigned->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_unsigned->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return PyInt_FromLong( self->uf1D_unsigned->result );
}
@@ -191,10 +195,8 @@ PyObject * UnaryFunction1DUnsigned_setIntegrationType(BPy_UnaryFunction1DUnsigne
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DUnsigned_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_unsigned->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
index 23887c5672a..93dc395854e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
@@ -183,13 +183,17 @@ PyObject * UnaryFunction1DVec2f___call__( BPy_UnaryFunction1DVec2f *self, PyObje
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVec2f___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- Vec2f v( self->uf1D_vec2f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) );
- return Vector_from_Vec2f( v );
+ if (self->uf1D_vec2f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_vec2f->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return Vector_from_Vec2f( self->uf1D_vec2f->result );
}
@@ -197,10 +201,8 @@ PyObject * UnaryFunction1DVec2f_setIntegrationType(BPy_UnaryFunction1DVec2f* sel
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVec2f_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_vec2f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
index 2b2808947f8..99fb88b3b61 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
@@ -177,13 +177,17 @@ PyObject * UnaryFunction1DVec3f___call__( BPy_UnaryFunction1DVec3f *self, PyObje
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVec3f___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- Vec3f v( self->uf1D_vec3f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) );
- return Vector_from_Vec3f( v );
+ if (self->uf1D_vec3f->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_vec3f->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
+ return Vector_from_Vec3f( self->uf1D_vec3f->result );
}
@@ -191,10 +195,8 @@ PyObject * UnaryFunction1DVec3f_setIntegrationType(BPy_UnaryFunction1DVec3f* sel
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVec3f_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_vec3f->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index 4e8e01b2dfa..cf0b73d04ed 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -191,17 +191,20 @@ PyObject * UnaryFunction1DVectorViewShape___call__( BPy_UnaryFunction1DVectorVie
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVectorViewShape___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
-
- std::vector<ViewShape*> vs( self->uf1D_vectorviewshape->operator()(*( ((BPy_Interface1D *) obj)->if1D )) );
+ if (self->uf1D_vectorviewshape->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_vectorviewshape->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
PyObject *list = PyList_New(NULL);
- for( unsigned int i = 0; i < vs.size(); i++)
- PyList_Append(list, BPy_ViewShape_from_ViewShape(*( vs[i] )) );
+ for( unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++)
+ PyList_Append(list, BPy_ViewShape_from_ViewShape(*( self->uf1D_vectorviewshape->result[i] )) );
return list;
}
@@ -210,10 +213,8 @@ PyObject * UnaryFunction1DVectorViewShape_setIntegrationType(BPy_UnaryFunction1D
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVectorViewShape_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_vectorviewshape->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
index d742b0f19d0..a353bf76213 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
@@ -192,12 +192,16 @@ PyObject * UnaryFunction1DVoid___call__( BPy_UnaryFunction1DVoid *self, PyObject
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVoid___call__ " << endl;
+ if( !PyArg_ParseTuple(args, "O!", &Interface1D_Type, &obj) )
return NULL;
- }
- self->uf1D_void->operator()(*( ((BPy_Interface1D *) obj)->if1D ));
+ if (self->uf1D_void->operator()(*( ((BPy_Interface1D *) obj)->if1D )) < 0) {
+ if (!PyErr_Occurred()) {
+ string msg(self->uf1D_void->getName() + " __call__ method failed");
+ PyErr_SetString(PyExc_RuntimeError, msg.c_str());
+ }
+ return NULL;
+ }
Py_RETURN_NONE;
}
@@ -205,10 +209,8 @@ PyObject * UnaryFunction1DVoid_setIntegrationType(BPy_UnaryFunction1DVoid* self,
{
PyObject *obj;
- if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) ) {
- cout << "ERROR: UnaryFunction1DVoid_setIntegrationType " << endl;
- Py_RETURN_NONE;
- }
+ if( !PyArg_ParseTuple(args, "O!", &IntegrationType_Type, &obj) )
+ return NULL;
self->uf1D_void->setIntegrationType( IntegrationType_from_BPy_IntegrationType(obj) );
Py_RETURN_NONE;