Fix #129727: GPv3: renaming bones does not rename vertex groups

First issue is that `BKE_modifiers_uses_armature` wasnt working for GP
objects and the second one is that vgroup names are stored in
CurvesGeometry for GP (so that needs special handling, now done, same as
in `BKE_object_defgroup_set_name`).

Pull Request: https://projects.blender.org/blender/blender/pulls/129794
This commit is contained in:
Philipp Oeser 2024-11-04 17:00:51 +01:00 committed by Falk David
parent adac5c97f0
commit bdfb3ea6e7
2 changed files with 14 additions and 1 deletions

View File

@ -770,7 +770,14 @@ bool BKE_modifiers_uses_armature(Object *ob, bArmature *arm)
for (; md; md = md->next) {
if (md->type == eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData *)md;
ArmatureModifierData *amd = reinterpret_cast<ArmatureModifierData *>(md);
if (amd->object && amd->object->data == arm) {
return true;
}
}
else if (md->type == eModifierType_GreasePencilArmature) {
GreasePencilArmatureModifierData *amd = reinterpret_cast<GreasePencilArmatureModifierData *>(
md);
if (amd->object && amd->object->data == arm) {
return true;
}

View File

@ -262,6 +262,12 @@ void ED_armature_bone_rename(Main *bmain,
bDeformGroup *dg = BKE_object_defgroup_find_name(ob, oldname);
if (dg) {
STRNCPY(dg->name, newname);
if (ob->type == OB_GREASE_PENCIL) {
/* Update vgroup names stored in CurvesGeometry */
BKE_grease_pencil_vgroup_name_update(ob, oldname, dg->name);
}
DEG_id_tag_update(static_cast<ID *>(ob->data), ID_RECALC_GEOMETRY);
}
}