diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-08 14:06:54 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-08 14:11:21 +0300 |
commit | 5d54f389496c45eed4b90746a2850d7ee6b36788 (patch) | |
tree | 589c51362e7ee78dd18b9f92262be86f0eac4348 /source/blender/modifiers | |
parent | c30480709999fc2796d616dc4ff44686d2fdfb67 (diff) |
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.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_nodes.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 51f9bedc0a9..9af2472f2c6 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1022,9 +1022,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) { |