Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_view3d / view3d_view.c
index 7dfc465286df89b6e72c12871b7804c7221c7764..acc6d7184ff71156360bf6dfdb62ed580050b8f3 100644 (file)
 #include "BKE_action.h"
 #include "BKE_camera.h"
 #include "BKE_context.h"
-#include "BKE_depsgraph.h"
 #include "BKE_object.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
 
-#include "BIF_gl.h"
+#include "DEG_depsgraph.h"
+
 
 #include "UI_resources.h"
 
+#include "GPU_glew.h"
 #include "GPU_select.h"
+#include "GPU_matrix.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
 #include "ED_screen.h"
 
+#include "DRW_engine.h"
+
+#include "DEG_depsgraph_query.h"
+
 #ifdef WITH_GAMEENGINE
 #  include "BLI_listbase.h"
 #  include "BLI_callbacks.h"
@@ -68,6 +74,7 @@
 #  include "BL_System.h"
 #endif
 
+
 #include "view3d_intern.h"  /* own include */
 
 /* use this call when executing an operator,
@@ -91,10 +98,8 @@ void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
                RegionView3D *rv3d = ar->regiondata;
                
                wmSubWindowSet(win, ar->swinid);
-               glMatrixMode(GL_PROJECTION);
-               glLoadMatrixf(rv3d->winmat);
-               glMatrixMode(GL_MODELVIEW);
-               glLoadMatrixf(rv3d->viewmat);
+               gpuLoadProjectionMatrix(rv3d->winmat);
+               gpuLoadMatrix(rv3d->viewmat);
        }
 }
 
@@ -421,6 +426,9 @@ void ED_view3d_smooth_view_force_finish(
         View3D *v3d, ARegion *ar)
 {
        RegionView3D *rv3d = ar->regiondata;
+       EvaluationContext eval_ctx;
+
+       CTX_data_eval_ctx(C, &eval_ctx);
 
        if (rv3d && rv3d->sms) {
                rv3d->sms->time_allowed = 0.0;  /* force finishing */
@@ -429,7 +437,7 @@ void ED_view3d_smooth_view_force_finish(
                /* force update of view matrix so tools that run immediately after
                 * can use them without redrawing first */
                Scene *scene = CTX_data_scene(C);
-               ED_view3d_update_viewmat(scene, v3d, ar, NULL, NULL, NULL);
+               ED_view3d_update_viewmat(&eval_ctx, scene, v3d, ar, NULL, NULL, NULL);
        }
 }
 
@@ -471,7 +479,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
 
        BKE_object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag);
 
-       DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
+       DEG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
        rv3d->persp = RV3D_CAMOB;
        
        WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, v3d->camera);
@@ -519,6 +527,7 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
 static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
+       ViewLayer *view_layer = CTX_data_view_layer(C);
        View3D *v3d = CTX_wm_view3d(C);  /* can be NULL */
        Object *camera_ob = v3d ? v3d->camera : scene->camera;
 
@@ -531,7 +540,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
        }
 
        /* this function does all the important stuff */
-       if (BKE_camera_view_frame_fit_to_scene(scene, v3d, camera_ob, r_co, &r_scale)) {
+       if (BKE_camera_view_frame_fit_to_scene(scene, view_layer, camera_ob, r_co, &r_scale)) {
                ObjectTfmProtectedChannels obtfm;
                float obmat_new[4][4];
 
@@ -548,7 +557,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
                BKE_object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D);
 
                /* notifiers */
-               DAG_id_tag_update(&camera_ob->id, OB_RECALC_OB);
+               DEG_id_tag_update(&camera_ob->id, OB_RECALC_OB);
                WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, camera_ob);
                return OPERATOR_FINISHED;
        }
@@ -694,14 +703,14 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
 /**
  * \param rect optional for picking (can be NULL).
  */
