diff --git a/docs/release_notes/4.0/upgrading/bone_collections.md b/docs/release_notes/4.0/upgrading/bone_collections.md index f2871c3d..bd9040cd 100644 --- a/docs/release_notes/4.0/upgrading/bone_collections.md +++ b/docs/release_notes/4.0/upgrading/bone_collections.md @@ -16,6 +16,18 @@ Python code that was working with armature layers and bone collections. - Each layer that contains one or more bones will be converted. Empty layers are skipped. +### Creating And Deleting Bone Collections + +Adding: +``` +arm.data.collections.new('IK Controls') +``` +Removing: +``` +ik_controls = arm.data.collections['IK Controls'] +ik_controls = arm.data.collections.remove(ik_controls) +``` + ### Changing Visibility Blender 3.6 and older: @@ -28,11 +40,11 @@ arm.layers[0] = False Blender 4.0: ``` Python -for bcoll in arm.collections: +for bcoll in arm.data.collections: bcoll.is_visible = True -arm.collections['IK Controls'].is_visible = False -arm.collections[0].is_visible = False +arm.data.collections['IK Controls'].is_visible = False +arm.data.collections[0].is_visible = False ``` ### Assigning & Unassigning Bones @@ -47,10 +59,10 @@ arm.bones['arm_lower_R'].layers[1] = True Blender 4.0: ``` Python -arm.collections['IK Controls'].assign(arm.bones['arm_lower_R']) -arm.collections['IK Controls'].unassign(arm.bones['arm_lower_R']) -arm.collections[2].assign(arm.bones['arm_lower_R']) -arm.collections[2].unassign(arm.bones['arm_lower_R']) +arm.data.collections['IK Controls'].assign(arm.data.bones['arm_lower_R']) +arm.data.collections['IK Controls'].unassign(arm.data.bones['arm_lower_R']) +arm.data.collections[2].assign(arm.data.bones['arm_lower_R']) +arm.data.collections[2].unassign(arm.data.bones['arm_lower_R']) ``` ### Assigning bone to collections of another Bone: @@ -65,9 +77,9 @@ Blender 4.0 (until there is a `bone.collections.set(other_collections)` function): ``` Python -bone = arm.bones['arm_lower_R'] +bone = arm.data.bones['arm_lower_R'] bone.collections.clear() -for bcoll in arm.bones['other_bone'].collections: +for bcoll in arm.data.bones['other_bone'].collections: bcoll.assign(bone) ``` @@ -84,10 +96,10 @@ Blender 4.0: ``` Python # Any mode but armature edit mode: -in_collection = arm.collections['IK Controls'].bones +in_collection = arm.data.collections['IK Controls'].bones # Armature edit mode: -in_collection = [ebone for ebone in arm.edit_bones +in_collection = [ebone for ebone in arm.data.edit_bones if 'IK Controls' in ebone.collections] ``` @@ -105,8 +117,8 @@ arm["custom_layer_data"] = { Blender 4.0 has custom properties on bone collections: ``` Python -arm.collections['IK Controls']['custom'] = 'some custom data' -arm.collections[3]['whatever'] = 'you need' +arm.data.collections['IK Controls']['custom'] = 'some custom data' +arm.data.collections[3]['whatever'] = 'you need' ``` ## Bone Groups to Bone Collections @@ -168,7 +180,7 @@ Blender 4.0: ``` Python # On the armature bone: -bone = arm.bones['arm_lower_R'] +bone = arm.data.bones['arm_lower_R'] # Alternatively, set on the pose bone: bone = obj.pose.bones['arm_lower_R'] @@ -180,5 +192,5 @@ bone.color.palette = 'CUSTOM' bone.color.custom.active = (0.95, 1.0, 0.0) # Disable display of bone colors on the armature: -arm.show_bone_colors = False +arm.data.show_bone_colors = False ```