diff options
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 34 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_select.c | 8 |
3 files changed, 26 insertions, 20 deletions
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) |