diff options
Diffstat (limited to 'source/blender/python/intern/bpy_interface.c')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 422d55ecefe..8bd6e6c611c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -66,10 +66,10 @@ #include "../generic/py_capi_utils.h" /* inittab initialization functions */ -#include "../generic/noise_py_api.h" -#include "../generic/mathutils.h" #include "../generic/bgl.h" #include "../generic/blf_py_api.h" +#include "../generic/noise_py_api.h" +#include "../mathutils/mathutils.h" /* for internal use, when starting and ending python scripts */ @@ -175,8 +175,8 @@ extern PyObject *AUD_initPython(void); static struct _inittab bpy_internal_modules[]= { {(char *)"noise", BPyInit_noise}, - {(char *)"mathutils", BPyInit_mathutils}, -// {(char *)"mathutils.geometry", BPyInit_mathutils_geometry}, + {(char *)"mathutils", PyInit_mathutils}, +// {(char *)"mathutils.geometry", PyInit_mathutils_geometry}, {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, #ifdef WITH_AUDASPACE @@ -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 |