Cleanup: Some minor tweaks to code

This commit is contained in:
Joshua Leung 2018-05-24 13:47:33 +02:00
parent dfb959b6c3
commit fe820eba92
1 changed files with 4 additions and 5 deletions

View File

@ -2122,25 +2122,24 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
continue;
}
/* Loop over contiguous bone hits for 'base'. */
bool bone_selected = false;
bool changed = false;
for (; col != col_end; col += 4) {
/* should never fail */
if (bone != NULL) {
if (select) {
if ((bone->flag & BONE_UNSELECTABLE) == 0) {
bone->flag |= BONE_SELECTED;
bone_selected = true;
}
}
else {
bArmature *arm = base->object->data;
if ((bone->flag & BONE_UNSELECTABLE) == 0) {
bone->flag &= ~BONE_SELECTED;
bone_selected = true;
if (arm->act_bone == bone)
arm->act_bone = NULL;
}
}
changed = true;
}
else if (!bone_only) {
ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
@ -2154,7 +2153,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
if ((base->object->pose != NULL) && bone_only) {
const uint hit_bone = (col[4] & ~BONESEL_ANY) >> 16;
bPoseChannel *pchan = BLI_findlink(&base->object->pose->chanbase, hit_bone);;
bPoseChannel *pchan = BLI_findlink(&base->object->pose->chanbase, hit_bone);
bone = pchan ? pchan->bone : NULL;
}
else {
@ -2163,7 +2162,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
}
}
if (bone_selected) {
if (changed) {
if (base->object && (base->object->type == OB_ARMATURE)) {
bArmature *arm = base->object->data;