[Bf-blender-cvs] [87ac3d14b29] blender-v2.81-release: Fix T70905: Image Editor header hides mask, cache and keyframe info if flipped to bottom

Philipp Oeser noreply at git.blender.org
Tue Oct 29 17:20:46 CET 2019


Commit: 87ac3d14b29d61d74b9aee2296f5b9892e2aa4a0
Author: Philipp Oeser
Date:   Tue Oct 29 16:49:27 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB87ac3d14b29d61d74b9aee2296f5b9892e2aa4a0

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

===================================================================

M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_image/image_ops.c

===================================================================

diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index c3e61f5f2b2..4ca7c8f96ad 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -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,
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 7247697dcb7..85fedac05ce 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.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();
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c068fbdf7cb..bf45fa24923 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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 */
     }
 
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 192449a219d..4a4b85cbf8f 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -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;
     }
   }
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 9a2b0d95c20..2d4ca6dc15a 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -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);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index a8dfad85232..8d17b703449 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -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;
     }
   }



More information about the Bf-blender-cvs mailing list