Fix T92083: Crash renaming bone used in Armature modifier on curve

This is caused by {rB3b6ee8cee708}.

Since rigging curves with armatures only works with envelopes (if I am
not mistaken), this stirs up the question again why we actually give the
choice for vertex groups in parenting. Anyways, curves can have armature
modifiers and renaming bones should not crash.

Now make sure we only go down the route of `BKE_object_defgroup_list`
and `BKE_object_defgroup_find_name` if vertex groups are actually
supported.

Maniphest Tasks: T92083

Differential Revision: https://developer.blender.org/D12876
This commit is contained in:
Philipp Oeser
2021-10-15 16:57:15 +02:00
parent 104887800c
commit 7bf9c70b14

View File

@@ -265,7 +265,7 @@ void ED_armature_bone_rename(Main *bmain,
}
}
if (BKE_modifiers_uses_armature(ob, arm)) {
if (BKE_modifiers_uses_armature(ob, arm) && BKE_object_supports_vertex_groups(ob)) {
bDeformGroup *dg = BKE_object_defgroup_find_name(ob, oldname);
if (dg) {
BLI_strncpy(dg->name, newname, MAXBONENAME);