diff options
7 files changed, 40 insertions, 30 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f66e3a23bbf..ff6bd3547ce 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1825,13 +1825,14 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele bAnimListElem *ale; int filter; + SpaceNla *snla = (SpaceNla *)ac->sl; View2D *v2d= &ac->ar->v2d; rctf rectf; float ymin, ymax; /* set initial y extents */ if (ac->datatype == ANIMCONT_NLA) { - ymin = (float)(-NLACHANNEL_HEIGHT); + ymin = (float)(-NLACHANNEL_HEIGHT(snla)); ymax = 0.0f; } else { @@ -1850,7 +1851,7 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele /* loop over data, doing border select */ for (ale= anim_data.first; ale; ale= ale->next) { if (ac->datatype == ANIMCONT_NLA) - ymin= ymax - NLACHANNEL_STEP; + ymin= ymax - NLACHANNEL_STEP(snla); else ymin= ymax - ACHANNEL_STEP; diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 8454f058238..7726b02d511 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -299,11 +299,12 @@ typedef enum eAnimFilter_Flags { /* -------------- NLA Channel Defines -------------- */ /* NLA channel heights */ -#define NLACHANNEL_FIRST -16 -#define NLACHANNEL_HEIGHT 24 -#define NLACHANNEL_HEIGHT_HALF 12 -#define NLACHANNEL_SKIP 2 -#define NLACHANNEL_STEP (NLACHANNEL_HEIGHT + NLACHANNEL_SKIP) +// XXX: NLACHANNEL_FIRST isn't used? +#define NLACHANNEL_FIRST -16 +#define NLACHANNEL_HEIGHT(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? 16 : 24) +#define NLACHANNEL_HEIGHT_HALF(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? 8 : 12) +#define NLACHANNEL_SKIP 2 +#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) /* channel widths */ #define NLACHANNEL_NAMEWIDTH 200 diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index c724a7e0ea7..5e81148c231 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -302,6 +302,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event) { bAnimContext ac; + SpaceNla *snla; ARegion *ar; View2D *v2d; int channel_index; @@ -314,6 +315,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e return OPERATOR_CANCELLED; /* get useful pointers from animation context data */ + snla= (SpaceNla *)ac.sl; ar= ac.ar; v2d= &ar->v2d; @@ -329,7 +331,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e * NLACHANNEL_HEIGHT_HALF. */ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); - UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index); + UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index); /* handle mouse-click in the relevant channel then */ notifierFlags= mouse_nla_channels(&ac, x, channel_index, selectmode); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index b2a396ead98..43056e0c28c 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -514,18 +514,18 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2)); + height= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2)); /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); /* loop through channels, and set up drawing depending on their type */ - y= (float)(-NLACHANNEL_HEIGHT); + y= (float)(-NLACHANNEL_HEIGHT(snla)); for (ale= anim_data.first; ale; ale= ale->next) { - const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF); + const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla)); + const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla)); /* check if visible */ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -602,7 +602,7 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) } /* adjust y-position for next one */ - y -= NLACHANNEL_STEP; + y -= NLACHANNEL_STEP(snla); } /* free tempolary channels */ @@ -616,13 +616,14 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) // TODO: depreceate this code... static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, View2D *v2d, float y) { + SpaceNla *snla = (SpaceNla *)ac->sl; bAnimListElem *ale; float x = 0.0f; /* loop through channels, and set up drawing depending on their type */ for (ale= anim_data->first; ale; ale= ale->next) { - const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF); + const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla)); + const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla)); const float ydatac= (float)(y - 7); /* check if visible */ @@ -644,9 +645,9 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie * - need special icons for these */ if (nlt->flag & NLATRACK_SOLO) - special= ICON_LAYER_ACTIVE; + special= ICON_SPACE2; else - special= ICON_LAYER_USED; + special= ICON_SPACE3; /* if this track is active and we're tweaking it, don't draw these toggles */ // TODO: need a special macro for this... @@ -867,7 +868,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie } /* adjust y-position for next one */ - y -= NLACHANNEL_STEP; + y -= NLACHANNEL_STEP(snla); } } @@ -877,6 +878,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) bAnimListElem *ale; int filter; + SpaceNla *snla = (SpaceNla *)ac->sl; View2D *v2d= &ar->v2d; float y= 0.0f; size_t items; @@ -892,7 +894,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) * - offset of NLACHANNEL_HEIGHT*2 is added to the height of the channels, as first is for * start of list offset, and the second is as a correction for the scrollers. */ - height= ((items*NLACHANNEL_STEP) + (NLACHANNEL_HEIGHT*2)); + height= ((items*NLACHANNEL_STEP(snla)) + (NLACHANNEL_HEIGHT(snla)*2)); /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ @@ -902,14 +904,14 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) /* draw channels */ { /* first pass: backdrops + oldstyle drawing */ - y= (float)(-NLACHANNEL_HEIGHT); + y= (float)(-NLACHANNEL_HEIGHT(snla)); draw_nla_channel_list_gl(ac, &anim_data, v2d, y); } { /* second pass: UI widgets */ uiBlock *block= uiBeginBlock(C, ar, "NLA channel buttons", UI_EMBOSS); - y= (float)(-NLACHANNEL_HEIGHT); + y= (float)(-NLACHANNEL_HEIGHT(snla)); /* set blending again, as may not be set in previous step */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -917,8 +919,8 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) /* loop through channels, and set up drawing depending on their type */ for (ale= anim_data.first; ale; ale= ale->next) { - const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF); - const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF); + const float yminc= (float)(y - NLACHANNEL_HEIGHT_HALF(snla)); + const float ymaxc= (float)(y + NLACHANNEL_HEIGHT_HALF(snla)); /* check if visible */ if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -929,7 +931,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) } /* adjust y-position for next one */ - y -= NLACHANNEL_STEP; + y -= NLACHANNEL_STEP(snla); } uiEndBlock(C, block); diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 5efa3f34c98..5dc937d3ce1 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -225,9 +225,10 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh bAnimListElem *ale; int filter; + SpaceNla *snla = (SpaceNla *)ac->sl; View2D *v2d= &ac->ar->v2d; rctf rectf; - float ymin=(float)(-NLACHANNEL_HEIGHT), ymax=0; + float ymin=(float)(-NLACHANNEL_HEIGHT(snla)), ymax=0; /* convert border-region to view coordinates */ UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin+2, &rectf.xmin, &rectf.ymin); @@ -242,7 +243,7 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh /* loop over data, doing border select */ for (ale= anim_data.first; ale; ale= ale->next) { - ymin= ymax - NLACHANNEL_STEP; + ymin= ymax - NLACHANNEL_STEP(snla); /* perform vertical suitability check (if applicable) */ if ( (mode == NLA_BORDERSEL_FRAMERANGE) || @@ -505,6 +506,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], bAnimListElem *ale = NULL; int filter; + SpaceNla *snla = (SpaceNla *)ac->sl; View2D *v2d= &ac->ar->v2d; Scene *scene= ac->scene; NlaStrip *strip = NULL; @@ -515,7 +517,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], /* use View2D to determine the index of the channel (i.e a row in the list) where keyframe was */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); - UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index); + UI_view2d_listview_view_to_cell(v2d, 0, NLACHANNEL_STEP(snla), 0, (float)NLACHANNEL_HEIGHT_HALF(snla), x, y, NULL, &channel_index); /* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click * (that is the size of keyframe icons, so user should be expecting similar tolerances) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 23411b13a32..30010aad3d7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2479,6 +2479,7 @@ static short FrameOnMouseSide(char side, float frame, float cframe) static void createTransNlaData(bContext *C, TransInfo *t) { Scene *scene= t->scene; + SpaceNla *snla = NULL; TransData *td = NULL; TransDataNla *tdn = NULL; @@ -2492,6 +2493,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) /* determine what type of data we are operating on */ if (ANIM_animdata_get_context(C, &ac) == 0) return; + snla = (SpaceNla *)ac.sl; /* filter data */ filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT); @@ -2577,7 +2579,7 @@ static void createTransNlaData(bContext *C, TransInfo *t) tdn->strip= strip; tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt); - yval= (float)(tdn->trackIndex * NLACHANNEL_STEP); + yval= (float)(tdn->trackIndex * NLACHANNEL_STEP(snla)); tdn->h1[0]= strip->start; tdn->h1[1]= yval; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b62651da3d1..9b56437e985 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -573,8 +573,8 @@ void recalcData(TransInfo *t) /* now, check if we need to try and move track * - we need to calculate both, as only one may have been altered by transform if only 1 handle moved */ - delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP - tdn->trackIndex); - delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP - tdn->trackIndex); + delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); + delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); if (delta_y1 || delta_y2) { NlaTrack *track; |