diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-08-21 12:56:03 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-08-21 13:23:13 +0300 |
commit | 3bc09c1c1ec9c1699ac872bc643d3e38c250803f (patch) | |
tree | d9812280b0bf6e7f9b835d2e670063a26a9d4ffd /source/blender/windowmanager/intern | |
parent | e7767ba6be99a85349975b8da37b8cb8b9a3d6a9 (diff) |
Cleanup: split `BKE_scene_get_depsgraph()` into two functions
Split the depsgraph allocation into a separate function
`BKE_scene_ensure_depsgraph()`. Parameters are only passed to those
functions that actually need them. This removes the the "if that boolean
is `false` this pointer is allowed to be `NULL`" logic and more cleanly
decouples code.
No functional changes.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 6f3fbf77987..ad08a085cf4 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -910,7 +910,7 @@ static bool wm_draw_update_test_window(Main *bmain, bContext *C, wmWindow *win) const wmWindowManager *wm = CTX_wm_manager(C); Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); + struct Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer); bScreen *screen = WM_window_get_active_screen(win); ARegion *region; bool do_draw = false; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c363fdcc9d4..c72c9ce906b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -350,7 +350,7 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file) * and for until then we have to accept ambiguities when object is shared * across visible view layers and has overrides on it. */ - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); + Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer); if (is_after_open_file) { DEG_graph_relations_update(depsgraph); DEG_graph_on_visible_update(bmain, depsgraph, true); @@ -3189,10 +3189,9 @@ void wm_event_do_handlers(bContext *C) wm_event_free_all(win); } else { - Main *bmain = CTX_data_main(C); Scene *scene = WM_window_get_active_scene(win); ViewLayer *view_layer = WM_window_get_active_view_layer(win); - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer); Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL; if (scene_eval != NULL) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index e8f663b0c4a..b85bf8cb323 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -210,7 +210,7 @@ static void sound_jack_sync_callback(Main *bmain, int mode, double time) continue; } ViewLayer *view_layer = WM_window_get_active_view_layer(window); - Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, false); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer); if (depsgraph == NULL) { continue; } |