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
This commit is contained in:
2020-07-21 09:51:27 -04:00
parent 6b6e2e742f
commit d42530824e
5 changed files with 14 additions and 11 deletions

View File

@@ -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);