Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-08-21 12:19:07 +0300
committerJulian Eisel <julian@blender.org>2020-08-21 12:31:15 +0300
commit7aeaf5da0eaf2310f9b984f953f9a3a2ea02883c (patch)
tree9a756863dc97170ae5d8a46a63e5a8a26306fec7 /source/blender/blenkernel/intern/scene.c
parent41d31e100d9d76aa8f20bd9fe8429122828dc7a9 (diff)
Fix crash when accessing `view_layer.depsgraph` through BPY
For the sanity checks to work we don't actually need to check other scenes. So this function can be simplified so that it does not require a `Main *`. Mistake in 5cc08510e0a6.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 1dc51c9ddae..9edd56c984f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1129,15 +1129,9 @@ int BKE_scene_base_iter_next(
return iter->phase;
}
-Scene *BKE_scene_find_from_view_layer(const Main *bmain, const ViewLayer *layer)
+bool BKE_scene_has_view_layer(const Scene *scene, const ViewLayer *layer)
{
- for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
- if (BLI_findindex(&scene->view_layers, layer) != -1) {
- return scene;
- }
- }
-
- return NULL;
+ return BLI_findindex(&scene->view_layers, layer) != -1;
}
Scene *BKE_scene_find_from_collection(const Main *bmain, const Collection *collection)
@@ -2255,9 +2249,11 @@ static Depsgraph **scene_get_depsgraph_p(Main *bmain,
const bool allocate_ghash_entry,
const bool allocate_depsgraph)
{
+ /* bmain may be NULL here! */
BLI_assert(scene != NULL);
BLI_assert(view_layer != NULL);
- BLI_assert(BKE_scene_find_from_view_layer(bmain, view_layer) == scene);
+ BLI_assert(BKE_scene_has_view_layer(scene, view_layer));
+
/* Make sure hash itself exists. */
if (allocate_ghash_entry) {
BKE_scene_ensure_depsgraph_hash(scene);