diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-25 17:48:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-25 17:48:44 +0400 |
commit | 6d156a1bab818a8b41dbabca9fb539bde97ad810 (patch) | |
tree | 1d3b4632335034d23ec2a137f4b8a348bdecb76e /source/blender/python/intern/bpy_util.c | |
parent | edd783db737c2ea6b97b3bb982bd643f840ccd0e (diff) |
Store the context for python in a static variable with assessor functions - BPy_GetContext/BPy_SetContext,
Still not happy with this in the long term but its less problematic then storing the context in pythons namespace which couldn't be set before importing modules.
This might fix a crash quite a few people have reported (but I cant reproduce).
Diffstat (limited to 'source/blender/python/intern/bpy_util.c')
-rw-r--r-- | source/blender/python/intern/bpy_util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 66cf244e3bd..8fcade0911d 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -29,6 +29,13 @@ #include "MEM_guardedalloc.h" #include "BKE_report.h" + +#include "BKE_context.h" +bContext* __py_context = NULL; +bContext* BPy_GetContext(void) { return __py_context; }; +void BPy_SetContext(bContext *C) { __py_context= C; }; + + PyObject *BPY_flag_to_list(struct BPY_flag_def *flagdef, int flag) { PyObject *list = PyList_New(0); |