[Bf-blender-cvs] [69a7734b75c] blender-v3.0-release: UI: always show the cursor while transforming the cursor

Campbell Barton noreply at git.blender.org
Tue Nov 2 09:36:45 CET 2021


Commit: 69a7734b75c3044b760061a1141ba6dc95e419a6
Author: Campbell Barton
Date:   Tue Nov 2 19:35:17 2021 +1100
Branches: blender-v3.0-release
https://developer.blender.org/rB69a7734b75c3044b760061a1141ba6dc95e419a6

UI: always show the cursor while transforming the cursor

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

M	source/blender/blenkernel/BKE_global.h
M	source/blender/draw/intern/draw_view.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/editors/transform/transform_convert.c

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

diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 7696b5c0189..bacdd4adc76 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -211,6 +211,12 @@ enum {
   G_TRANSFORM_SEQ = (1 << 2),
   G_TRANSFORM_FCURVES = (1 << 3),
   G_TRANSFORM_WM = (1 << 4),
+  /**
+   * Set when transforming the cursor it's self.
+   * Used as a hint to draw the cursor (even when hidden).
+   * Otherwise it's not possible to see whats being transformed.
+   */
+  G_TRANSFORM_CURSOR = (1 << 5),
 };
 
 /** Defined in blender.c */
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index bbd345271b1..de43d2aba0f 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -40,6 +40,7 @@
 
 #include "WM_types.h"
 
+#include "BKE_global.h"
 #include "BKE_object.h"
 #include "BKE_paint.h"
 
@@ -63,6 +64,10 @@ void DRW_draw_region_info(void)
 
 static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer)
 {
+  if (G.moving & G_TRANSFORM_CURSOR) {
+    return true;
+  }
+
   View3D *v3d = draw_ctx->v3d;
   if ((v3d->flag2 & V3D_HIDE_OVERLAYS) || (v3d->overlay.flag & V3D_OVERLAY_HIDE_CURSOR)) {
     return false;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 7b763ac8540..ed8305cd311 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -775,6 +775,19 @@ static void sequencer_preview_region_view2d_changed(const bContext *C, ARegion *
   sseq->flag &= ~SEQ_ZOOM_TO_FIT;
 }
 
+static bool is_cursor_visible(const SpaceSeq *sseq)
+{
+  if (G.moving & G_TRANSFORM_CURSOR) {
+    return true;
+  }
+
+  if ((sseq->flag & SEQ_SHOW_OVERLAY) &&
+      (sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_2D_CURSOR) != 0) {
+    return true;
+  }
+  return false;
+}
+
 static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
 {
   ScrArea *area = CTX_wm_area(C);
@@ -809,8 +822,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
   }
 
   /* No need to show the cursor for scopes. */
-  if (draw_overlay && (is_playing == false) && (sseq->mainb == SEQ_DRAW_IMG_IMBUF) &&
-      (sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_2D_CURSOR) != 0) {
+  if ((is_playing == false) && (sseq->mainb == SEQ_DRAW_IMG_IMBUF) && is_cursor_visible(sseq)) {
     GPU_color_mask(true, true, true, true);
     GPU_depth_mask(false);
     GPU_depth_test(GPU_DEPTH_NONE);
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index 781bf221dd2..ff20f569a71 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -965,6 +965,9 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
 int special_transform_moving(TransInfo *t)
 {
+  if (t->options & CTX_CURSOR) {
+    return G_TRANSFORM_CURSOR;
+  }
   if (t->spacetype == SPACE_SEQ) {
     return G_TRANSFORM_SEQ;
   }



More information about the Bf-blender-cvs mailing list