diff options
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index e2032e10833..e7a26afadf5 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -147,6 +147,9 @@ void BKE_scene_graph_update_tagged(struct Depsgraph *depsgraph, void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph, struct Main *bmain); +void BKE_scene_view_layer_graph_evaluated_ensure( + struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer); + struct SceneRenderView *BKE_scene_add_render_view(struct Scene *sce, const char *name); bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *srv); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ba25fc14ac9..8522c7f4445 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1477,6 +1477,18 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, DEG_ids_clear_recalc(bmain, depsgraph); } +/** Ensures given scene/view_layer pair has a valid, up-to-date depsgraph. + * + * \warning Sets matching depsgraph as active, so should only be called from the active editing context + * (usually, from operators). + */ +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); + DEG_make_active(depsgraph); + BKE_scene_graph_update_tagged(depsgraph, bmain); +} + /* return default view */ SceneRenderView *BKE_scene_add_render_view(Scene *sce, const char *name) { |