From bdfb3ea6e75084ed935367c798564d08510080b2 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 4 Nov 2024 17:00:51 +0100 Subject: [PATCH] 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 --- source/blender/blenkernel/intern/modifier.cc | 9 ++++++++- source/blender/editors/armature/armature_naming.cc | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/modifier.cc b/source/blender/blenkernel/intern/modifier.cc index 32cf20ac483..883ea48410e 100644 --- a/source/blender/blenkernel/intern/modifier.cc +++ b/source/blender/blenkernel/intern/modifier.cc @@ -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(md); + if (amd->object && amd->object->data == arm) { + return true; + } + } + else if (md->type == eModifierType_GreasePencilArmature) { + GreasePencilArmatureModifierData *amd = reinterpret_cast( + md); if (amd->object && amd->object->data == arm) { return true; } diff --git a/source/blender/editors/armature/armature_naming.cc b/source/blender/editors/armature/armature_naming.cc index eb0edad95ae..af2a8273109 100644 --- a/source/blender/editors/armature/armature_naming.cc +++ b/source/blender/editors/armature/armature_naming.cc @@ -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(ob->data), ID_RECALC_GEOMETRY); } }