From 159806140fd33e6ddab951c0f6f180cfbf927d38 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 16 Apr 2018 14:07:42 +0200 Subject: Removing Blender Game Engine from Blender 2.8 Folders removed entirely: * //extern/recastnavigation * //intern/decklink * //intern/moto * //source/blender/editors/space_logic * //source/blenderplayer * //source/gameengine This includes DNA data and any reference to the BGE code in Blender itself. We are bumping the subversion. Pending tasks: * Tile/clamp code in image editor draw code. * Viewport drawing code (so much of this will go away because of BI removal that we can wait until then to remove this. --- source/blender/editors/space_view3d/CMakeLists.txt | 7 - source/blender/editors/space_view3d/drawmesh.c | 2 - source/blender/editors/space_view3d/drawobject.c | 191 +----------------- .../editors/space_view3d/view3d_draw_legacy.c | 33 +--- .../blender/editors/space_view3d/view3d_intern.h | 2 - source/blender/editors/space_view3d/view3d_ops.c | 1 - source/blender/editors/space_view3d/view3d_view.c | 219 --------------------- 7 files changed, 4 insertions(+), 451 deletions(-) (limited to 'source/blender/editors/space_view3d') diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index d148ef3c6fe..d027729c7a7 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -84,13 +84,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../gameengine/BlenderRoutines - ) - add_definitions(-DWITH_GAMEENGINE) -endif() - add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 0d4ec4d42d1..2b3678c4812 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -41,7 +41,6 @@ #include "DNA_meshdata_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" -#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" @@ -51,7 +50,6 @@ #include "BKE_image.h" #include "BKE_material.h" #include "BKE_paint.h" -#include "BKE_property.h" #include "BKE_editmesh.h" #include "BKE_scene.h" diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 287613c847b..1d54a1937eb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -328,7 +328,7 @@ bool draw_glsl_material(Scene *scene, ViewLayer *view_layer, Object *ob, View3D return true; if (v3d->drawtype == OB_TEXTURE) - return (scene->gm.matmode == GAME_MAT_GLSL && !BKE_scene_use_new_shading_nodes(scene)); + return !BKE_scene_use_new_shading_nodes(scene); else if (v3d->drawtype == OB_MATERIAL && dt > OB_SOLID) return true; else @@ -1189,51 +1189,6 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z, unsigned pos) glDisable(GL_CULL_FACE); } -#ifdef WITH_GAMEENGINE -static void draw_transp_sun_volume(Lamp *la, unsigned pos) -{ - float box[8][3]; - - /* construct box */ - box[0][0] = box[1][0] = box[2][0] = box[3][0] = -la->shadow_frustum_size; - box[4][0] = box[5][0] = box[6][0] = box[7][0] = +la->shadow_frustum_size; - box[0][1] = box[1][1] = box[4][1] = box[5][1] = -la->shadow_frustum_size; - box[2][1] = box[3][1] = box[6][1] = box[7][1] = +la->shadow_frustum_size; - box[0][2] = box[3][2] = box[4][2] = box[7][2] = -la->clipend; - box[1][2] = box[2][2] = box[5][2] = box[6][2] = -la->clipsta; - - /* draw edges */ - imm_draw_box(box, false, pos); - - /* draw faces */ - glEnable(GL_CULL_FACE); - glEnable(GL_BLEND); - glDepthMask(GL_FALSE); - - /* draw backside darkening */ - glCullFace(GL_FRONT); - - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); - immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); - - imm_draw_box(box, true, pos); - - /* draw front side lighting */ - glCullFace(GL_BACK); - - glBlendFunc(GL_ONE, GL_ONE); - immUniformColor3f(0.2f, 0.2f, 0.2f); - - imm_draw_box(box, true, pos); - - /* restore state */ - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_BLEND); - glDepthMask(GL_TRUE); - glDisable(GL_CULL_FACE); -} -#endif - void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_obact) { @@ -1253,22 +1208,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, !(base->flag_legacy & OB_FROMDUPLI) && !is_view); -#ifdef WITH_GAMEENGINE - const bool drawshadowbox = ( - (rv3d->rflag & RV3D_IS_GAME_ENGINE) && - (dt > OB_WIRE) && - !(G.f & G_PICKSEL) && - (la->type == LA_SUN) && - ((la->mode & LA_SHAD_BUF) || - (la->mode & LA_SHAD_RAY)) && - (la->mode & LA_SHOW_SHADOW_BOX) && - !(base->flag_legacy & OB_FROMDUPLI) && - !is_view); -#else - const bool drawshadowbox = false; -#endif - - if ((drawcone || drawshadowbox) && !v3d->transp) { + if (drawcone && !v3d->transp) { /* in this case we need to draw delayed */ ED_view3d_after_add(&v3d->afterdraw_transp, base, dflag); return; @@ -1576,11 +1516,6 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } } -#ifdef WITH_GAMEENGINE - if (drawshadowbox) { - draw_transp_sun_volume(la, pos); - } -#endif } else if (la->type == LA_AREA) { setlinestyle(3); @@ -4300,11 +4235,7 @@ static void draw_mesh_fancy( Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag) { -#ifdef WITH_GAMEENGINE - Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object; -#else Object *ob = base->object; -#endif Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; bool /* no_verts,*/ no_edges, no_faces; @@ -4718,11 +4649,7 @@ static void draw_mesh_fancy_new( return; } -#ifdef WITH_GAMEENGINE - Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object; -#else Object *ob = base->object; -#endif Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; /* could be bool draw_wire_overlay */ bool no_edges, no_faces; @@ -8177,33 +8104,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col if (bb == NULL) return; - if (ob->gameflag & OB_BOUNDS) { /* bounds need to be drawn around origin for game engine */ - - if (type == OB_BOUND_BOX) { - float vec[8][3], size[3]; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - if (ob_wire_col) immUniformColor3ubv(ob_wire_col); - - BKE_boundbox_calc_size_aabb(bb, size); - - vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0]; - vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0]; - vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1]; - vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1]; - vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2]; - vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2]; - - imm_draw_box(vec, false, pos); - - immUnbindProgram(); - } - else { - imm_draw_bb(bb, type, true, ob_wire_col); - } - } - else { + { if (type == OB_BOUND_BOX) { unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -8384,48 +8285,6 @@ static void draw_hooks(Object *ob, unsigned int pos) } } -static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, - const short dflag, const unsigned char ob_wire_col[4]) -{ - const char *axis_str[3] = {"px", "py", "pz"}; - float mat[4][4]; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - - if (ob_wire_col) immUniformColor3ubv(ob_wire_col); - - eul_to_mat4(mat, &data->axX); - glLineWidth(4.0f); - setlinestyle(2); - - immBegin(GWN_PRIM_LINES, 6); - for (int axis = 0; axis < 3; axis++) { - float dir[3] = {0, 0, 0}; - float v[3]; - - copy_v3_v3(v, &data->pivX); - - dir[axis] = 1.0f; - mul_m4_v3(mat, dir); - add_v3_v3(v, dir); - immVertex3fv(pos, &data->pivX); - immVertex3fv(pos, v); - - /* when const color is set wirecolor is NULL - we could get the current color but - * with selection and group instancing its not needed to draw the text */ - if ((dflag & DRAW_CONSTCOLOR) == 0) { - view3d_cached_text_draw_add(v, axis_str[axis], 2, 0, V3D_CACHE_TEXT_ASCII, ob_wire_col); - } - } - immEnd(); - - setlinestyle(0); - glLineWidth(1.0f); - - immUnbindProgram(); -} - void draw_object_wire_color(ViewLayer *view_layer, Base *base, unsigned char r_ob_wire_col[4]) { Object *ob = base->object; @@ -9059,23 +8918,6 @@ afterdraw: } if (!render_override) { - bConstraint *con; - - for (con = ob->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) { - bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data; - if (data->flag & CONSTRAINT_DRAW_PIVOT) - draw_rigid_body_pivot(data, dflag, ob_wire_col); - } - } - - if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) { - if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) { - setlinestyle(2); - draw_bounding_volume(ob, ob->collision_boundtype, ob_wire_col); - setlinestyle(0); - } - } if (ob->rigidbody_object) { draw_rigidbody_shape(ob, ob_wire_col); } @@ -9120,33 +8962,6 @@ afterdraw: } } - if ((dt <= OB_SOLID) && !render_override) { - if (((ob->gameflag & OB_DYNAMIC) && - ((ob->gameflag & OB_BOUNDS) == 0)) || - - ((ob->gameflag & OB_BOUNDS) && - (ob->collision_boundtype == OB_BOUND_SPHERE))) - { - float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f}; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - - invert_m4_m4(imat, rv3d->viewmatob); - - if ((dflag & DRAW_CONSTCOLOR) == 0) { - /* prevent random colors being used */ - immUniformColor3ubv(ob_wire_col); - } - - setlinestyle(2); - imm_drawcircball(vec, ob->inertia, imat, pos); - setlinestyle(0); - - immUnbindProgram(); - } - } - /* return warning, this is cached text draw */ invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 1); diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index dcdcf95bf86..807a4f212f6 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -990,12 +990,6 @@ static void draw_dupli_objects_color( /* Make sure lod is updated from dupli's position */ savedlod = dob->ob->currentlod; -#ifdef WITH_GAMEENGINE - if (rv3d->rflag & RV3D_IS_GAME_ENGINE) { - BKE_object_lod_update(dob->ob, rv3d->viewinv[3]); - } -#endif - /* extra service: draw the duplicator in drawtype of parent, minimum taken * to allow e.g. boundbox box objects in groups for LOD */ dt = tbase.object->dt; @@ -1467,9 +1461,7 @@ CustomDataMask ED_view3d_datamask(const Scene *scene, const View3D *v3d) mask |= CD_MASK_ORCO; } else { - if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) || - (drawtype == OB_MATERIAL)) - { + if (drawtype == OB_MATERIAL) { mask |= CD_MASK_ORCO; } } @@ -1925,19 +1917,6 @@ static void view3d_main_region_draw_engine_info(View3D *v3d, RegionView3D *rv3d, ED_region_info_draw(ar, rv3d->render_engine->text, fill_color, true); } -#ifdef WITH_GAMEENGINE -static void update_lods(Scene *scene, float camera_pos[3]) -{ - Scene *sce_iter; - Base *base; - - for (SETLOOPER(scene, sce_iter, base)) { - Object *ob = base->object; - BKE_object_lod_update(ob, camera_pos); - } -} -#endif - static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, const char **grid_unit) { @@ -1964,16 +1943,6 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL); } - rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; -#ifdef WITH_GAMEENGINE - if (STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME)) { - rv3d->rflag |= RV3D_IS_GAME_ENGINE; - - /* Make sure LoDs are up to date */ - update_lods(scene, rv3d->viewinv[3]); - } -#endif - /* main drawing call */ view3d_draw_objects(C, depsgraph, scene, v3d, ar, grid_unit, true, false); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4b005185638..64927ff55c7 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -251,8 +251,6 @@ void VIEW3D_OT_smoothview(struct wmOperatorType *ot); void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot); void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot); void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot); -void VIEW3D_OT_game_start(struct wmOperatorType *ot); - bool ED_view3d_boundbox_clip_ex(const RegionView3D *rv3d, const struct BoundBox *bb, float obmat[4][4]); bool ED_view3d_boundbox_clip(RegionView3D *rv3d, const struct BoundBox *bb); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 8e6f5228b09..0274ddd82fc 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -203,7 +203,6 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_camera_to_view); WM_operatortype_append(VIEW3D_OT_camera_to_view_selected); WM_operatortype_append(VIEW3D_OT_object_as_camera); - WM_operatortype_append(VIEW3D_OT_game_start); WM_operatortype_append(VIEW3D_OT_fly); WM_operatortype_append(VIEW3D_OT_walk); WM_operatortype_append(VIEW3D_OT_navigate); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 1d44f3d3fd5..b6ea68c8fe4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -64,15 +64,6 @@ #include "DEG_depsgraph_query.h" -#ifdef WITH_GAMEENGINE -# include "BLI_listbase.h" -# include "BLI_callbacks.h" - -# include "GPU_draw.h" - -# include "BL_System.h" -#endif - #include "view3d_intern.h" /* own include */ /* -------------------------------------------------------------------- */ @@ -1090,213 +1081,3 @@ int ED_view3d_view_layer_set(int lay, const int *values, int *active) } /** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Game Engine Operator - * - * Start the game engine (handles context switching). - * \{ */ - -#ifdef WITH_GAMEENGINE - -static ListBase queue_back; -static void game_engine_save_state(bContext *C, wmWindow *win) -{ - Object *obact = CTX_data_active_object(C); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - - if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - GPU_paint_set_mipmap(1); - } - - queue_back = win->queue; - - BLI_listbase_clear(&win->queue); -} - -static void game_engine_restore_state(bContext *C, wmWindow *win) -{ - Object *obact = CTX_data_active_object(C); - - if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - GPU_paint_set_mipmap(0); - } - /* check because closing win can set to NULL */ - if (win) { - win->queue = queue_back; - } - - GPU_state_init(); - - glPopAttrib(); -} - -/* was space_set_commmandline_options in 2.4x */ -static void game_set_commmandline_options(GameData *gm) -{ - SYS_SystemHandle syshandle; - int test; - - if ((syshandle = SYS_GetSystem())) { - /* User defined settings */ - test = (U.gameflags & USER_DISABLE_MIPMAP); - GPU_set_mipmap(!test); - SYS_WriteCommandLineInt(syshandle, "nomipmap", test); - - /* File specific settings: */ - /* Only test the first one. These two are switched - * simultaneously. */ - test = (gm->flag & GAME_SHOW_FRAMERATE); - SYS_WriteCommandLineInt(syshandle, "show_framerate", test); - SYS_WriteCommandLineInt(syshandle, "show_profile", test); - - test = (gm->flag & GAME_SHOW_DEBUG_PROPS); - SYS_WriteCommandLineInt(syshandle, "show_properties", test); - - test = (gm->flag & GAME_SHOW_PHYSICS); - SYS_WriteCommandLineInt(syshandle, "show_physics", test); - - test = (gm->flag & GAME_ENABLE_ALL_FRAMES); - SYS_WriteCommandLineInt(syshandle, "fixedtime", test); - - test = (gm->flag & GAME_ENABLE_ANIMATION_RECORD); - SYS_WriteCommandLineInt(syshandle, "animation_record", test); - - test = (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS); - SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test); - - test = (gm->matmode == GAME_MAT_MULTITEX); - SYS_WriteCommandLineInt(syshandle, "blender_material", test); - test = (gm->matmode == GAME_MAT_GLSL); - SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test); - } -} - -#endif /* WITH_GAMEENGINE */ - -static int game_engine_poll(bContext *C) -{ - const wmWindow *win = CTX_wm_window(C); - const Scene *scene = WM_window_get_active_scene(win); - - /* 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 (win == NULL) return 0; - if (CTX_wm_screen(C) == NULL) return 0; - - if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT) - return 0; - - if (!BKE_scene_uses_blender_game(scene)) - return 0; - - return 1; -} - -static int game_engine_exec(bContext *C, wmOperator *op) -{ -#ifdef WITH_GAMEENGINE - Scene *startscene = CTX_data_scene(C); - Main *bmain = CTX_data_main(C); - ScrArea /* *sa, */ /* UNUSED */ *prevsa = CTX_wm_area(C); - ARegion *ar, *prevar = CTX_wm_region(C); - wmWindow *prevwin = CTX_wm_window(C); - RegionView3D *rv3d; - rcti cam_frame; - - UNUSED_VARS(op); - - /* bad context switch .. */ - if (!ED_view3d_context_activate(C)) - return OPERATOR_CANCELLED; - - /* redraw to hide any menus/popups, we don't go back to - * the window manager until after this operator exits */ - WM_redraw_windows(C); - - BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_PRE); - - rv3d = CTX_wm_region_view3d(C); - /* sa = CTX_wm_area(C); */ /* UNUSED */ - ar = CTX_wm_region(C); - - view3d_operator_needs_opengl(C); - - game_set_commmandline_options(&startscene->gm); - - if ((rv3d->persp == RV3D_CAMOB) && - (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) && - (startscene->gm.stereoflag != STEREO_DOME)) - { - Depsgraph *depsgraph = CTX_data_depsgraph(C); - /* Letterbox */ - rctf cam_framef; - ED_view3d_calc_camera_border(startscene, depsgraph, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false); - cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; - cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; - cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; - cam_frame.ymax = cam_framef.ymax + ar->winrct.ymin; - BLI_rcti_isect(&ar->winrct, &cam_frame, &cam_frame); - } - else { - cam_frame.xmin = ar->winrct.xmin; - cam_frame.xmax = ar->winrct.xmax; - cam_frame.ymin = ar->winrct.ymin; - cam_frame.ymax = ar->winrct.ymax; - } - - - game_engine_save_state(C, prevwin); - - StartKetsjiShell(C, ar, &cam_frame, 1); - - /* window wasnt closed while the BGE was running */ - if (BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) { - prevwin = NULL; - CTX_wm_window_set(C, NULL); - } - - ED_area_tag_redraw(CTX_wm_area(C)); - - if (prevwin) { - /* restore context, in case it changed in the meantime, for - * example by working in another window or closing it */ - CTX_wm_region_set(C, prevar); - CTX_wm_window_set(C, prevwin); - CTX_wm_area_set(C, prevsa); - } - - game_engine_restore_state(C, prevwin); - - //XXX restore_all_scene_cfra(scene_cfra_store); - BKE_scene_set_background(CTX_data_main(C), startscene); - //XXX BKE_scene_graph_update_for_newframe(depsgraph, bmain); - - BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST); - - return OPERATOR_FINISHED; -#else - UNUSED_VARS(C); - BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build"); - return OPERATOR_CANCELLED; -#endif -} - -void VIEW3D_OT_game_start(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Start Game Engine"; - ot->description = "Start game engine"; - ot->idname = "VIEW3D_OT_game_start"; - - /* api callbacks */ - ot->exec = game_engine_exec; - - ot->poll = game_engine_poll; -} - -/** \} */ -- cgit v1.2.3