Revision: 37728 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37728 Author: aligorith Date: 2011-06-22 11:41:26 +0000 (Wed, 22 Jun 2011) Log Message: ----------- Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used by the animation channel filtering code. The list of filtering flags has been growing a bit "organically" since it's humble origins for use in the Action Editor some 3 years (IIRC) ago now during a weekend hackathon. Obviously, some things have ended up tacked on, while others have been the product of other flag options. Nevertheless, it was time for a bit of a spring clean! * Most notably, one area where the system outgrown its original design for the Action Editor was in terms of the "visibility" filtering flag it was using. While in the Action Editor the concept of what channels to include was strictly dictated by whether the channel hierarchy showed it, in the Graph Editor this is not always the case. In other words, there was a difference between the data the channels represented being visible and the channels for that data being visible in the hierarchy. Long story short: this lead to bug report [#27076] (and many like it), where if you selected an F-Curve, then collapsed the Group it was in, then even after selecting another F-Curve in another Group, the original F-Curve's properties would still be shown in the Properties Region. The good news is that this commit fixes this issue right away! * More good news will follow, as I start checking on the flag usage of other tools, but I'm committing this first so that we have a stable reference (of code similar to the old buggy stuff) on which we can fall back to later to find bugs (should they pop up). Anyways, back to the trenches! Modified Paths: -------------- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c branches/soc-2011-pepper/source/blender/editors/animation/anim_deps.c branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c branches/soc-2011-pepper/source/blender/editors/animation/keyframes_draw.c branches/soc-2011-pepper/source/blender/editors/animation/keyframes_edit.c branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h branches/soc-2011-pepper/source/blender/editors/space_action/action_draw.c branches/soc-2011-pepper/source/blender/editors/space_action/action_edit.c branches/soc-2011-pepper/source/blender/editors/space_action/action_select.c branches/soc-2011-pepper/source/blender/editors/space_graph/graph_draw.c branches/soc-2011-pepper/source/blender/editors/space_graph/graph_edit.c branches/soc-2011-pepper/source/blender/editors/space_graph/graph_select.c branches/soc-2011-pepper/source/blender/editors/space_graph/graph_utils.c branches/soc-2011-pepper/source/blender/editors/space_graph/space_graph.c branches/soc-2011-pepper/source/blender/editors/space_nla/nla_buttons.c branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c branches/soc-2011-pepper/source/blender/editors/space_nla/nla_draw.c branches/soc-2011-pepper/source/blender/editors/space_nla/nla_edit.c branches/soc-2011-pepper/source/blender/editors/space_nla/nla_select.c branches/soc-2011-pepper/source/blender/editors/transform/transform_conversions.c branches/soc-2011-pepper/source/blender/editors/transform/transform_generics.c Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c =================================================================== --- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c 2011-06-22 11:25:33 UTC (rev 37727) +++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c 2011-06-22 11:41:26 UTC (rev 37728) @@ -2735,11 +2735,8 @@ else return; - /* get all channels that can possibly be chosen - * - therefore, the filter is simply ANIMFILTER_CHANNELS, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... - */ - filter= ANIMFILTER_CHANNELS; + /* get all channels that can possibly be chosen - but ignore hierarchy */ + filter= ANIMFILTER_DATA_VISIBLE|ANIMFILTER_LIST_CHANNELS; ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* call API method to flush the setting */ Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c =================================================================== --- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c 2011-06-22 11:25:33 UTC (rev 37727) +++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c 2011-06-22 11:41:26 UTC (rev 37728) @@ -194,7 +194,8 @@ int filter; /* filter data */ - filter= ANIMFILTER_VISIBLE|ANIMFILTER_CHANNELS; + /* NOTE: no list visible, otherwise, we get dangling */ + filter= ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS; ANIM_animdata_filter(ac, &anim_data, filter, data, datatype); /* See if we should be selecting or deselecting */ @@ -1053,7 +1054,8 @@ mode= RNA_enum_get(op->ptr, "direction"); /* get animdata blocks */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA); + // XXX: hierarchy visibility is provisional atm... might be wrong decision! + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale = anim_data.first; ale; ale = ale->next) { @@ -1133,7 +1135,7 @@ /* do groups only first (unless in Drivers mode, where there are none) */ if (ac.datatype != ANIMCONT_DRIVERS) { /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* delete selected groups and their associated channels */ @@ -1172,7 +1174,7 @@ /* now do F-Curves */ if (ac.datatype != ANIMCONT_GPENCIL) { /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* delete selected F-Curves */ @@ -1227,12 +1229,16 @@ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* get list of all channels that selection may need to be flushed to */ - filter= ANIMFILTER_CHANNELS; + /* get list of all channels that selection may need to be flushed to + * - hierarchy mustn't affect what we have access to here... + */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); - - /* hide all channels not selected */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS); + + /* hide all channels not selected + * - restrict this to only applying on settings we can get to in the list + */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -1306,12 +1312,16 @@ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* get list of all channels that selection may need to be flushed to */ - filter= (ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS); + /* get list of all channels that selection may need to be flushed to + * - hierarchy mustn't affect what we have access to here... + */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype); - /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); + /* filter data + * - restrict this to only applying on settings we can get to in the list + */ + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* See if we should be making showing all selected or hiding */ @@ -1403,14 +1413,24 @@ /* filter data that we need if flush is on */ if (flush) { - /* get list of all channels that selection may need to be flushed to */ - filter= ANIMFILTER_CHANNELS; + /* get list of all channels that selection may need to be flushed to + * - hierarchy visibility needs to be ignored so that settings can get flushed + * "down" inside closed containers + */ + filter= ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS; ANIM_animdata_filter(ac, &all_data, filter, ac->data, ac->datatype); } - /* filter data that we're working on */ + /* filter data that we're working on + * - hierarchy matters if we're doing this from the channels region + * since we only want to apply this to channels we can "see", + * and have these affect their relatives + * - but for Graph Editor, this gets used also from main region + * where hierarchy doesn't apply [#21276] + */ + // FIXME: graph editor case // XXX: noduplis enabled so that results don't cancel, but will be problematic for some channels where only type differs - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS); if (onlysel) filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); @@ -1703,7 +1723,7 @@ return OPERATOR_CANCELLED; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through filtered data and clean curves */ @@ -1812,7 +1832,7 @@ UI_view2d_region_to_view(v2d, rect->xmax, rect->ymax-2, &rectf.xmax, &rectf.ymax); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop over data, doing border select */ @@ -1926,7 +1946,7 @@ /* get the channel that was clicked on */ /* filter channels */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); + filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get channel from index */ Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_deps.c =================================================================== --- branches/soc-2011-pepper/source/blender/editors/animation/anim_deps.c 2011-06-22 11:25:33 UTC (rev 37727) +++ branches/soc-2011-pepper/source/blender/editors/animation/anim_deps.c 2011-06-22 11:41:26 UTC (rev 37728) @@ -257,7 +257,7 @@ /* filter data */ /* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed */ - filter= ANIMFILTER_CHANNELS; + filter= ANIMFILTER_DATA_VISIBLE|ANIMFILTER_LIST_CHANNELS; ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* flush settings as appropriate depending on the types of the channels */ Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c =================================================================== --- branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c 2011-06-22 11:25:33 UTC (rev 37727) +++ branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c 2011-06-22 11:41:26 UTC (rev 37728) @@ -369,7 +369,7 @@ #define ANIMDATA_FILTER_CASES(id, adtOk, nlaOk, driversOk, keysOk) \ {\ if ((id)->adt) {\ - if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || !((id)->adt->flag & ADT_CURVES_NOT_VISIBLE)) {\ + if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !((id)->adt->flag & ADT_CURVES_NOT_VISIBLE)) {\ if (filter_mode & ANIMFILTER_ANIMDATA) {\ adtOk\ }\ @@ -774,11 +774,12 @@ /* check whether to continue or skip */ if ((pchan) && (pchan->bone)) { /* if only visible channels, skip if bone not visible unless user wants channels from hidden data too */ - if ((filter_mode & ANIMFILTER_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) { + if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) { bArmature *arm= (bArmature *)ob->data; if ((arm->layer & pchan->bone->layer) == 0) return 1; + // TODO: manually hidden using flags } /* can only add this F-Curve if it is selected */ @@ -881,7 +882,7 @@ } /* only include if visible (Graph Editor check, not channels check) */ - if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) { + if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (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 */ @@ -1003,7 +1004,7 @@ */ if (first_fcu) { /* add this group as a channel first */ - if ((filter_mode & ANIMFILTER_CHANNELS) || !(filter_mode & ANIMFILTER_CURVESONLY)) { + if (filter_mode & ANIMFILTER_LIST_CHANNELS) { @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs