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
This commit is contained in:
Antonio Vazquez 2020-11-04 15:58:35 +01:00
parent b63490bc4b
commit abc5e7d596
Notes: blender-bot 2023-02-14 02:27:51 +01:00
Referenced by issue #82273, Annotations are not enabled by default in Compositor
Referenced by issue #80294, Annotation does not show in Sculpt Mode.
Referenced by issue #79578, VSE: Annotation is not working in Sequencer/Preview and displays wrong icon over Sequencer timeline
1 changed files with 38 additions and 0 deletions

View File

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