diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-11-22 14:04:37 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-12-01 14:44:32 +0300 |
commit | 02ab4ad991906f817698d3810c3d464cfaedcaff (patch) | |
tree | 1ce39dfc6dc73a16d8912b437bd816d6f01f9620 /source/blender/modifiers/intern/MOD_util.c | |
parent | fd224048375bf7a9d970c226b7ac843458d5428e (diff) |
Fix T92561: unstable particle distribution with Alembic files
When enabling or disabling a Mesh Sequence Cache modifier of an Object
with a hair particle system, the hair would switch positions. This is
caused because original coordinates in Blender are expected to be
normalized, and toggling the modifier would cause the usage of different
orco layers: one that is normalized, and the other which isn't.
This bug exposes a few related issues:
- if the Alembic file did not have orco data,
`MOD_deform_mesh_eval_get`, used by the particle system modifier, would
add an orco layer without normalization
- `MOD_deform_mesh_eval_get` would also ignore the presence of an orco
layer (e.g. one that could have been read from Alembic)
- if the Alembic file did have orco data, the data would be read
unnormalized
To fix those various issues, original coordinates are normalized when
read from Alembic and unnormalized when written to Alembic; and a new
utility function `BKE_mesh_orco_ensure` is added to add a normalized
orco layer if none exists on the mesh already, this function derives
from the code used in the particle system.
Reviewed By: brecht
Maniphest Tasks: T92561
Differential Revision: https://developer.blender.org/D13306
Diffstat (limited to 'source/blender/modifiers/intern/MOD_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index d57e92b4b35..194e7ac2a68 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -219,8 +219,7 @@ Mesh *MOD_deform_mesh_eval_get(Object *ob, } if (use_orco) { - CustomData_add_layer( - &mesh->vdata, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob), mesh->totvert); + BKE_mesh_orco_ensure(ob, mesh); } } else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { |