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:
authorJoseph Gilbert <ascotan@gmail.com>2005-11-07 22:36:50 +0300
committerJoseph Gilbert <ascotan@gmail.com>2005-11-07 22:36:50 +0300
commita39559ea11bf45c8a446fc84ad4fb079f72fdc29 (patch)
tree552f822d0a5b89a463eb5199c30acfe61a317db5 /source/blender/python/api2_2x/constant.c
parentcce655b5e7178a86391aff03d15dca0d328b75de (diff)
*change to the way constants are printed
Diffstat (limited to 'source/blender/python/api2_2x/constant.c')
-rw-r--r--source/blender/python/api2_2x/constant.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c
index a41571800b0..cf499a89921 100644
--- a/source/blender/python/api2_2x/constant.c
+++ b/source/blender/python/api2_2x/constant.c
@@ -33,6 +33,7 @@
#include "constant.h" /*This must come first */
#include "gen_utils.h"
+#include "BLI_blenlib.h"
PyTypeObject constant_Type;
@@ -134,8 +135,31 @@ static PyObject *constant_getAttr(BPy_constant * self, char *name)
//------------------------tp_repr
static PyObject *constant_repr(BPy_constant * self)
{
- PyObject *repr = PyObject_Repr(self->dict);
- return repr;
+ char buffer[128], str[4096];
+ PyObject *key, *value;
+ int pos = 0;
+
+ BLI_strncpy(str,"",4096);
+ sprintf(buffer, "[Constant: ");
+ strcat(str,buffer);
+ if (PyDict_Contains(self->dict, PyString_FromString("name"))){
+ value = PyDict_GetItemString(self->dict, "name");
+ sprintf(buffer, "%s", PyString_AsString(value));
+ strcat(str,buffer);
+ }else{
+ sprintf(buffer, "{");
+ strcat(str,buffer);
+ memset(buffer,0,128);
+ while (PyDict_Next(self->dict, &pos, &key, &value)) {
+ strcat(str,buffer);
+ sprintf(buffer, "%s, ", PyString_AsString(key));
+ }
+ sprintf(buffer, "%s}", PyString_AsString(key));
+ strcat(str,buffer);
+ }
+ sprintf(buffer, "]");
+ strcat(str,buffer);
+ return PyString_FromString(str);
}
//------------------------tp_dealloc
static void constant_dealloc(BPy_constant * self)