Fix T93090: crash with data transfer modifier and geometry nodes
There was a missing normals layer that was requested by the data transfer modifier from the target object. The normal layer was correctly added to the target object. However, it never reached the data transfer modifier because the mesh was copied in `BKE_object_get_evaluated_mesh` (in the call to `get_mesh_for_write`) and the copy does not include the normals layer. The solution is to not use `get_mesh_for_write` here which was only used because `BKE_object_get_evaluated_mesh` returns a non-const `Mesh *`. Mid term, it should actually return a `const Mesh *` to avoid the confusion. Differential Revision: https://developer.blender.org/D13319
This commit is contained in:
parent
f749506163
commit
6987060f70
Notes:
blender-bot
2023-02-14 05:53:42 +01:00
Referenced by issue #93090, Blender 3.0 splash screen render crash with data transfer modifier and geometry nodes
|
@ -4564,10 +4564,11 @@ Mesh *BKE_object_get_evaluated_mesh(const Object *object)
|
|||
* object types either store it there or add a reference to it if it's owned elsewhere. */
|
||||
GeometrySet *geometry_set_eval = object->runtime.geometry_set_eval;
|
||||
if (geometry_set_eval) {
|
||||
/* Some areas expect to be able to modify the evaluated mesh. Theoretically this should be
|
||||
* avoided, or at least protected with a lock, so a const mesh could be returned from this
|
||||
* function. */
|
||||
Mesh *mesh = geometry_set_eval->get_mesh_for_write();
|
||||
/* Some areas expect to be able to modify the evaluated mesh in limited ways. Theoretically
|
||||
* this should be avoided, or at least protected with a lock, so a const mesh could be returned
|
||||
* from this function. We use a const_cast instead of #get_mesh_for_write, because that might
|
||||
* result in a copy of the mesh when it is shared. */
|
||||
Mesh *mesh = const_cast<Mesh *>(geometry_set_eval->get_mesh_for_read());
|
||||
if (mesh) {
|
||||
return mesh;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue