fix [#34486] Selection of bones in armature edit mode only toggles between two bones

This commit is contained in:
Campbell Barton
2013-03-02 15:34:47 +00:00
parent d17a8639e4
commit 723e231ce0

View File

@@ -260,6 +260,9 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot)
static EditBone *get_nearest_editbonepoint(ViewContext *vc, const int mval[2],
ListBase *edbo, int findunsel, int *selmask)
{
bArmature *arm = (bArmature *)vc->obedit->data;
EditBone *ebone_next_act = arm->act_edbone;
EditBone *ebone;
rcti rect;
unsigned int buffer[MAXPICKBUF];
@@ -269,6 +272,18 @@ static EditBone *get_nearest_editbonepoint(ViewContext *vc, const int mval[2],
glInitNames();
/* find the bone after the current active bone, so as to bump up its chances in selection.
* this way overlapping bones will cycle selection state as with objects. */
if (ebone_next_act &&
EBONE_VISIBLE(arm, ebone_next_act) &&
ebone_next_act->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL))
{
ebone_next_act = ebone_next_act->next ? ebone_next_act->next : arm->edbo->first;
}
else {
ebone_next_act = NULL;
}
rect.xmin = mval[0] - 5;
rect.xmax = mval[0] + 5;
rect.ymin = mval[1] - 5;
@@ -320,6 +335,11 @@ static EditBone *get_nearest_editbonepoint(ViewContext *vc, const int mval[2],
}
else dep = 3;
}
if (ebone == ebone_next_act) {
dep -= 1;
}
if (dep < mindep) {
mindep = dep;
besthitresult = hitresult;