From ab67d410a90d5d2d07f5c34d3dae197331b41dc8 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Tue, 29 Aug 2023 16:35:56 +0200 Subject: [PATCH] Fix: set bone collection membership properly for new bones - Extrude and subdivide operators now duplicate the membership from the source bone. - Adding a bone through the edit_bones.new() Python API now leaves membership empty. But adding a new bone through the operator still adds it to the active collection. --- source/blender/editors/armature/armature_add.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/armature/armature_add.cc b/source/blender/editors/armature/armature_add.cc index 63156c1928a..9f0b8633fdb 100644 --- a/source/blender/editors/armature/armature_add.cc +++ b/source/blender/editors/armature/armature_add.cc @@ -70,7 +70,6 @@ EditBone *ED_armature_ebone_add(bArmature *arm, const char *name) bone->rad_head = 0.10f; bone->rad_tail = 0.05f; bone->segments = 1; - ANIM_armature_bonecoll_assign_active(arm, bone); /* Bendy-Bone parameters */ bone->roll1 = 0.0f; @@ -1544,6 +1543,9 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) } ED_armature_ebone_unique_name(arm->edbo, newbone->name, nullptr); + /* Copy bone collection membership. */ + BLI_duplicatelist(&newbone->bone_collections, &ebone->bone_collections); + /* Add the new bone to the list */ BLI_addtail(arm->edbo, newbone); if (!first) { @@ -1645,6 +1647,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) /* Create a bone. */ bone = ED_armature_ebone_add(static_cast(obedit->data), name); + ANIM_armature_bonecoll_assign_active(static_cast(obedit->data), bone); copy_v3_v3(bone->head, curs); @@ -1742,6 +1745,9 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) } } newbone->parent = ebone; + + /* Copy bone collection membership. */ + BLI_duplicatelist(&newbone->bone_collections, &ebone->bone_collections); } } CTX_DATA_END;