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-07-10 22:54:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-10 22:54:02 +0400
commit80eb1eae42940664452d7d4ec94a6a383a8c1e9d (patch)
tree04d92a0523f8eb7e4a2994c53c42cf401003782c /source/blender/python
parent1f6a79ecb59e958385544270c6226f6419c12ecd (diff)
run WM_exit(C) when blender as a python module exits
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_interface.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 422d55ecefe..f091a511e93 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -663,7 +663,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
#include "BLI_storage.h"
/* TODO, reloading the module isnt functional at the moment. */
-extern int main_python(int argc, const char **argv);
+static void bpy_module_free(void *mod);
+extern int main_python_enter(int argc, const char **argv);
+extern void main_python_exit(void);
static struct PyModuleDef bpy_proxy_def= {
PyModuleDef_HEAD_INIT,
"bpy", /* m_name */
@@ -673,8 +675,8 @@ static struct PyModuleDef bpy_proxy_def= {
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
- NULL, /* m_free */
-};
+ bpy_module_free, /* m_free */
+};
typedef struct {
PyObject_HEAD
@@ -699,7 +701,7 @@ void bpy_module_delay_init(PyObject *bpy_proxy)
// printf("module found %s\n", argv[0]);
- main_python(argc, argv);
+ main_python_enter(argc, argv);
/* initialized in BPy_init_modules() */
PyDict_Update(PyModule_GetDict(bpy_proxy), PyModule_GetDict(bpy_package_py));
@@ -756,4 +758,9 @@ PyInit_bpy(void)
return bpy_proxy;
}
+static void bpy_module_free(void *UNUSED(mod))
+{
+ main_python_exit();
+}
+
#endif