[Bf-blender-cvs] [f404dd0b3c7] master: Fix Unreported: VSE and NLA handle position text is not drawn

Richard Antalik noreply at git.blender.org
Thu Sep 15 01:12:49 CEST 2022


Commit: f404dd0b3c7732379a83b55362c49e2ad15bca25
Author: Richard Antalik
Date:   Thu Sep 15 00:54:17 2022 +0200
Branches: master
https://developer.blender.org/rBf404dd0b3c7732379a83b55362c49e2ad15bca25

Fix Unreported: VSE and NLA handle position text is not drawn

When moving strip, or it's handle, text with frame number near handle
should be drawn. This feature was broken by 8d53ead69bb5, because
function `UI_view2d_text_cache_add` sets all fields of `v2s->rect` to 0.
This case was checked in function `UI_view2d_text_cache_draw`, but it
was not quite obvious.

This commit reverts 8d53ead69bb5, makes condition for 0 size rectangle
more obvious and adds comment for clarity.

function `UI_view2d_text_cache_add` is only used in NLA and VSE, and
this new condition fits existing use-cases. Status of T97500 is not
affected by this change.

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

M	source/blender/editors/interface/view2d.cc

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

diff --git a/source/blender/editors/interface/view2d.cc b/source/blender/editors/interface/view2d.cc
index bb459f227f9..b5a86ebe18b 100644
--- a/source/blender/editors/interface/view2d.cc
+++ b/source/blender/editors/interface/view2d.cc
@@ -2100,12 +2100,22 @@ void UI_view2d_text_cache_draw(ARegion *region)
       col_pack_prev = v2s->col.pack;
     }
 
-    BLF_enable(font_id, BLF_CLIPPING);
-    BLF_clipping(
-        font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
-    BLF_draw_default(
-        v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f, v2s->str, BLF_DRAW_STR_DUMMY_MAX);
-    BLF_disable(font_id, BLF_CLIPPING);
+    /* Don't use clipping if `v2s->rect` is not set. */
+    if (BLI_rcti_size_x(&v2s->rect) == 0 && BLI_rcti_size_y(&v2s->rect) == 0) {
+      BLF_draw_default((float)(v2s->mval[0] + xofs),
+                       (float)(v2s->mval[1] + yofs),
+                       0.0,
+                       v2s->str,
+                       BLF_DRAW_STR_DUMMY_MAX);
+    }
+    else {
+      BLF_enable(font_id, BLF_CLIPPING);
+      BLF_clipping(
+          font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
+      BLF_draw_default(
+          v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f, v2s->str, BLF_DRAW_STR_DUMMY_MAX);
+      BLF_disable(font_id, BLF_CLIPPING);
+    }
   }
   g_v2d_strings = nullptr;



More information about the Bf-blender-cvs mailing list