Blender Git Loki

Git Commits -> Revision e03d538

Revision e03d538 by Sybren A. Stüvel (master)
August 5, 2020, 16:14 (GMT)
Fix T79127: crash on `scene.ray_cast()` with non-viewport view layer

The `rna_Scene_ray_cast()` function tried to find the current depsgraph. To
this end, it required the scene, the view layer, and bmain. Scene has a cache
of per-view-layer depsgraphs, to speed up switching between view layers. This
cache does not contain render depsgraphs, and evaluated view layers also don't
have a depsgraph here.

When a suitable depsgraph cannot be found, a new depsgraph is created. However,
this depsgraph is not evaluated, and has an unexpanded scene pointer with a
`NULL` `view_layer`. Using this then crashes Blender. Also, there was no way
for the code to get the render depsgraph.

The solution is to pass the depsgraph to the `ray_cast()` function, instead of
the view layer. This avoids the depsgraph lookup, and also works correctly when
rendering.

Some add-ons also need updating, which I'll do in the `addons`
repository soon.

Reviewed By: Sergey

Differential Revision: https://developer.blender.org/D8475

Commit Details:

Full Hash: e03d53874dac5fc24120dfad496ef008c5244b84
Parent Commit: fff12be
Lines Changed: +3, -6

1 Modified Path:

/source/blender/makesrna/intern/rna_scene_api.c (+3, -6) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021