Bugfix #22030: Animation Editors and Layer Animation

Added new filtering option for animation editors (indicated as the 'ghost' toggle beside the 'select'(-ed only) toggle), which will include objects/bones that aren't visible (i.e. are hidden or on a hidden layer). 

This should make it possible to edit such types of animation, and also prevent flickering as these channels come in/out of view.
This commit is contained in:
2010-07-05 04:37:30 +00:00
parent faf1c9a4bb
commit 05eb72ff14
4 changed files with 23 additions and 8 deletions

View File

@@ -797,7 +797,7 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
/* ----------------------------------------- */
/* 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)
static int skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
{
if (GS(owner_id->name) == ID_OB) {
Object *ob= (Object *)owner_id;
@@ -814,9 +814,8 @@ static int skip_fcurve_selected_data(FCurve *fcu, ID *owner_id, int filter_mode)
/* 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) {
/* 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)) {
bArmature *arm= (bArmature *)ob->data;
if ((arm->layer & pchan->bone->layer) == 0)
@@ -887,7 +886,7 @@ 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, filter_mode))
if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
continue;
}
@@ -2112,11 +2111,14 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
/* firstly, check if object can be included, by the following factors:
* - if only visible, must check for layer and also viewport visibility
* --> while tools may demand only visible, user setting takes priority
* as user option controls whether sets of channels get included while
* tool-flag takes into account collapsed/open channels too
* - if only selected, must check if object is selected
* - there must be animation data to edit
*/
// TODO: if cache is implemented, just check name here, and then
if (filter_mode & ANIMFILTER_VISIBLE) {
if ((filter_mode & ANIMFILTER_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
/* layer visibility - we check both object and base, since these may not be in sync yet */
if ((sce->lay & (ob->lay|base->lay))==0) continue;

View File

@@ -80,11 +80,15 @@ void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr)
uiLayout *row= layout;
short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
/* more 'generic' filtering options */
/* most 'generic' filtering options */
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "only_selected", 0, "", 0);
uiItemR(row, ptr, "display_transforms", 0, "", 0); // xxx: include in another position instead?
uiItemR(row, ptr, "display_hidden", 0, "", 0);
/* object-level filtering options */
row= uiLayoutRow(layout, 1);
uiItemR(row, ptr, "display_transforms", 0, "", 0);
if (nlaActive)
uiItemR(row, ptr, "include_missing_nla", 0, "", 0);

View File

@@ -550,6 +550,9 @@ typedef enum eDopeSheet_FilterFlag {
/* NLA-specific filters */
ADS_FILTER_NLA_NOACT = (1<<25), /* if the AnimData block has no NLA data, don't include to just show Action-line */
/* general filtering 3 */
ADS_FILTER_INCL_HIDDEN = (1<<26), /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
/* combination filters (some only used at runtime) */
ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR|ADS_FILTER_NOPART|ADS_FILTER_NOARM),
} eDopeSheet_FilterFlag;

View File

@@ -171,6 +171,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
prop= RNA_def_property(srna, "display_hidden", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_INCL_HIDDEN);
RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
/* Object Group Filtering Settings */
prop= RNA_def_property(srna, "only_group_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);