Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-03-22 17:43:02 +0300
committerHans Goudey <h.goudey@me.com>2022-03-22 17:43:02 +0300
commitb0aaf6ff4a9731e9142d8cf32ebcc1a01a4f5cc8 (patch)
treeffef5c81a4fca262db965726149aabfdf1381767 /source/blender/blenkernel/intern/object.cc
parent1c790555a02bfc37580465525234c68e9f09caab (diff)
Fix T96294: Crash and error with shape key normal calculation
A mistake in the mesh normal refactor caused the wrong mesh to be used when calculating normals with a shape key's deformation. This commit fixes the normal calculation by using the correct mesh, with just adjusted vertex positions, and calculating the results directly into the result arrays when possible. This completely avoids the need to make a local copy of the mesh, which makes sense, since the only thing that changes is the vertex positions. Differential Revision: https://developer.blender.org/D14317
Diffstat (limited to 'source/blender/blenkernel/intern/object.cc')
-rw-r--r--source/blender/blenkernel/intern/object.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc
index 985c9edac1a..1e3b5d77fa7 100644
--- a/source/blender/blenkernel/intern/object.cc
+++ b/source/blender/blenkernel/intern/object.cc
@@ -4630,9 +4630,11 @@ bool BKE_object_shapekey_remove(Main *bmain, Object *ob, KeyBlock *kb)
if (key->refkey) {
/* apply new basis key on original data */
switch (ob->type) {
- case OB_MESH:
- BKE_keyblock_convert_to_mesh(key->refkey, (Mesh *)ob->data);
+ case OB_MESH: {
+ Mesh *mesh = (Mesh *)ob->data;
+ BKE_keyblock_convert_to_mesh(key->refkey, mesh->mvert, mesh->totvert);
break;
+ }
case OB_CURVES_LEGACY:
case OB_SURF:
BKE_keyblock_convert_to_curve(