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:
authorCampbell Barton <ideasman42@gmail.com>2011-12-20 07:37:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-20 07:37:55 +0400
commit3d8ee287509f3a0dac535914a7193397217b006c (patch)
tree2a2fc72b6151fd21bef9c29248ee2b59da443044 /source/blender/python/mathutils/mathutils_Euler.c
parent32b23b9f746b9bec4023da1d2ef6085fbbde9ae7 (diff)
__str__ functions for other mathutils types
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Euler.c')
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index f44c0b82a2d..b866311b398 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_dynstr.h"
#define EULER_SIZE 3
@@ -317,6 +318,21 @@ static PyObject *Euler_repr(EulerObject * self)
return ret;
}
+static PyObject *Euler_str(EulerObject * self)
+{
+ DynStr *ds;
+
+ if (BaseMath_ReadCallback(self) == -1)
+ return NULL;
+
+ ds= BLI_dynstr_new();
+
+ BLI_dynstr_appendf(ds, "<Euler (x=%.4f, y=%.4f, z=%.4f), order='%s' >",
+ self->eul[0], self->eul[1], self->eul[2], euler_order_str(self));
+
+ return mathutils_dynstr_to_py(ds); /* frees ds */
+}
+
static PyObject* Euler_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
@@ -635,7 +651,7 @@ PyTypeObject euler_Type = {
&Euler_AsMapping, //tp_as_mapping
NULL, //tp_hash
NULL, //tp_call
- NULL, //tp_str
+ (reprfunc) Euler_str, //tp_str
NULL, //tp_getattro
NULL, //tp_setattro
NULL, //tp_as_buffer