From 6d156a1bab818a8b41dbabca9fb539bde97ad810 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 May 2009 13:48:44 +0000 Subject: 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). --- source/blender/python/intern/bpy_util.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/python/intern/bpy_util.c') 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); -- cgit v1.2.3