Fix T70905: Image Editor header hides mask, cache and keyframe info if
flipped to bottom While flipping the header to bottom works in the MCE (because MCE doesnt allow overlapping UI) we need to take the regions visible rect into account for the Image Editor. Also correct clickable scubbing area (poll for frame_change) in the Image Editor and the MovieClip Editor not taking UI_DPI_FAC into account. Maniphest Tasks: T70905 Differential Revision: https://developer.blender.org/D6090
This commit is contained in:
@@ -404,13 +404,10 @@ void ED_screen_user_menu_register(void);
|
||||
|
||||
/* Cache display helpers */
|
||||
|
||||
void ED_region_cache_draw_background(const struct ARegion *ar);
|
||||
void ED_region_cache_draw_background(struct ARegion *ar);
|
||||
void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y);
|
||||
void ED_region_cache_draw_cached_segments(const struct ARegion *ar,
|
||||
const int num_segments,
|
||||
const int *points,
|
||||
const int sfra,
|
||||
const int efra);
|
||||
void ED_region_cache_draw_cached_segments(
|
||||
struct ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra);
|
||||
|
||||
/* area_utils.c */
|
||||
void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "ED_clip.h"
|
||||
#include "ED_mask.h" /* own include */
|
||||
#include "ED_screen.h"
|
||||
#include "ED_space_api.h"
|
||||
|
||||
#include "BIF_glutil.h"
|
||||
@@ -802,6 +803,10 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra
|
||||
unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes);
|
||||
|
||||
if (num_lines > 0) {
|
||||
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
|
||||
const rcti *rect_visible = ED_region_visible_rect(ar);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
|
||||
@@ -817,8 +822,8 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra
|
||||
/* draw_keyframe(i, CFRA, sfra, framelen, 1); */
|
||||
int height = (frame == cfra) ? 22 : 10;
|
||||
int x = (frame - sfra) * framelen;
|
||||
immVertex2i(pos, x, 0);
|
||||
immVertex2i(pos, x, height);
|
||||
immVertex2i(pos, x, region_bottom);
|
||||
immVertex2i(pos, x, region_bottom + height * UI_DPI_FAC);
|
||||
}
|
||||
immEnd();
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -3337,13 +3337,17 @@ const rcti *ED_region_visible_rect(ARegion *ar)
|
||||
|
||||
/* Cache display helpers */
|
||||
|
||||
void ED_region_cache_draw_background(const ARegion *ar)
|
||||
void ED_region_cache_draw_background(ARegion *ar)
|
||||
{
|
||||
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
|
||||
const rcti *rect_visible = ED_region_visible_rect(ar);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformColor4ub(128, 128, 255, 64);
|
||||
immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC);
|
||||
immRecti(pos, 0, region_bottom, ar->winx, region_bottom + 8 * UI_DPI_FAC);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
@@ -3373,9 +3377,13 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f
|
||||
}
|
||||
|
||||
void ED_region_cache_draw_cached_segments(
|
||||
const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra)
|
||||
ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra)
|
||||
{
|
||||
if (num_segments) {
|
||||
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
|
||||
const rcti *rect_visible = ED_region_visible_rect(ar);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
@@ -3385,7 +3393,7 @@ void ED_region_cache_draw_cached_segments(
|
||||
float x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx;
|
||||
float x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx;
|
||||
|
||||
immRecti(pos, x1, 0, x2, 8 * UI_DPI_FAC);
|
||||
immRecti(pos, x1, region_bottom, x2, region_bottom + 8 * UI_DPI_FAC);
|
||||
/* TODO(merwin): use primitive restart to draw multiple rects more efficiently */
|
||||
}
|
||||
|
||||
|
||||
@@ -1118,7 +1118,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
if (event->mval[1] > 16) {
|
||||
if (event->mval[1] > 16 * UI_DPI_FAC) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,6 +901,10 @@ void draw_image_cache(const bContext *C, ARegion *ar)
|
||||
mask = ED_space_image_get_mask(sima);
|
||||
}
|
||||
|
||||
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
|
||||
const rcti *rect_visible = ED_region_visible_rect(ar);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
GPU_blend(true);
|
||||
GPU_blend_set_func_separate(
|
||||
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -928,10 +932,10 @@ void draw_image_cache(const bContext *C, ARegion *ar)
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
immUniformThemeColor(TH_CFRAME);
|
||||
immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
|
||||
immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_DPI_FAC);
|
||||
immUnbindProgram();
|
||||
|
||||
ED_region_cache_draw_curfra_label(cfra, x, 8.0f * UI_DPI_FAC);
|
||||
ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC);
|
||||
|
||||
if (mask != NULL) {
|
||||
ED_mask_draw_frames(mask, ar, cfra, sfra, efra);
|
||||
|
||||
@@ -3886,7 +3886,12 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
|
||||
|
||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
if (event->mval[1] > 16 || !ED_space_image_show_cache(sima)) {
|
||||
|
||||
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
|
||||
const rcti *rect_visible = ED_region_visible_rect(ar);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
if (event->mval[1] > (region_bottom + 16 * UI_DPI_FAC) || !ED_space_image_show_cache(sima)) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user