1 # SPDX-FileCopyrightText: 2021-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 Pose Library - usage functions.
13 from bpy
.types
import (
19 def select_bones(arm_object
: Object
, action
: Action
, *, select
: bool, flipped
: bool) -> None:
20 pose_bone_re
= re
.compile(r
'pose.bones\["([^"]+)"\]')
21 pose
= arm_object
.pose
23 seen_bone_names
: Set
[str] = set()
25 for fcurve
in action
.fcurves
:
26 data_path
: str = fcurve
.data_path
27 match
= pose_bone_re
.match(data_path
)
31 bone_name
= match
.group(1)
33 if bone_name
in seen_bone_names
:
35 seen_bone_names
.add(bone_name
)
38 bone_name
= bpy
.utils
.flip_name(bone_name
)
41 pose_bone
= pose
.bones
[bone_name
]
45 pose_bone
.bone
.select
= select
48 if __name__
== '__main__':
51 print(f
"Test result: {doctest.testmod()}")