diff options
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 1674c135008..bcdb0513c4a 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1725,7 +1725,19 @@ extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_f int game_engine_poll(bContext *C) { - return CTX_data_mode_enum(C)==CTX_MODE_OBJECT ? 1:0; + /* we need a context and area to launch BGE + it's a temporary solution to avoid crash at load time + if we try to auto run the BGE. Ideally we want the + context to be set as soon as we load the file. */ + + if(CTX_wm_window(C)==NULL) return 0; + if(CTX_wm_screen(C)==NULL) return 0; + if(CTX_wm_area(C)==NULL) return 0; + + if(CTX_data_mode_enum(C)!=CTX_MODE_OBJECT) + return 0; + + return 1; } int ED_view3d_context_activate(bContext *C) |