diff options
author | Hans Goudey <h.goudey@me.com> | 2020-07-21 16:51:27 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-07-21 16:51:27 +0300 |
commit | d42530824e434fcc4c8d5394dd65f44cf3e8c16f (patch) | |
tree | 434907905bd9335ff9af86cab65149714c8fcc40 /source/blender/blenkernel/intern/action.c | |
parent | 6b6e2e742ff4393a73e982e0a3d6dae934ad20f2 (diff) |
Fix T78994: Clear selected pose doesn't work without animation
It looks like the code left this as a todo, but the basic solution is to
add an extra parameter to BKE_bose_rest to check whether bones
are selected before reseting them.
I also corrected the operator description which said it acted on only
selected bones even when there is an option to turn that off. The
"act on selected" is generally implied for Blender's operators anyway.
Differential Revision: https://developer.blender.org/D8319
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 0ee2fcb1963..fa7eee83a68 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1512,8 +1512,10 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, /* ************** Pose Management Tools ****************** */ -/* for do_all_pose_actions, clears the pose. Now also exported for proxy and tools */ -void BKE_pose_rest(bPose *pose) +/** + * Zero the pose transforms for the entire pose or only for selected bones. + */ +void BKE_pose_rest(bPose *pose, bool selected_bones_only) { bPoseChannel *pchan; @@ -1525,6 +1527,9 @@ void BKE_pose_rest(bPose *pose) memset(pose->cyclic_offset, 0, sizeof(pose->cyclic_offset)); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { + if (selected_bones_only && pchan->bone != NULL && (pchan->bone->flag & BONE_SELECTED) == 0) { + continue; + } zero_v3(pchan->loc); zero_v3(pchan->eul); unit_qt(pchan->quat); |