UI: always show the cursor while transforming the cursor

This commit is contained in:
Campbell Barton 2021-11-02 19:35:17 +11:00
parent 2fb43f08e7
commit 69a7734b75
4 changed files with 28 additions and 2 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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;
}