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/include | |
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/include')
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 13 | ||||
-rw-r--r-- | source/blender/editors/include/UI_view2d.h | 20 |
2 files changed, 9 insertions, 24 deletions
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index d947322f708..6342a8b26d9 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -403,11 +403,13 @@ typedef enum eAnimFilter_Flags { /* -------------- Channel Defines -------------- */ /* channel heights */ -#define ACHANNEL_FIRST(ac) (-0.8f * (ac)->yscale_fac * U.widget_unit) +#define ACHANNEL_FIRST_TOP(ac) (-0.4f * (ac)->yscale_fac * U.widget_unit) #define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit) -#define ACHANNEL_HEIGHT_HALF(ac) (0.4f * (ac)->yscale_fac * U.widget_unit) #define ACHANNEL_SKIP (0.1f * U.widget_unit) #define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP) +/* Additional offset to give some room at the end. */ +#define ACHANNEL_TOT_HEIGHT(ac, item_amount) \ + (-ACHANNEL_FIRST_TOP(ac) + ACHANNEL_STEP(ac) * (item_amount + 1)) /* channel widths */ #define ACHANNEL_NAMEWIDTH (10 * U.widget_unit) @@ -418,13 +420,14 @@ typedef enum eAnimFilter_Flags { /* -------------- NLA Channel Defines -------------- */ /* NLA channel heights */ -#define NLACHANNEL_FIRST (-0.8f * U.widget_unit) +#define NLACHANNEL_FIRST_TOP(snla) (-0.4f * U.widget_unit) #define NLACHANNEL_HEIGHT(snla) \ ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit)) -#define NLACHANNEL_HEIGHT_HALF(snla) \ - ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.4f * U.widget_unit) : (0.6f * U.widget_unit)) #define NLACHANNEL_SKIP (0.1f * U.widget_unit) #define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) +/* Additional offset to give some room at the end. */ +#define NLACHANNEL_TOT_HEIGHT(snla, item_amount) \ + (-NLACHANNEL_FIRST_TOP(snla) + NLACHANNEL_STEP(snla) * (item_amount + 1)) /* channel widths */ #define NLACHANNEL_NAMEWIDTH (10 * U.widget_unit) diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 07dbb49ac07..b1dfa89ae7d 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -183,16 +183,7 @@ void UI_view2d_scrollers_draw(struct View2D *v2d, View2DScrollers *scrollers); void UI_view2d_scrollers_free(View2DScrollers *scrollers); /* list view tools */ -void UI_view2d_listview_cell_to_view(struct View2D *v2d, - float columnwidth, - float rowheight, - float startx, - float starty, - int column, - int row, - struct rctf *rect); -void UI_view2d_listview_view_to_cell(struct View2D *v2d, - float columnwidth, +void UI_view2d_listview_view_to_cell(float columnwidth, float rowheight, float startx, float starty, @@ -200,15 +191,6 @@ void UI_view2d_listview_view_to_cell(struct View2D *v2d, float viewy, int *column, int *row); -void UI_view2d_listview_visible_cells(struct View2D *v2d, - float columnwidth, - float rowheight, - float startx, - float starty, - int *column_min, - int *column_max, - int *row_min, - int *row_max); /* coordinate conversion */ float UI_view2d_region_to_view_x(const struct View2D *v2d, float x); |