Graph Editor: Bugfixes for option where only the keyframes of selected F-Curves are shown

* Selected keyframes in unselected F-Curves were still being modified, although not shown
* Selection tools for keyframes were changing the selection status of F-Curves, making keyframes sometimes disappear after trying to select another keyframe

* Warning fixes in a few other files
This commit is contained in:
Joshua Leung 2010-01-22 23:51:31 +00:00
parent f0d89a041f
commit 8dd14e1eed
5 changed files with 79 additions and 38 deletions

@ -1480,7 +1480,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
bPose *pose= ob->pose, *frompose= from->pose;
bPoseChannel *pchan, *pchanp, pchanw;
bConstraint *con;
AnimData *adt, *fromadt;
int error = 0;
if (frompose==NULL) return;

@ -2325,7 +2325,7 @@ void makeBevelList(Object *ob)
/*
* handlecodes:
* 1: nothing, 1:auto, 2:vector, 3:aligned
* 0: nothing, 1:auto, 2:vector, 3:aligned
*/
/* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles */

@ -442,11 +442,15 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
/* quick macro to test if an anim-channel (F-Curve) is selected ok for editing purposes
* - _SELEDIT means that only selected curves will have visible+editable keyframes
*
* checks here work as follows:
* 1) seledit off - don't need to consider the implications of this option
* 2) foredit off - we're not considering editing, so channel is ok still
* 3) test_func (i.e. selection test) - only if selected, this test will pass
*/
// FIXME: this doesn't work cleanly yet...
#define ANIMCHANNEL_SELEDITOK(test_func) \
( !(filter_mode & ANIMFILTER_SELEDIT) || \
(filter_mode & ANIMFILTER_CHANNELS) || \
!(filter_mode & ANIMFILTER_FOREDIT) || \
(test_func) )
/* ----------- 'Private' Stuff --------------- */
@ -952,6 +956,7 @@ static int animdata_filter_action (ListBase *anim_data, bDopeSheet *ads, bAction
* - group is expanded
* - we just need the F-Curves present
*/
// FIXME: checking if groups are expanded is only valid if in one or other modes
if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
{
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
@ -1804,6 +1809,14 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo
return 0;
}
/* augment the filter-flags with settings based on the dopesheet filterflags
* so that some temp settings can get added automagically...
*/
if (ads->filterflag & ADS_FILTER_SELEDIT) {
/* only selected F-Curves should get their keyframes considered for editability */
filter_mode |= ANIMFILTER_SELEDIT;
}
/* scene-linked animation */
// TODO: sequencer, composite nodes - are we to include those here too?
{

@ -109,6 +109,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
bAnimListElem *ale;
int filter;
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditData bed;
BeztEditFunc test_cb, sel_cb;
@ -142,13 +143,18 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
/* Keyframes First */
ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
if (sel == SELECT_SUBTRACT)
fcu->flag &= ~FCURVE_SELECTED;
else
fcu->flag |= FCURVE_SELECTED;
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
if (sel == SELECT_SUBTRACT)
fcu->flag &= ~FCURVE_SELECTED;
else
fcu->flag |= FCURVE_SELECTED;
}
/* always deactivate all F-Curves if we perform batch ops for selection */
fcu->flag &= ~FCURVE_ACTIVE;
}
@ -214,6 +220,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
bAnimListElem *ale;
int filter;
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditData bed;
BeztEditFunc ok_cb, select_cb;
View2D *v2d= &ac->ar->v2d;
@ -264,9 +271,12 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
/* select keyframes that are in the appropriate places */
ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, select_cb, NULL);
/* select the curve too now that curve will be touched */
if (selectmode == SELECT_ADD)
fcu->flag |= FCURVE_SELECTED;
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
/* select the curve too now that curve will be touched */
if (selectmode == SELECT_ADD)
fcu->flag |= FCURVE_SELECTED;
}
}
/* un-apply NLA mapping from all the keyframes */
@ -290,7 +300,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
selectmode= SELECT_ADD;
else
selectmode= SELECT_SUBTRACT;
@ -584,7 +594,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc
* include the 'only selected' flag...
*/
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
if (sipo->flag & SIPO_SELCUVERTSONLY)
if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@ -670,6 +680,7 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc
/* option 1) select keyframe directly under mouse */
static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, short curves_only)
{
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
FCurve *fcu;
BezTriple *bezt;
short handle;
@ -687,9 +698,15 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
/* reset selection mode */
select_mode= SELECT_ADD;
/* deselect all other channels and keyframes */
//ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
/* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
/* deselect other channels too, but only only do this if
* selection of channel when the visibility of keyframes
* doesn't depend on this
*/
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* if points can be selected on this F-Curve */
@ -746,16 +763,19 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL);
}
/* select or deselect curve? */
if (select_mode == SELECT_INVERT)
fcu->flag ^= FCURVE_SELECTED;
else if (select_mode == SELECT_ADD)
fcu->flag |= FCURVE_SELECTED;
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
/* select or deselect curve? */
if (select_mode == SELECT_INVERT)
fcu->flag ^= FCURVE_SELECTED;
else if (select_mode == SELECT_ADD)
fcu->flag |= FCURVE_SELECTED;
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
if (fcu->flag & FCURVE_SELECTED) {
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
if (fcu->flag & FCURVE_SELECTED) {
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
}
}
}
@ -766,6 +786,7 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
bAnimListElem *ale;
int filter;
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditFunc ok_cb, select_cb;
BeztEditData bed;
Scene *scene= ac->scene;
@ -775,9 +796,15 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
/* reset selection mode to add to selection */
select_mode= SELECT_ADD;
/* deselect all other channels and keyframes */
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
/* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
/* deselect other channels too, but only only do this if
* selection of channel when the visibility of keyframes
* doesn't depend on this
*/
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* set callbacks and editing data */
@ -822,6 +849,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
bAnimListElem *ale;
int filter;
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
BeztEditFunc select_cb, ok_cb;
BeztEditData bed;
FCurve *fcu;
@ -841,9 +869,15 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
/* reset selection mode to add to selection */
select_mode= SELECT_ADD;
/* deselect all other channels and keyframes */
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
/* deselect all other keyframes */
deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
/* deselect other channels too, but only only do this if
* selection of channel when the visibility of keyframes
* doesn't depend on this
*/
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
}
/* initialise keyframe editing data */

@ -81,11 +81,6 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Only NLA", "Only include NLA data from Animation data.");
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
prop= RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SELEDIT);
RNA_def_property_ui_text(prop, "Use Filter", "Indicates if filtering options must be taken into account.");
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
prop= RNA_def_property(srna, "display_summary", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY);
RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line. (DopeSheet Editors only)");