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-10-18 23:57:47 +0300
committerHans Goudey <h.goudey@me.com>2022-10-18 23:57:57 +0300
commitbe32882e1c40eb1cb72deab0bb6ee54fff917ca2 (patch)
tree2fa3c3d4b06f35e096a94b28dd7ec73cd7799c31 /source/blender
parentd57352b1147642660c13aeb17a0c603593fc0dea (diff)
Fix T101883: Issue applying modifier to mesh with shape keys
Caused by 21f2bacad977d3fd83d which misunderstood the logic handling shape keys in this function. The shape key on the original mesh in the main data-base should be cleared if the "no-main" mesh doesn't have any shape key layers and the vertex count has changed. The complexity is necessary because shape keys are stored differently on original and evaluated meshes. Also change to "Warn" because this is expected behavior in some cases, like when applying a geometry nodes modifier that creates a new mesh from scratch.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index 027423f5774..784d35a8d65 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -1313,6 +1313,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob)
CustomData_duplicate_referenced_layers(&mesh_src->pdata, mesh_src->totpoly);
CustomData_duplicate_referenced_layers(&mesh_src->ldata, mesh_src->totloop);
+ const bool verts_num_changed = mesh_dst->totvert != mesh_src->totvert;
mesh_dst->totvert = mesh_src->totvert;
mesh_dst->totedge = mesh_src->totedge;
mesh_dst->totpoly = mesh_src->totpoly;
@@ -1339,11 +1340,10 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob)
const int uid_active = ob ? find_object_active_key_uid(*key_dst, *ob) : -1;
move_shapekey_layers_to_keyblocks(*mesh_dst, mesh_src->vdata, *key_dst, uid_active);
}
- else if (mesh_src->totvert != mesh_dst->totvert) {
- CLOG_ERROR(&LOG, "Mesh in Main '%s' lost shape keys", mesh_src->id.name);
- if (mesh_src->key) {
- id_us_min(&mesh_src->key->id);
- }
+ else if (verts_num_changed) {
+ CLOG_WARN(&LOG, "Shape key data lost when replacing mesh '%s' in Main", mesh_src->id.name);
+ id_us_min(&mesh_dst->key->id);
+ mesh_dst->key = nullptr;
}
}