GP: Disable Draw Modes if enable Annotation

When enable annotations with a grease pencil object, the GP Object must be set to Object mode because the annotation Draw and the GP draw are incompatible.
This commit is contained in:
Antonio Vazquez 2018-12-05 16:31:29 +01:00
parent 3e1ca9a693
commit 6dcb474dd4
1 changed files with 3 additions and 0 deletions

View File

@ -1880,6 +1880,9 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
*/
if (sa && sa->spacetype == SPACE_VIEW3D) {
if ((ob != NULL) && (ob->type == OB_GPENCIL)) {
ob->mode = OB_MODE_OBJECT;
ED_gpencil_setup_modes(C, (bGPdata *)ob->data, 0);
ViewLayer *view_layer = CTX_data_view_layer(C);
BKE_view_layer_base_deselect_all(view_layer);
view_layer->basact = NULL;