diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index ef99d39f990..5fc7979a631 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4200,6 +4200,7 @@ static int match_region_with_redraws(int spacetype, static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); + wmWindow *win = CTX_wm_window(C); #ifdef PROFILE_AUDIO_SYNCH static int old_frame = 0; @@ -4209,8 +4210,9 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv if (screen->animtimer && screen->animtimer == event->customdata) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); - Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false); + Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL; wmTimer *wt = screen->animtimer; ScreenAnimData *sad = wt->customdata; wmWindowManager *wm = CTX_wm_manager(C); @@ -4230,7 +4232,11 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv sync = (scene->flag & SCE_FRAME_DROP); } - if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { + if (scene_eval == NULL) { + /* Happens when undo/redo system is used during playback, nothing meaningful we can do here. + */ + } + else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { /* Ignore seek here, the audio will be updated to the scene frame after jump during next * dependency graph update. */ } @@ -4335,7 +4341,9 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv } /* since we follow drawflags, we can't send notifier but tag regions ourselves */ - ED_update_for_newframe(bmain, depsgraph); + if (depsgraph != NULL) { + ED_update_for_newframe(bmain, depsgraph); + } for (window = wm->windows.first; window; window = window->next) { const bScreen *win_screen = WM_window_get_active_screen(window);