diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-11-04 17:58:35 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-11-04 18:13:39 +0300 |
commit | abc5e7d59600249b4ac97b159ffe715fe463cb7f (patch) | |
tree | f547de6d914ccbcff41831168cfb3e7ec0a93944 /source/blender | |
parent | b63490bc4bc214853c6af7021ae1000c9cc5c092 (diff) |
Annotations: Set as visible when use the annotation tool
If the annotation draw operator is used, enable the annotations in the current area.
Before this change, some editors had the annotation flag set to OFF, but this could be solved with a versioning code, but this did not solve the root problem. The user can disable annotation visibility in the overlay or side panel, depending on the editor. If the user uses the annotation tool and this flag is OFF, the annotation is not visible, and this is not correct. With this patch, every time the user uses the tool, the annotation visibility flag is set to ON to ensure the annotation is visible.
This solves the problem of T82273, T79578 and T80294
Maniphest Tasks: T82273
Differential Revision: https://developer.blender.org/D9409
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index c06a2f06a98..1a0a3e578ee 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -1432,6 +1432,41 @@ static bool annotation_session_initdata(bContext *C, tGPsdata *p) return 1; } +/* Enable the annotations in the current space. */ +static void annotation_visible_on_space(tGPsdata *p) +{ + ScrArea *area = p->area; + switch (area->spacetype) { + case SPACE_VIEW3D: { + View3D *v3d = (View3D *)area->spacedata.first; + v3d->flag2 |= V3D_SHOW_ANNOTATION; + break; + } + case SPACE_SEQ: { + SpaceSeq *sseq = (SpaceSeq *)area->spacedata.first; + sseq->flag |= SEQ_SHOW_GPENCIL; + break; + } + case SPACE_IMAGE: { + SpaceImage *sima = (SpaceImage *)area->spacedata.first; + sima->flag |= SI_SHOW_GPENCIL; + break; + } + case SPACE_NODE: { + SpaceNode *snode = (SpaceNode *)area->spacedata.first; + snode->flag |= SNODE_SHOW_GPENCIL; + break; + } + case SPACE_CLIP: { + SpaceClip *sclip = (SpaceClip *)area->spacedata.first; + sclip->flag |= SC_SHOW_ANNOTATION; + break; + } + default: + break; + } +} + /* init new painting session */ static tGPsdata *annotation_session_initpaint(bContext *C) { @@ -1458,6 +1493,9 @@ static tGPsdata *annotation_session_initpaint(bContext *C) */ p->radius = U.gp_eraser; + /* Annotations must be always visible when use it. */ + annotation_visible_on_space(p); + /* return context data for running paint operator */ return p; } |