diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-23 14:59:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-23 15:00:18 +0300 |
commit | e40387b1e2af2b2810b2062b1c68491c22911505 (patch) | |
tree | aa2859e5377f0ba48b2d6f17317e20f1aad7fb39 | |
parent | 3ff3f563e57e43abeacd5bb4df66d8b6bec0c847 (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index f94f1e72638..1bae65a7fb4 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -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; } } |