1 # SPDX-License-Identifier: GPL-2.0-or-later
4 Pose Library - usage functions.
11 from bpy
.types
import (
17 def select_bones(arm_object
: Object
, action
: Action
, *, select
: bool, flipped
: bool) -> None:
18 pose_bone_re
= re
.compile(r
'pose.bones\["([^"]+)"\]')
19 pose
= arm_object
.pose
21 seen_bone_names
: Set
[str] = set()
23 for fcurve
in action
.fcurves
:
24 data_path
: str = fcurve
.data_path
25 match
= pose_bone_re
.match(data_path
)
29 bone_name
= match
.group(1)
31 if bone_name
in seen_bone_names
:
33 seen_bone_names
.add(bone_name
)
36 bone_name
= bpy
.utils
.flip_name(bone_name
)
39 pose_bone
= pose
.bones
[bone_name
]
43 pose_bone
.bone
.select
= select
46 if __name__
== '__main__':
49 print(f
"Test result: {doctest.testmod()}")