diff options
author | Antonioya <blendergit@gmail.com> | 2019-03-06 12:54:38 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-03-06 12:54:38 +0300 |
commit | ce8d6afb63732771677eb54720903fc8a018a1bf (patch) | |
tree | 5acf968ab6876485a76ab13ebc59e120251a325d /source/blender/editors | |
parent | 3b1e2a4f5657b88c3d2bd0e3ff7f4ae07da61da7 (diff) |
Fix T62230: Annotations corrupts GPencil brushes
Use annotations inside grease pencil drawing mode is something incompatible by design. Actually, the annotations are disabled in overlay panel for 2D template and the tool icon is not in the toolbar.
The unique way to get annotations was using D key, but this is wrong.
If you are inside drawing mode, all the events are captured by paint operator and to capture annotations, the operator must be canceled and the mode changed, but this change breaks several things.
It's not logic add annotation inside darwing mode, because you can simply add a new layer and write the text you want.
This change checks the mode and cancel the annotations if the mode is not thje right one.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 12f7032ef84..1c2ad3d2a95 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -219,12 +219,24 @@ static void gp_session_validatebuffer(tGPsdata *p); /* check if context is suitable for drawing */ static bool gpencil_draw_poll(bContext *C) { + /* if is inside grease pencil draw mode cannot use annotations */ + Object *obact = CTX_data_active_object(C); + ScrArea *sa = CTX_wm_area(C); + if ((sa) && (sa->spacetype == SPACE_VIEW3D)) { + if ((obact) && (obact->type == OB_GPENCIL) + && (obact->mode == OB_MODE_PAINT_GPENCIL)) { + CTX_wm_operator_poll_msg_set(C, + "Annotation cannot be used in grease pencil draw mode"); + return false; + } + } + if (ED_operator_regionactive(C)) { /* check if current context can support GPencil data */ if (ED_gpencil_data_get_pointers(C, NULL) != NULL) { /* check if Grease Pencil isn't already running */ if (ED_gpencil_session_active() == 0) - return 1; + return true; else CTX_wm_operator_poll_msg_set(C, "Annotation operator is already active"); } @@ -236,7 +248,7 @@ static bool gpencil_draw_poll(bContext *C) CTX_wm_operator_poll_msg_set(C, "Active region not set"); } - return 0; + return false; } /* check if projecting strokes into 3d-geometry in the 3D-View */ |