Fix T38737: Box select channels in dope sheet doesn't select corresponding bones in rig

This commit is contained in:
Joshua Leung 2014-02-22 00:51:37 +13:00
parent 3436c41dee
commit 4ff3ec835e
Notes: blender-bot 2023-02-14 11:09:44 +01:00
Referenced by issue #38737, Box select channels in dope sheet doesn't select corresponding bones in rig.
1 changed files with 26 additions and 0 deletions

View File

@ -2121,6 +2121,32 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec
{
bActionGroup *agrp = (bActionGroup *)ale->data;
/* Armatures-Specific Feature:
* See mouse_anim_channels() -> ANIMTYPE_GROUP case for more details (T38737)
*/
if ((ac->ads->filterflag & ADS_FILTER_ONLYSEL) == 0) {
if ((ale->id) && (GS(ale->id->name) == ID_OB)) {
Object *ob = (Object *)ale->id;
if (ob->type == OB_ARMATURE) {
/* Assume for now that any group with corresponding name is what we want
* (i.e. for an armature whose location is animated, things would break
* if the user were to add a bone named "Location").
*
* TODO: check the first F-Curve or so to be sure...
*/
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
if (agrp->flag & AGRP_SELECTED) {
ED_pose_bone_select(ob, pchan, true);
}
else {
ED_pose_bone_select(ob, pchan, false);
}
}
}
}
/* always clear active flag after doing this */
agrp->flag &= ~AGRP_ACTIVE;
break;