change mathutils 'repr' functions to closer match input

This commit is contained in:
2010-04-19 22:02:53 +00:00
parent 4a99303967
commit 4d39e04102
6 changed files with 70 additions and 36 deletions

View File

@@ -314,13 +314,22 @@ static PyObject *Euler_copy(EulerObject * self, PyObject *args)
//print the object to screen
static PyObject *Euler_repr(EulerObject * self)
{
char str[64];
PyObject *x, *y, *z, *ret;
if(!BaseMath_ReadCallback(self))
return NULL;
sprintf(str, "[%.6f, %.6f, %.6f](euler)", self->eul[0], self->eul[1], self->eul[2]);
return PyUnicode_FromString(str);
x= PyFloat_FromDouble(self->eul[0]);
y= PyFloat_FromDouble(self->eul[1]);
z= PyFloat_FromDouble(self->eul[2]);
ret= PyUnicode_FromFormat("Euler(%R, %R, %R)", x, y, z);
Py_DECREF(x);
Py_DECREF(y);
Py_DECREF(z);
return ret;
}
//------------------------tp_richcmpr
//returns -1 execption, 0 false, 1 true