Fix #139391: take dynamically added vertex groups into account in armature modifier

Previously, the armature modifier retrieved the list of available vertex group
names from the original mesh. However, that list may contain different vertex
groups then are actually on the mesh that is being deformed. This patch makes it
so that the vertex group list (`defbase`) is taken directly from the
mesh-to-deform if possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/139734
This commit is contained in:
Jacques Lucke
2025-06-02 19:30:21 +02:00
parent 5b8f1fb0b9
commit 383b3fd678

View File

@@ -653,9 +653,16 @@ void BKE_armature_deform_coords_with_mesh(const Object *ob_arm,
/* Note armature modifier on legacy curves calls this, so vertex groups are not guaranteed to
* exist. */
const ID *id_target = static_cast<const ID *>(ob_target->data);
const ListBase *defbase = BKE_id_supports_vertex_groups(id_target) ?
BKE_id_defgroup_list_get(id_target) :
nullptr;
const ListBase *defbase = nullptr;
if (me_target) {
/* Use the vertex groups from the evaluated mesh that is being deformed. */
defbase = BKE_id_defgroup_list_get(&me_target->id);
}
else if (BKE_id_supports_vertex_groups(id_target)) {
/* Take the vertex groups from the original object data. */
defbase = BKE_id_defgroup_list_get(id_target);
}
blender::Span<MDeformVert> dverts;
if (ob_target->type == OB_MESH) {
if (me_target == nullptr) {