Keep proper bone active group after removing first one

Previously active bone group would be set to NONE after removing the first
one even if there are more groups in the armature.
This commit is contained in:
Sergey Sharybin 2015-01-23 16:59:16 +05:00
parent 3ff3f563e5
commit e40387b1e2
1 changed files with 5 additions and 1 deletions

View File

@ -1002,8 +1002,12 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
/* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp);
if (pose->active_group >= idx) {
const bool has_groups = !BLI_listbase_is_empty(&pose->agroups);
pose->active_group--;
if (pose->active_group < 0 || BLI_listbase_is_empty(&pose->agroups)) {
if (pose->active_group == 0 && has_groups) {
pose->active_group = 1;
}
else if (pose->active_group < 0 || !has_groups) {
pose->active_group = 0;
}
}