Fix T99929: lattice modifier looks up vertex group index in wrong place

It looked up the vertex group index based on the object instead of the
actual mesh that is currently used. Since geometry nodes, the number
and order of attributes can change in arbitrary ways during evaluation.
Therefore, this index has to be looked up on the mesh which contains
the most up-to-date information.

There are probably similar issues in other modifiers. That has to be
fixed step by step. Ideally by using the attribute api directly eventually.
This commit is contained in:
Jacques Lucke
2022-07-25 11:54:36 +02:00
parent c5afef1224
commit 6f1cdcba85

View File

@@ -348,7 +348,8 @@ static void lattice_deform_coords_impl(const Object *ob_lattice,
* We want either a Mesh/Lattice with no derived data, or derived data with deformverts.
*/
if (defgrp_name && defgrp_name[0] && ob_target && ELEM(ob_target->type, OB_MESH, OB_LATTICE)) {
defgrp_index = BKE_id_defgroup_name_index((ID *)ob_target->data, defgrp_name);
defgrp_index = BKE_id_defgroup_name_index(me_target ? &me_target->id : (ID *)ob_target->data,
defgrp_name);
if (defgrp_index != -1) {
/* if there's derived data without deformverts, don't use vgroups */