diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-09 15:49:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-11 11:43:27 +0300 |
commit | 73a199e96a68a5b9521ba7d3e8cca85697095c03 (patch) | |
tree | 53ddc33ae7e0ccfabc1d1566551f9ecfec2d9e75 /source/blender/blenkernel/intern | |
parent | 559df2fed9ad8e47b661aa79d033ab463ec3301e (diff) |
Depsgraph: Pass bmain to depsgraph object creation
Currently unused, but will allow to keep of an owner of the depsgraph.
Could also simplify other APIs in the future by avoiding to pass bmain
explicitly to relation update functions and things like that.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index bcf6bb338ff..7f2f04d7eb5 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1351,9 +1351,10 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list) Depsgraph *CTX_data_depsgraph_pointer(const bContext *C) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); /* Dependency graph might have been just allocated, and hence it will not be marked. * This confuses redo system due to the lack of flushing changes back to the original data. * In the future we would need to check whether the CTX_wm_window(C) is in editing mode (as an @@ -1381,7 +1382,8 @@ Depsgraph *CTX_data_ensure_evaluated_depsgraph(const bContext *C) Depsgraph *CTX_data_depsgraph_on_load(const bContext *C) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - return BKE_scene_get_depsgraph(scene, view_layer, false); + return BKE_scene_get_depsgraph(bmain, scene, view_layer, false); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index dbb39184b1e..aa812dff877 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1408,7 +1408,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain) */ void BKE_scene_view_layer_graph_evaluated_ensure(Main *bmain, Scene *scene, ViewLayer *view_layer) { - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); DEG_make_active(depsgraph); BKE_scene_graph_update_tagged(depsgraph, bmain); } @@ -2040,7 +2040,7 @@ void BKE_scene_free_depsgraph_hash(Scene *scene) /* Query depsgraph for a specific contexts. */ -Depsgraph *BKE_scene_get_depsgraph(Scene *scene, ViewLayer *view_layer, bool allocate) +Depsgraph *BKE_scene_get_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, bool allocate) { BLI_assert(scene != NULL); BLI_assert(view_layer != NULL); @@ -2064,7 +2064,7 @@ Depsgraph *BKE_scene_get_depsgraph(Scene *scene, ViewLayer *view_layer, bool all scene->depsgraph_hash, &key, (void ***)&key_ptr, (void ***)&depsgraph_ptr)) { *key_ptr = MEM_mallocN(sizeof(DepsgraphKey), __func__); **key_ptr = key; - *depsgraph_ptr = DEG_graph_new(scene, view_layer, DAG_EVAL_VIEWPORT); + *depsgraph_ptr = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_VIEWPORT); /* TODO(sergey): Would be cool to avoid string format print, * but is a bit tricky because we can't know in advance whether * we will ever enable debug messages for this depsgraph. diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b29e07bb56d..dca6f05e0de 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3534,7 +3534,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, } /* opengl offscreen render */ - depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + depsgraph = BKE_scene_get_depsgraph(context->bmain, scene, view_layer, true); BKE_scene_graph_update_for_newframe(depsgraph, context->bmain); ibuf = sequencer_view3d_cb( /* set for OpenGL render (NULL when scrubbing) */ |