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-03-14 04:00:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-14 04:00:41 +0300
commit9ec2dfe0df6fe1fe6d89d6569d5da323a0c217b6 (patch)
treebbc2d086f7b89bfd45e4468b1fe6cab70744692b /source/blender/python
parent6cab58c8b96acaa0fc90fd4faf4d1661924c0dd0 (diff)
add dir() function for library objects, also was missing call to clear temp flag on exceptions.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_library.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index 977bcabe694..faee8f493c7 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -60,10 +60,12 @@ typedef struct {
static PyObject *bpy_lib_load(PyObject *self, PyObject *args, PyObject *kwds);
static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *args);
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *args);
+static PyObject *bpy_lib_dir(BPy_Library *self);
static PyMethodDef bpy_lib_methods[] = {
{"__enter__", (PyCFunction)bpy_lib_enter, METH_NOARGS},
{"__exit__", (PyCFunction)bpy_lib_exit, METH_VARARGS},
+ {"__dir__", (PyCFunction)bpy_lib_dir, METH_NOARGS},
{NULL} /* sentinel */
};
@@ -306,6 +308,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
/* exception raised above, XXX, this leaks some memory */
BLO_blendhandle_close(self->blo_handle);
self->blo_handle= NULL;
+ flag_all_listbases_ids(LIB_PRE_EXISTING, 0);
return NULL;
}
else {
@@ -331,6 +334,12 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
}
}
+static PyObject *bpy_lib_dir(BPy_Library *self)
+{
+ return PyDict_Keys(self->dict);
+}
+
+
int bpy_lib_init(PyObject *mod_par)
{
static PyMethodDef load_meth= {"load", (PyCFunction)bpy_lib_load, METH_STATIC|METH_VARARGS|METH_KEYWORDS};