[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27271] trunk/blender/source/blender/ editors/space_view3d/view3d_view.c: partial fix for: [#21400] bpy.ops. view3d.game_start() in a startup script (-P) crashes Blender
Dalai Felinto
dfelinto at gmail.com
Fri Mar 5 08:42:47 CET 2010
Revision: 27271
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27271
Author: dfelinto
Date: 2010-03-05 08:42:46 +0100 (Fri, 05 Mar 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/view3d_view.c
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2010-03-05 03:52:05 UTC (rev 27270)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2010-03-05 07:42:46 UTC (rev 27271)
@@ -1725,7 +1725,19 @@
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)
More information about the Bf-blender-cvs
mailing list