NLA SoC: Improved anim-channel filtering flags for NLA so that channels don't need to be checked to be NLA-Tracks before being used.

This commit is contained in:
Joshua Leung
2009-06-09 12:28:10 +00:00
parent 096e2f0b5a
commit ca5ff43b1f
4 changed files with 22 additions and 24 deletions

View File

@@ -1050,7 +1050,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
int items = 0;
/* add this object as a channel first */
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
if ((filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) == 0) {
/* check if filtering by selection */
if ANIMCHANNEL_SELOK((base->flag & SELECT)) {
ale= make_new_animlistelem(base, ANIMTYPE_OBJECT, NULL, ANIMTYPE_NONE, NULL);
@@ -1062,7 +1062,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
}
/* if collapsed, don't go any further (unless adding keyframes only) */
if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
if ( (EXPANDED_OBJC(ob) == 0) && !(filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) )
return items;
/* Action, Drivers, or NLA */
@@ -1073,7 +1073,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
{ /* nla */
#if 0
/* include nla-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
if (ale) {
BLI_addtail(anim_data, ale);
@@ -1129,7 +1129,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
{ /* nla */
#if 0
/* include nla-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_OBJECT, (ID *)ob);
if (ale) {
BLI_addtail(anim_data, ale);
@@ -1235,7 +1235,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
int items = 0;
/* add scene as a channel first (even if we aren't showing scenes we still need to show the scene's sub-data */
if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
if ((filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) == 0) {
/* check if filtering by selection */
if (ANIMCHANNEL_SELOK( (sce->flag & SCE_DS_SELECTED) )) {
ale= make_new_animlistelem(sce, ANIMTYPE_SCENE, NULL, ANIMTYPE_NONE, NULL);
@@ -1247,7 +1247,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
}
/* if collapsed, don't go any further (unless adding keyframes only) */
if ( (EXPANDED_SCEC(sce) == 0) && !(filter_mode & ANIMFILTER_CURVESONLY) )
if ( (EXPANDED_SCEC(sce) == 0) && !(filter_mode & (ANIMFILTER_CURVESONLY|ANIMFILTER_NLATRACKS)) )
return items;
/* Action, Drivers, or NLA for Scene */
@@ -1258,7 +1258,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
{ /* nla */
#if 0
/* include nla-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_SCENE (ID *)sce);
if (ale) {
BLI_addtail(anim_data, ale);
@@ -1312,7 +1312,7 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
{ /* nla */
#if 0
/* include nla-expand widget? */
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_NLATRACKS)) {
ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLNLA, base, ANIMTYPE_DSWOR (ID *)wo);
if (ale) {
BLI_addtail(anim_data, ale);

View File

@@ -162,8 +162,9 @@ typedef enum eAnimFilter_Flags {
ANIMFILTER_CHANNELS = (1<<5), /* make list for interface drawing */
ANIMFILTER_ACTGROUPED = (1<<6), /* belongs to the active actiongroup */
ANIMFILTER_CURVEVISIBLE = (1<<7), /* F-Curve is visible for editing/viewing in Graph Editor */
ANIMFILTER_ACTIVE = (1<<8), /* channel should be 'active' */ // FIXME: this is only relevant for F-Curves for now
ANIMFILTER_ACTIVE = (1<<8), /* channel should be 'active' */
ANIMFILTER_ANIMDATA = (1<<9), /* only return the underlying AnimData blocks (not the tracks, etc.) data comes from */
ANIMFILTER_NLATRACKS = (1<<10), /* only include NLA-tracks */
} eAnimFilter_Flags;

View File

@@ -120,8 +120,8 @@ static void deselect_nla_strips (bAnimContext *ac, short test, short sel)
int filter;
short smode;
/* determine type-based settings - curvesonly eliminates all the unnecessary channels... */
filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY);
/* determine type-based settings */
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);

View File

@@ -2595,7 +2595,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
return;
/* filter data */
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
@@ -2613,18 +2613,15 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* loop 1: count how many strips are selected (consider each strip as 2 points) */
for (ale= anim_data.first; ale; ale= ale->next) {
/* only if a real NLA-track */
if (ale->type == ANIMTYPE_NLATRACK) {
NlaTrack *nlt= (NlaTrack *)ale->data;
NlaStrip *strip;
/* only consider selected strips */
for (strip= nlt->strips.first; strip; strip= strip->next) {
// TODO: we can make strips have handles later on...
if (strip->flag & NLASTRIP_FLAG_SELECT) {
if (FrameOnMouseSide(side, strip->start, (float)CFRA)) count++;
if (FrameOnMouseSide(side, strip->end, (float)CFRA)) count++;
}
NlaTrack *nlt= (NlaTrack *)ale->data;
NlaStrip *strip;
/* only consider selected strips */
for (strip= nlt->strips.first; strip; strip= strip->next) {
// TODO: we can make strips have handles later on...
if (strip->flag & NLASTRIP_FLAG_SELECT) {
if (FrameOnMouseSide(side, strip->start, (float)CFRA)) count++;
if (FrameOnMouseSide(side, strip->end, (float)CFRA)) count++;
}
}
}