diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-05-03 14:00:18 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-05-03 14:05:03 +0300 |
commit | fa59346c1340da4189e5c7d38164a74dc096db10 (patch) | |
tree | e1d7a70936b38a284d68b5b7e2721cfbeb75ce33 /source/blender/editors/space_nla/nla_channels.c | |
parent | b5eb6548d1e7f8c01d84e4949ce614c83c7174c8 (diff) |
Refactor: Support arbitrary y offset for channel list
At first you could think that this refactor would not be
necessary, because `ACHANNEL_FIRST` exists already.
It contained the small y offset that all channels had.
Unfortunately, a lot of code assumed that
`ACHANNEL_FIRST = -ACHANNEL_HEIGHT`, making the
define pretty much useless. This refactor fixes that
for the action and nla editor.
As a nice side effect, this patch fixes channel box select.
Before there was always have a half-channel offset.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4783
Diffstat (limited to 'source/blender/editors/space_nla/nla_channels.c')
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 4115d6b49ba..3e4eb6af098 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -384,19 +384,12 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv selectmode = SELECT_REPLACE; } - /** - * Figure out which channel user clicked in: - * - * \note Although channels technically start at y= NLACHANNEL_FIRST, - * we need to adjust by half a channel's height so that the tops of channels get caught ok. - * Since NLACHANNEL_FIRST is really NLACHANNEL_HEIGHT, we simply use NLACHANNEL_HEIGHT_HALF. - */ + /* Figure out which channel user clicked in. */ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); - UI_view2d_listview_view_to_cell(v2d, - NLACHANNEL_NAMEWIDTH, + UI_view2d_listview_view_to_cell(NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP(snla), 0, - (float)NLACHANNEL_HEIGHT_HALF(snla), + NLACHANNEL_FIRST_TOP(snla), x, y, NULL, |