-void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rcti *rect)
+void view3d_winmatrix_set(const Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect)
 {
        RegionView3D *rv3d = ar->regiondata;
        rctf viewplane;
        float clipsta, clipend;
        bool is_ortho;
        
-       is_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
+       is_ortho = ED_view3d_viewplane_get(depsgraph, v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
        rv3d->is_persp = !is_ortho;
 
 #if 0
@@ -720,14 +729,14 @@ void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rcti *rect)
        }
 
        if (is_ortho) {
-               wmOrtho(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+               gpuOrtho(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
        }
        else {
-               wmFrustum(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+               gpuFrustum(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
        }
 
        /* update matrix in 3d view region */
-       glGetFloatv(GL_PROJECTION_MATRIX, (float *)rv3d->winmat);
+       gpuGetProjectionMatrix(rv3d->winmat);
 }
 
 static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
@@ -746,6 +755,7 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
 /**
  * Sets #RegionView3D.viewmat
  *
+ * \param eval_ctx: Context.
  * \param scene: Scene for camera and cursor location.
  * \param v3d: View 3D space data.
  * \param rv3d: 3D region which stores the final matrices.
@@ -755,13 +765,15 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
  * \note don't set windows active in here, is used by renderwin too.
  */
 void view3d_viewmatrix_set(
-        Scene *scene,
+        const EvaluationContext *eval_ctx, Scene *scene,
         const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2])
 {
        if (rv3d->persp == RV3D_CAMOB) {      /* obs/camera */
                if (v3d->camera) {
-                       BKE_object_where_is_calc(scene, v3d->camera);
-                       obmat_to_viewmat(rv3d, v3d->camera);
+                       const Depsgraph *depsgraph = eval_ctx->depsgraph;
+                       Object *camera_object = DEG_get_evaluated_object(depsgraph, v3d->camera);
+                       BKE_object_where_is_calc(eval_ctx, scene, camera_object);
+                       obmat_to_viewmat(rv3d, camera_object);
                }
                else {
                        quat_to_mat4(rv3d->viewmat, rv3d->viewquat);
@@ -856,10 +868,11 @@ void view3d_opengl_select_cache_end(void)
  * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection.
  */
 int view3d_opengl_select(
-        ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input,
+        const EvaluationContext *eval_ctx, ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input,
         eV3DSelectMode select_mode)
 {
        struct bThemeState theme_state;
+       Depsgraph *graph = vc->depsgraph;
        Scene *scene = vc->scene;
        View3D *v3d = vc->v3d;
        ARegion *ar = vc->ar;
@@ -921,7 +934,7 @@ int view3d_opengl_select(
 
        /* Important we use the 'viewmat' and don't re-calculate since
         * the object & bone view locking takes 'rect' into account, see: T51629. */
-       ED_view3d_draw_setup_view(vc->win, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect);
+       ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect);
 
        if (v3d->drawtype > OB_WIRE) {
                v3d->zbuf = true;
@@ -933,7 +946,16 @@ int view3d_opengl_select(
        
        GPU_select_begin(buffer, bufsize, &rect, gpu_select_mode, 0);
 
-       ED_view3d_draw_select_loop(vc, scene, v3d, ar, use_obedit_skip, use_nearest);
+#ifdef WITH_OPENGL_LEGACY
+       if (IS_VIEWPORT_LEGACY(vc->v3d)) {
+               ED_view3d_draw_select_loop(vc, scene, sl, v3d, ar, use_obedit_skip, use_nearest);
+       }
+       else
+#else
+       {
+               DRW_draw_select_loop(graph, ar, v3d, use_obedit_skip, use_nearest, &rect);
+       }
+#endif /* WITH_OPENGL_LEGACY */
 
        hits = GPU_select_end();
        
@@ -941,13 +963,22 @@ int view3d_opengl_select(
        if (do_passes && (hits > 0)) {
                GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
 
-               ED_view3d_draw_select_loop(vc, scene, v3d, ar, use_obedit_skip, use_nearest);
+#ifdef WITH_OPENGL_LEGACY
+               if (IS_VIEWPORT_LEGACY(vc->v3d)) {
+                       ED_view3d_draw_select_loop(vc, scene, sl, v3d, ar, use_obedit_skip, use_nearest);
+               }
+               else
+#else
+               {
+                       DRW_draw_select_loop(graph, ar, v3d, use_obedit_skip, use_nearest, &rect);
+               }
+#endif /* WITH_OPENGL_LEGACY */
 
                GPU_select_end();
        }
 
        G.f &= ~G_PICKSEL;
-       ED_view3d_draw_setup_view(vc->win, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
+       ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
        
        if (v3d->drawtype > OB_WIRE) {
                v3d->zbuf = 0;
@@ -965,43 +996,7 @@ finally:
        return hits;
 }
 
-/* ********************** local view operator ******************** */
-
-static unsigned int free_localbit(Main *bmain)
-{
-       unsigned int lay;
-       ScrArea *sa;
-       bScreen *sc;
-       
-       lay = 0;
-       
-       /* sometimes we loose a localview: when an area is closed */
-       /* check all areas: which localviews are in use? */
-       for (sc = bmain->screen.first; sc; sc = sc->id.next) {
-               for (sa = sc->areabase.first; sa; sa = sa->next) {
-                       SpaceLink *sl = sa->spacedata.first;
-                       for (; sl; sl = sl->next) {
-                               if (sl->spacetype == SPACE_VIEW3D) {
-                                       View3D *v3d = (View3D *) sl;
-                                       lay |= v3d->lay;
-                               }
-                       }
-               }
-       }
-       
-       if ((lay & 0x01000000) == 0) return 0x01000000;
-       if ((lay & 0x02000000) == 0) return 0x02000000;
-       if ((lay & 0x04000000) == 0) return 0x04000000;
-       if ((lay & 0x08000000) == 0) return 0x08000000;
-       if ((lay & 0x10000000) == 0) return 0x10000000;
-       if ((lay & 0x20000000) == 0) return 0x20000000;
-       if ((lay & 0x40000000) == 0) return 0x40000000;
-       if ((lay & 0x80000000) == 0) return 0x80000000;
-       
-       return 0;
-}
-
-int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
+int ED_view3d_view_layer_set(int lay, const int *values, int *active)
 {
        int i, tot = 0;
        
@@ -1039,267 +1034,6 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
        return lay;
 }
 
-static bool view3d_localview_init(
-        wmWindowManager *wm, wmWindow *win,
-        Main *bmain, Scene *scene, ScrArea *sa, const int smooth_viewtx,
-        ReportList *reports)
-{
-       View3D *v3d = sa->spacedata.first;
-       Base *base;
-       float min[3], max[3], box[3], mid[3];
-       float size = 0.0f;
-       unsigned int locallay;
-       bool ok = false;
-
-       if (v3d->localvd) {
-               return ok;
-       }
-
-       INIT_MINMAX(min, max);
-
-       locallay = free_localbit(bmain);
-
-       if (locallay == 0) {
-               BKE_report(reports, RPT_ERROR, "No more than 8 local views");
-               ok = false;
-       }
-       else {
-               if (scene->obedit) {
-                       BKE_object_minmax(scene->obedit, min, max, false);
-                       
-                       ok = true;
-               
-                       BASACT->lay |= locallay;
-                       scene->obedit->lay = BASACT->lay;
-               }
-               else {
-                       for (base = FIRSTBASE; base; base = base->next) {
-                               if (TESTBASE(v3d, base)) {
-                                       BKE_object_minmax(base->object, min, max, false);
-                                       base->lay |= locallay;
-                                       base->object->lay = base->lay;
-                                       ok = true;
-                               }
-                       }
-               }
-
-               sub_v3_v3v3(box, max, min);
-               size = max_fff(box[0], box[1], box[2]);
-       }
-       
-       if (ok == true) {
-               ARegion *ar;
-               
-               v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
-               
-               memcpy(v3d->localvd, v3d, sizeof(View3D));
-
-               mid_v3_v3v3(mid, min, max);
-
-               copy_v3_v3(v3d->cursor, mid);
-
-               for (ar = sa->regionbase.first; ar; ar = ar->next) {
-                       if (ar->regiontype == RGN_TYPE_WINDOW) {
-                               RegionView3D *rv3d = ar->regiondata;
-                               bool ok_dist = true;
-
-                               /* new view values */
-                               Object *camera_old = NULL;
-                               float dist_new, ofs_new[3];
-
-                               rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
-                               memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
-
-                               negate_v3_v3(ofs_new, mid);
-
-                               if (rv3d->persp == RV3D_CAMOB) {
-                                       rv3d->persp = RV3D_PERSP;
-                                       camera_old = v3d->camera;
-                               }
-
-                               if (rv3d->persp == RV3D_ORTHO) {
-                                       if (size < 0.0001f) {
-                                               ok_dist = false;
-                                       }
-                               }
-
-                               if (ok_dist) {
-                                       dist_new = ED_view3d_radius_to_dist(v3d, ar, rv3d->persp, true, (size / 2) * VIEW3D_MARGIN);
-                                       if (rv3d->persp == RV3D_PERSP) {
-                                               /* don't zoom closer than the near clipping plane */
-                                               dist_new = max_ff(dist_new, v3d->near * 1.5f);
-                                       }
-                               }
-
-                               ED_view3d_smooth_view_ex(
-                                       wm, win, sa, v3d, ar, smooth_viewtx,
-                                           &(const V3D_SmoothParams) {
-                                               .camera_old = camera_old,
-                                               .ofs = ofs_new, .quat = rv3d->viewquat,
-                                               .dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens});
-                       }
-               }
-               
-               v3d->lay = locallay;
-       }
-       else {
-               /* clear flags */ 
-               for (base = FIRSTBASE; base; base = base->next) {
-                       if (base->lay & locallay) {
-                               base->lay -= locallay;
-                               if (base->lay == 0) base->lay = v3d->layact;
-                               if (base->object != scene->obedit) base->flag |= SELECT;
-                               base->object->lay = base->lay;
-                       }
-               }
-       }
-
-       DAG_on_visible_update(bmain, false);
-
-       return ok;
-}
-
-static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmain, Scene *scene, ScrArea *sa, const int smooth_viewtx)
-{
-       const bool free = true;
-       ARegion *ar;
-       View3D *v3d = sa->spacedata.first;
-       Object *camera_old, *camera_new;
-       
-       if (v3d->localvd == NULL) return;
-       
-       camera_old = v3d->camera;
-       camera_new = v3d->localvd->camera;
-
-       v3d->lay = v3d->localvd->lay;
-       v3d->layact = v3d->localvd->layact;
-       v3d->drawtype = v3d->localvd->drawtype;
-       v3d->camera = v3d->localvd->camera;
-       
-       if (free) {
-               MEM_freeN(v3d->localvd);
-               v3d->localvd = NULL;
-       }
-       
-       for (ar = sa->regionbase.first; ar; ar = ar->next) {
-               if (ar->regiontype == RGN_TYPE_WINDOW) {
-                       RegionView3D *rv3d = ar->regiondata;
-                       
-                       if (rv3d->localvd) {
-                               Object *camera_old_rv3d, *camera_new_rv3d;
-
-                               camera_old_rv3d = (rv3d->persp          == RV3D_CAMOB) ? camera_old : NULL;
-                               camera_new_rv3d = (rv3d->localvd->persp == RV3D_CAMOB) ? camera_new : NULL;
-
-                               rv3d->view = rv3d->localvd->view;
-                               rv3d->persp = rv3d->localvd->persp;
-                               rv3d->camzoom = rv3d->localvd->camzoom;
-
-                               ED_view3d_smooth_view_ex(
-                                       wm, win, sa,
-                                       v3d, ar, smooth_viewtx,
-                                       &(const V3D_SmoothParams) {
-                                           .camera_old = camera_old_rv3d, .camera = camera_new_rv3d,
-                                           .ofs = rv3d->localvd->ofs, .quat = rv3d->localvd->viewquat,
-                                           .dist = &rv3d->localvd->dist});
-
-                               if (free) {
-                                       MEM_freeN(rv3d->localvd);
-                                       rv3d->localvd = NULL;
-                               }
-                       }
-
-                       ED_view3d_shade_update(bmain, scene, v3d, sa);
-               }
-       }
-}
-
-static bool view3d_localview_exit(
-        wmWindowManager *wm, wmWindow *win,
-        Main *bmain, Scene *scene, ScrArea *sa, const int smooth_viewtx)
-{
-       View3D *v3d = sa->spacedata.first;
-       struct Base *base;
-       unsigned int locallay;
-       
-       if (v3d->localvd) {
-               
-               locallay = v3d->lay & 0xFF000000;
-
-               restore_localviewdata(wm, win, bmain, scene, sa, smooth_viewtx);
-
-               /* for when in other window the layers have changed */
-               if (v3d->scenelock) v3d->lay = scene->lay;
-               
-               for (base = FIRSTBASE; base; base = base->next) {
-                       if (base->lay & locallay) {
-                               base->lay -= locallay;
-                               if (base->lay == 0) base->lay = v3d->layact;
-                               if (base->object != scene->obedit) {
-                                       base->flag |= SELECT;
-                                       base->object->flag |= SELECT;
-                               }
-                               base->object->lay = base->lay;
-                       }
-               }
-               
-               DAG_on_visible_update(bmain, false);
-
-               return true;
-       }
-       else {
-               return false;
-       }
-}
-
-static int localview_exec(bContext *C, wmOperator *op)
-{
-       const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
-       wmWindowManager *wm = CTX_wm_manager(C);
-       wmWindow *win = CTX_wm_window(C);
-       Main *bmain = CTX_data_main(C);
-       Scene *scene = CTX_data_scene(C);
-       ScrArea *sa = CTX_wm_area(C);
-       View3D *v3d = CTX_wm_view3d(C);
-       bool changed;
-       
-       if (v3d->localvd) {
-               changed = view3d_localview_exit(wm, win, bmain, scene, sa, smooth_viewtx);
-       }
-       else {
-               changed = view3d_localview_init(wm, win, bmain, scene, sa, smooth_viewtx, op->reports);
-       }
-
-       if (changed) {
-               DAG_id_type_tag(bmain, ID_OB);
-               ED_area_tag_redraw(sa);
-
-               /* unselected objects become selected when exiting */
-               if (v3d->localvd == NULL) {
-                       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
-               }
-
-               return OPERATOR_FINISHED;
-       }
-       else {
-               return OPERATOR_CANCELLED;
-       }
-}
-
-void VIEW3D_OT_localview(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Local View";
-       ot->description = "Toggle display of selected object(s) separately and centered in view";
-       ot->idname = "VIEW3D_OT_localview";
-       
-       /* api callbacks */
-       ot->exec = localview_exec;
-       ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
-       
-       ot->poll = ED_operator_view3d_active;
-}
-
 #ifdef WITH_GAMEENGINE
 
 static ListBase queue_back;
@@ -1338,7 +1072,6 @@ static void RestoreState(bContext *C, wmWindow *win)
                win->queue = queue_back;
        
        GPU_state_init();
-       GPU_set_tpage(NULL, 0, 0);
 
        glPopAttrib();
 }
@@ -1381,10 +1114,6 @@ static void game_set_commmandline_options(GameData *gm)
                SYS_WriteCommandLineInt(syshandle, "blender_material", test);
                test = (gm->matmode == GAME_MAT_GLSL);
                SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test);
-               test = (gm->flag & GAME_DISPLAY_LISTS);
-               SYS_WriteCommandLineInt(syshandle, "displaylists", test);
-
-
        }
 }
 
@@ -1392,19 +1121,21 @@ static void game_set_commmandline_options(GameData *gm)
 
 static int game_engine_poll(bContext *C)
 {
-       bScreen *screen;
+       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 (CTX_wm_window(C) == NULL) return 0;
-       if ((screen = CTX_wm_screen(C)) == NULL) return 0;
+       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(screen->scene))
+       if (!BKE_scene_uses_blender_game(scene))
                return 0;
 
        return 1;
@@ -1445,9 +1176,10 @@ static int game_engine_exec(bContext *C, wmOperator *op)
            (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
            (startscene->gm.stereoflag != STEREO_DOME))
        {
+               const Depsgraph *depsgraph = CTX_data_depsgraph(C);
                /* Letterbox */
                rctf cam_framef;
-               ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false);
+               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;
@@ -1486,7 +1218,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
 
        //XXX restore_all_scene_cfra(scene_cfra_store);
        BKE_scene_set_background(CTX_data_main(C), startscene);
-       //XXX BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay);
+       //XXX BKE_scene_graph_update_for_newframe(bmain->eval_ctx, bmain, scene, depsgraph);
 
        BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST);