Fix: instances are made real when they shouldn't be

The original assumption that the `modifyMesh` function is only
called when the modifier is applied was wrong. There are still a
couple of other places calling it through `BKE_modifier_modify_mesh`.

Now there is an extra check that makes sure instances are only
realized when the modifier is actually applied.
This commit is contained in:
Jacques Lucke 2021-07-08 13:06:54 +02:00 committed by Jeroen Bakker
parent 3fa1de6ad6
commit ab572f3ac1
Notes: blender-bot 2023-02-14 02:27:51 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
1 changed files with 5 additions and 3 deletions

View File

@ -1420,9 +1420,11 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
*ctx->object);
modifyGeometry(md, ctx, geometry_set);
/* This function is only called when applying modifiers. In this case it makes sense to realize
* instances, otherwise in some cases there might be no results when applying the modifier. */
geometry_set = blender::bke::geometry_set_realize_mesh_for_modifier(geometry_set);
if (ctx->flag & MOD_APPLY_TO_BASE_MESH) {
/* In this case it makes sense to realize instances, otherwise in some cases there might be no
* results when applying the modifier. */
geometry_set = blender::bke::geometry_set_realize_mesh_for_modifier(geometry_set);
}
Mesh *new_mesh = geometry_set.get_component_for_write<MeshComponent>().release();
if (new_mesh == nullptr) {