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-11 20:25:59 +0300
committerHans Goudey <h.goudey@me.com>2022-03-11 20:25:59 +0300
commit5c86f0369c6fc458c828cf60268774ac0c4cf32a (patch)
tree9ca6a372528b88409804ff707947022366b0e76f /source/blender
parent28434dab0c9b59ccee0ac1f55425580a75f43703 (diff)
Fix: Deleting vertex group attribute can change original mesh
There was an error with the attribute API implementation for vertex groups. If the vertex group layer referenced an original mesh, it wasn't properly duplicated for writing.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/geometry_component_mesh.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index 104166df913..cbd7ec9155a 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -1049,6 +1049,11 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider {
if (mesh->dvert == nullptr) {
return true;
}
+
+ /* Copy the data layer if it is shared with some other mesh. */
+ mesh->dvert = (MDeformVert *)CustomData_duplicate_referenced_layer(
+ &mesh->vdata, CD_MDEFORMVERT, mesh->totvert);
+
for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) {
MDeformWeight *weight = BKE_defvert_find_index(&dvert, index);
BKE_defvert_remove_group(&dvert, weight);