Anim: Move pose bone selection state to bPoseChannel

Move the selection flag for pose bones, from the (edit)bone to the
pose bone.

Previously having multiple instances of armatures in pose mode at the
same time caused issues because selecting a pose bone on one armature
would automatically select it on all instances of it.

This is now fixed since the selection state is stored on the pose bone
(Object level) Doing so breaks API compatibility with 4.5 since the
RNA property on the Bone no longer affects the pose bone. Instead,
there is a new property on the pose bone for that.

Due to this change, some runtime flags for the transform system also
had to be moved to the pose bone. This is due to the fact that these
flags are used by the transform system to pass information between
functions. If we keep the flag at the bone level, this wouldn't work
with armature instances. See `bPoseChannelRuntimeFlag`

Fixes #117892

Pull Request: https://projects.blender.org/blender/blender/pulls/146102
This commit is contained in:
Christoph Lendenfeld
2025-10-07 19:59:36 +02:00
committed by Sybren A. Stüvel
parent 37a676212c
commit a09d0cfd8c
43 changed files with 455 additions and 311 deletions

View File

@@ -89,9 +89,7 @@ def _create_armature():
edit_bone.head = (1, 0, 0)
bpy.ops.object.mode_set(mode='POSE')
armature_obj.pose.bones[_BONE_NAME].rotation_mode = "XYZ"
armature_obj.pose.bones[_BONE_NAME].bone.select = True
armature_obj.pose.bones[_BONE_NAME].bone.select_head = True
armature_obj.pose.bones[_BONE_NAME].bone.select_tail = True
armature_obj.pose.bones[_BONE_NAME].select = True
bpy.ops.object.mode_set(mode='OBJECT')
return armature_obj

View File

@@ -88,8 +88,8 @@ class CreateAssetTest(unittest.TestCase):
self._armature_object.pose.bones[_BONE_NAME_1].location = (1, 1, 2)
self._armature_object.pose.bones[_BONE_NAME_2].location = (-1, 0, 0)
self._armature_object.pose.bones[_BONE_NAME_1].bone.select = True
self._armature_object.pose.bones[_BONE_NAME_2].bone.select = False
self._armature_object.pose.bones[_BONE_NAME_1].select = True
self._armature_object.pose.bones[_BONE_NAME_2].select = False
self._armature_object.pose.bones[_BONE_NAME_1].keyframe_insert('["bool_test"]')
self._armature_object.pose.bones[_BONE_NAME_1].keyframe_insert('["float_test"]')
@@ -130,8 +130,8 @@ class CreateAssetTest(unittest.TestCase):
self._armature_object.pose.bones[_BONE_NAME_1].location = (1, 1, 2)
self._armature_object.pose.bones[_BONE_NAME_2].location = (-1, 0, 0)
self._armature_object.pose.bones[_BONE_NAME_1].bone.select = True
self._armature_object.pose.bones[_BONE_NAME_2].bone.select = False
self._armature_object.pose.bones[_BONE_NAME_1].select = True
self._armature_object.pose.bones[_BONE_NAME_2].select = False
self._armature_object.pose.bones[_BONE_NAME_1].keyframe_insert('["bool_test"]')
self._armature_object.pose.bones[_BONE_NAME_1].keyframe_insert('["float_test"]')
@@ -181,8 +181,8 @@ class CreateAssetTest(unittest.TestCase):
self._armature_object.pose.bones[_BONE_NAME_1].location = (1, 1, 2)
self._armature_object.pose.bones[_BONE_NAME_2].location = (-1, 0, 0)
self._armature_object.pose.bones[_BONE_NAME_1].bone.select = True
self._armature_object.pose.bones[_BONE_NAME_2].bone.select = False
self._armature_object.pose.bones[_BONE_NAME_1].select = True
self._armature_object.pose.bones[_BONE_NAME_2].select = False
self.assertEqual(len(bpy.data.actions), 0)
bpy.ops.poselib.create_pose_asset(