diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-03-23 16:54:41 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-03-29 16:01:45 +0300 |
commit | fa8269cc4ef546987f1cd068100027a2ccbdf31e (patch) | |
tree | bce5d3dcb21e40602309d172e9ee5f15ffad04fa /source/blender/blenkernel/intern/armature_pose.cc | |
parent | 4d3a2ba6a91833c84f58ca8d44b6f0538c560902 (diff) |
Animation: add `PBONE_SELECTED` macro
Add `PBONE_SELECTED` macro to determine selection state of bones, while
also taking visibility into account.
Diffstat (limited to 'source/blender/blenkernel/intern/armature_pose.cc')
-rw-r--r-- | source/blender/blenkernel/intern/armature_pose.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/armature_pose.cc b/source/blender/blenkernel/intern/armature_pose.cc index bb371b16c42..ca11692372b 100644 --- a/source/blender/blenkernel/intern/armature_pose.cc +++ b/source/blender/blenkernel/intern/armature_pose.cc @@ -39,7 +39,7 @@ namespace { using BoneNameSet = blender::Set<std::string>; // Forward declarations. -BoneNameSet pose_apply_find_selected_bones(const bPose *pose); +BoneNameSet pose_apply_find_selected_bones(const bArmature *armature, const bPose *pose); void pose_apply_disable_fcurves_for_unselected_bones(bAction *action, const BoneNameSet &selected_bone_names); void pose_apply_restore_fcurves(bAction *action); @@ -54,7 +54,8 @@ void BKE_pose_apply_action(struct Object *ob, return; } - const BoneNameSet selected_bone_names = pose_apply_find_selected_bones(pose); + const bArmature *armature = (bArmature *)ob->data; + const BoneNameSet selected_bone_names = pose_apply_find_selected_bones(armature, pose); const bool limit_to_selected_bones = !selected_bone_names.is_empty(); if (limit_to_selected_bones) { @@ -74,15 +75,14 @@ void BKE_pose_apply_action(struct Object *ob, } namespace { -BoneNameSet pose_apply_find_selected_bones(const bPose *pose) +BoneNameSet pose_apply_find_selected_bones(const bArmature *armature, const bPose *pose) { BoneNameSet selected_bone_names; bool all_bones_selected = true; bool no_bones_selected = true; LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { - const bool is_selected = (pchan->bone->flag & BONE_SELECTED) != 0 && - (pchan->bone->flag & BONE_HIDDEN_P) == 0; + const bool is_selected = PBONE_SELECTED(armature, pchan->bone); all_bones_selected &= is_selected; no_bones_selected &= !is_selected; |