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:
authorDalai Felinto <dfelinto@gmail.com>2010-03-05 10:42:46 +0300
committerDalai Felinto <dfelinto@gmail.com>2010-03-05 10:42:46 +0300
commit1935a276b615bff77842a975228c09555baadf25 (patch)
tree128c1148686f5ff1f9f8a3a37b819d3aa303da21 /source/blender/editors/space_view3d/view3d_view.c
parent61e84a77b2f84a0dbca24a77977504240a63e14b (diff)
partial fix for: [#21400] bpy.ops.view3d.game_start() in a startup script (-P) crashes Blender
Creating a proper pool for the game_start() operator. I still want to find a way to force the start of a game from the commandline.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c14
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)