From 7b3a5f690145e7013a518f9c68260550e416c7c8 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 23 Feb 2013 12:17:40 +0000 Subject: Fix for __repr__() depending on .getName() and .getExactTypeName(). API users no longer need to define them in user-defined Functions, Predicates and StrokeShaders. Also removed all .getName() and .getExactTypeName() definitions in pre-defined Functions, Predicates and StrokeShaders subclasses. --- source/blender/freestyle/intern/python/BPy_Iterator.cpp | 2 +- source/blender/freestyle/intern/python/BPy_StrokeShader.cpp | 2 +- source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp | 4 ++-- source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/freestyle/intern/python') diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index df9f462eba9..09918e71d67 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -110,7 +110,7 @@ static void Iterator_dealloc(BPy_Iterator* self) static PyObject * Iterator_repr(BPy_Iterator* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->it->getExactTypeName().c_str(), self->it); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->it); } PyDoc_STRVAR(Iterator_increment_doc, diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index f4a2501547b..82ad1f85633 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -197,7 +197,7 @@ static void StrokeShader___dealloc__(BPy_StrokeShader* self) static PyObject * StrokeShader___repr__(BPy_StrokeShader* self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->ss->getName().c_str(), self->ss); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->ss); } static char StrokeShader_shade___doc__[] = diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index add32897740..28ce90cc512 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -93,8 +93,8 @@ static PyObject * UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, PyObject Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; if (!if0D_it) { - string msg(self->up0D->getName() + " has no Interface0DIterator"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str()); return NULL; } if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) { diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 75577246c44..d1f4f05598d 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -141,8 +141,8 @@ static PyObject * UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; if (!if1D) { - string msg(self->up1D->getName() + " has no Interface0DIterator"); - PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); return NULL; } if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) { -- cgit v1.2.3