diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-02-05 14:52:51 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-02-05 14:52:51 +0300 |
commit | 65af2e2d488c28cd8176ab10f9f9abfbd0ce8c6b (patch) | |
tree | e429371785db9c236a0646ce126a06a87dc7ced5 /source/blender | |
parent | c1bbda703f4ce32f26b3750fcafada5ef4ac6f53 (diff) |
Bugfix for "Show Only Selected" option and Bones (in Animation Editors):
If you have some bones selected, and then hide their layer, they would stay selected + visible even when you make another selection. Now, they are hidden and are no longer visible when they aren't on visible layers.
Currently, this is only done if the channels are being filtered by visibility, but this could easily be changed to do without this check. Will see how this goes after some production testing. :)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index b07a54869ac..193794cea0c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -775,7 +775,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s /* ----------------------------------------- */ -static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id) +/* NOTE: when this function returns true, the F-Curve is to be skipped */ +static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id, int filter_mode) { if (GS(owner_id->name) == ID_OB) { Object *ob= (Object *)owner_id; @@ -790,9 +791,21 @@ static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id) pchan= get_pose_channel(ob->pose, bone_name); if (bone_name) MEM_freeN(bone_name); - /* can only add this F-Curve if it is selected */ - if ((pchan) && (pchan->bone) && (pchan->bone->flag & BONE_SELECTED)==0) - return 1; + /* check whether to continue or skip */ + if ((pchan) && (pchan->bone)) { + /* if only visible channels, skip if bone not visible */ + // TODO: should we just do this always? + if (filter_mode & ANIMFILTER_VISIBLE) { + bArmature *arm= (bArmature *)ob->data; + + if ((arm->layer & pchan->bone->layer) == 0) + return 1; + } + + /* can only add this F-Curve if it is selected */ + if ((pchan->bone->flag & BONE_SELECTED) == 0) + return 1; + } } } else if (GS(owner_id->name) == ID_SCE) { @@ -853,15 +866,16 @@ static FCurve *animdata_filter_fcurve_next (bDopeSheet *ads, FCurve *first, bAct * - this will also affect things like Drivers, and also works for Bone Constraints */ if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) { - if (skip_fcurve_selected_data(fcu, owner_id)) + if (skip_fcurve_selected_data(fcu, owner_id, filter_mode)) continue; } - + /* only include if visible (Graph Editor check, not channels check) */ if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) { /* only work with this channel and its subchannels if it is editable */ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) { /* only include this curve if selected in a way consistent with the filtering requirements */ + // FIXME: the first selection test is buggered, and works wrong for sel+curvesonly filtering if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) { /* only include if this curve is active */ if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) { |