[Bf-blender-cvs] [abc5e7d5960] master: Annotations: Set as visible when use the annotation tool

Antonio Vazquez noreply at git.blender.org
Wed Nov 4 16:13:45 CET 2020


Commit: abc5e7d59600249b4ac97b159ffe715fe463cb7f
Author: Antonio Vazquez
Date:   Wed Nov 4 15:58:35 2020 +0100
Branches: master
https://developer.blender.org/rBabc5e7d59600249b4ac97b159ffe715fe463cb7f

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  [...]

This solves the problem of T82273, T79578 and T80294

Maniphest Tasks: T82273

Differential Revision: https://developer.blender.org/D9409

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

M	source/blender/editors/gpencil/annotate_paint.c

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

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



More information about the Bf-blender-cvs mailing list