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:
Joshua Leung
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);