Cleanup: accept const pointer for BKE_scene_get_depsgraph

This commit is contained in:
Brecht Van Lommel 2021-01-29 15:48:14 +01:00
parent cacc1d723c
commit 087777f2b9
Notes: blender-bot 2023-02-14 10:21:11 +01:00
Referenced by commit 30ac21bf33, Fix regression: Crash garbage collecting VBOs on never evaluated scenes
Referenced by issue #85291, Crash editing properties
2 changed files with 8 additions and 4 deletions

View File

@ -223,7 +223,8 @@ void BKE_scene_free_depsgraph_hash(struct Scene *scene);
void BKE_scene_free_view_layer_depsgraph(struct Scene *scene, struct ViewLayer *view_layer);
/* Do not allocate new depsgraph. */
struct Depsgraph *BKE_scene_get_depsgraph(struct Scene *scene, struct ViewLayer *view_layer);
struct Depsgraph *BKE_scene_get_depsgraph(const struct Scene *scene,
const struct ViewLayer *view_layer);
/* Allocate new depsgraph if necessary. */
struct Depsgraph *BKE_scene_ensure_depsgraph(struct Main *bmain,
struct Scene *scene,

View File

@ -3436,10 +3436,13 @@ static Depsgraph **scene_ensure_depsgraph_p(Main *bmain, Scene *scene, ViewLayer
return depsgraph_ptr;
}
Depsgraph *BKE_scene_get_depsgraph(Scene *scene, ViewLayer *view_layer)
Depsgraph *BKE_scene_get_depsgraph(const Scene *scene, const ViewLayer *view_layer)
{
Depsgraph **depsgraph_ptr = scene_get_depsgraph_p(scene, view_layer, false);
return (depsgraph_ptr != NULL) ? *depsgraph_ptr : NULL;
BLI_assert(BKE_scene_has_view_layer(scene, view_layer));
DepsgraphKey key;
key.view_layer = view_layer;
return BLI_ghash_lookup(scene->depsgraph_hash, &key);
}
Depsgraph *BKE_scene_ensure_depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer)