diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-19 04:26:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-19 04:30:16 +0300 |
commit | fd42fe661612455c2d2558481c6587c0b7d95366 (patch) | |
tree | 529cb8fba092d866c9b89d460ac2c880f94ae1e8 /source/blender | |
parent | bb4ed5ce39cb2c07bfd97deb46a30b5505bbbf76 (diff) |
Fix T57139: Transform overlay shows even when disabled
Transform bypasses the gizmo API for drawing overlays,
so custom checks are needed.
Also don't draw the gizmo in other windows when transforming.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/transform/transform.c | 72 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_gizmo_3d.c | 8 |
2 files changed, 59 insertions, 21 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 90bfaf7bc9d..2aff12266a7 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1942,22 +1942,47 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } } -static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), void *arg) +static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *ar) +{ + /* Don't show overlays when not the active view and when overlay is disabled: T57139 */ + bool ok = false; + if (ar == t->ar) { + ok = true; + } + else { + ScrArea *sa = CTX_wm_area(C); + if (sa->spacetype == SPACE_VIEW3D) { + View3D *v3d = sa->spacedata.first; + if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { + ok = true; + } + } + } + return ok; +} + +static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg) { TransInfo *t = arg; + if (!transinfo_show_overlay(C, t, ar)) { + return; + } + GPU_line_width(1.0f); drawConstraint(t); drawPropCircle(C, t); drawSnapping(C, t); - /* edge slide, vert slide */ - drawEdgeSlide(t); - drawVertSlide(t); + if (ar == t->ar) { + /* edge slide, vert slide */ + drawEdgeSlide(t); + drawVertSlide(t); - /* Rotation */ - drawDial3d(t); + /* Rotation */ + drawDial3d(t); + } } /* just draw a little warning message in the top-right corner of the viewport to warn that autokeying is enabled */ @@ -2000,23 +2025,30 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) GPU_blend(false); } -static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg) +static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg) { TransInfo *t = arg; - Scene *scene = t->scene; - ViewLayer *view_layer = t->view_layer; - Object *ob = OBACT(view_layer); - /* draw autokeyframing hint in the corner - * - only draw if enabled (advanced users may be distracted/annoyed), - * for objects that will be autokeyframed (no point otherwise), - * AND only for the active region (as showing all is too overwhelming) - */ - if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { - if (ar == t->ar) { - if (t->flag & (T_OBJECT | T_POSE)) { - if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { - drawAutoKeyWarning(t, ar); + if (!transinfo_show_overlay(C, t, ar)) { + return; + } + + if (ar == t->ar) { + Scene *scene = t->scene; + ViewLayer *view_layer = t->view_layer; + Object *ob = OBACT(view_layer); + + /* draw autokeyframing hint in the corner + * - only draw if enabled (advanced users may be distracted/annoyed), + * for objects that will be autokeyframed (no point otherwise), + * AND only for the active region (as showing all is too overwhelming) + */ + if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) { + if (ar == t->ar) { + if (t->flag & (T_OBJECT | T_POSE)) { + if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { + drawAutoKeyWarning(t, ar); + } } } } diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 1913e35c1da..5a26245c14d 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -785,7 +785,7 @@ int ED_transform_calc_gizmo_stats( const bool use_mat_local = true; for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { /* only editable and visible layers are considered */ - + if (gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { /* calculate difference matrix */ @@ -1822,6 +1822,9 @@ static bool WIDGETGROUP_gizmo_poll(const struct bContext *C, struct wmGizmoGroup if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) { return false; } + if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) { + return false; + } return true; } @@ -1876,6 +1879,9 @@ static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmGizmoGroupType *gzg if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) { return false; } + if (G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) { + return false; + } return true; } |