diff options
Diffstat (limited to 'source/blender/editors/space_nla/nla_select.c')
-rw-r--r-- | source/blender/editors/space_nla/nla_select.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 2bd2b660bcd..3e7a6f4578c 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -38,7 +38,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_math.h" #include "BKE_nla.h" #include "BKE_context.h" @@ -464,7 +463,7 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, const wm float x; /* determine which side of the current frame mouse is on */ - UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); + x = UI_view2d_region_to_view_x(v2d, event->mval[0]); if (x < CFRA) RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT); else @@ -515,7 +514,7 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s Scene *scene = ac->scene; NlaStrip *strip = NULL; int channel_index; - float xmin, xmax, dummy; + float xmin, xmax; float x, y; @@ -526,8 +525,8 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s /* 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) */ - UI_view2d_region_to_view(v2d, mval[0] - 7, mval[1], &xmin, &dummy); - UI_view2d_region_to_view(v2d, mval[0] + 7, mval[1], &xmax, &dummy); + xmin = UI_view2d_region_to_view_x(v2d, mval[0] - 7); + xmax = UI_view2d_region_to_view_x(v2d, mval[0] + 7); /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); @@ -576,14 +575,6 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s /* deselect all other channels first */ ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - - /* Highlight NLA-Track */ - if (ale->type == ANIMTYPE_NLATRACK) { - NlaTrack *nlt = (NlaTrack *)ale->data; - - nlt->flag |= NLATRACK_SELECTED; - ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK); - } } /* only select strip if we clicked on a valid channel and hit something */ @@ -595,10 +586,21 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s /* if we selected it, we can make it active too * - we always need to clear the active strip flag though... + * - as well as selecting its track... */ deselect_nla_strips(ac, DESELECT_STRIPS_CLEARACTIVE, 0); - if (strip->flag & NLASTRIP_FLAG_SELECT) + + if (strip->flag & NLASTRIP_FLAG_SELECT) { strip->flag |= NLASTRIP_FLAG_ACTIVE; + + /* Highlight NLA-Track */ + if (ale->type == ANIMTYPE_NLATRACK) { + NlaTrack *nlt = (NlaTrack *)ale->data; + + nlt->flag |= NLATRACK_SELECTED; + ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nlt, ANIMTYPE_NLATRACK); + } + } } /* free this channel */ |