diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-20 11:28:52 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-20 11:28:52 +0300 |
commit | a4c907af7760a980c09e46feed92bd93a0906ba9 (patch) | |
tree | 5cf521767645f1dfdeaf8a1d58a5e8987c7b0b94 | |
parent | 5dcabc4d5795522c145da5116d8aeac2db7ac8a6 (diff) |
Fix T65806: Can't Access bpy.context inside Application Timer
Sound synchronization was messing a bit with the context, for, actually,
no reason.
Use more direct queries rather than relying on a context there.
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index f20bc6b11fe..a95ccd65dff 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3230,14 +3230,11 @@ void wm_event_do_handlers(bContext *C) } else { Scene *scene = WM_window_get_active_scene(win); + 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; - CTX_wm_window_set(C, win); - CTX_data_scene_set(C, scene); - - Depsgraph *depsgraph = CTX_data_depsgraph(C); - Scene *scene_eval = DEG_get_evaluated_scene_if_exists(depsgraph); - - if (scene_eval) { + if (scene_eval != NULL) { const int is_playing_sound = BKE_sound_scene_playing(scene_eval); if (is_playing_sound != -1) { @@ -3263,10 +3260,6 @@ void wm_event_do_handlers(bContext *C) } } } - - CTX_data_scene_set(C, NULL); - CTX_wm_screen_set(C, NULL); - CTX_wm_window_set(C, NULL); } while ((event = win->queue.first)) { |