[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35526] trunk/blender/source/blender/ python/intern/bpy_library.c: add dir() function for library objects, also was missing call to clear temp flag on exceptions.
Campbell Barton
ideasman42 at gmail.com
Mon Mar 14 02:00:41 CET 2011
Revision: 35526
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35526
Author: campbellbarton
Date: 2011-03-14 01:00:41 +0000 (Mon, 14 Mar 2011)
Log Message:
-----------
add dir() function for library objects, also was missing call to clear temp flag on exceptions.
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_library.c
Modified: trunk/blender/source/blender/python/intern/bpy_library.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_library.c 2011-03-14 00:36:27 UTC (rev 35525)
+++ trunk/blender/source/blender/python/intern/bpy_library.c 2011-03-14 01:00:41 UTC (rev 35526)
@@ -60,10 +60,12 @@
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 @@
/* 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_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};
More information about the Bf-blender-cvs
mailing list