[Bf-blender-cvs] [0487089c314] blender2.8: Enable annotations when GP object is selected.
Antonioya
noreply at git.blender.org
Thu Nov 29 22:00:04 CET 2018
Commit: 0487089c3146755dd7a19238cd9595744c5fee65
Author: Antonioya
Date: Thu Nov 29 21:59:29 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB0487089c3146755dd7a19238cd9595744c5fee65
Enable annotations when GP object is selected.
Now when try to add annotation, if a grease pencil object is selected, first the object is unselected. This solution is not perfect but it's better than cancel the annotation.
Thanks Dalai for his help.
===================================================================
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 3a9b7e7306c..c5dcb51ff6e 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -49,6 +49,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
+#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_screen.h"
@@ -1867,15 +1868,24 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
{
Object *ob = CTX_data_active_object(C);
ScrArea *sa = CTX_wm_area(C);
+ Scene *scene = CTX_data_scene(C);
tGPsdata *p = NULL;
- /* GPXX Need a better solution */
+ /* if try to do annotations with a gp object selected, first
+ * unselect the object to avoid conflicts.
+ * The solution is not perfect but we can keep running the annotations while
+ * found a better solution.
+ */
if (sa && sa->spacetype == SPACE_VIEW3D) {
if ((ob != NULL) && (ob->type == OB_GPENCIL)) {
- BKE_report(op->reports, RPT_ERROR, "Cannot draw annotation with a Grease Pencil object active");
- return OPERATOR_CANCELLED;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ BKE_view_layer_base_deselect_all(view_layer);
+ view_layer->basact = NULL;
+ DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
+
if (G.debug & G_DEBUG)
printf("GPencil - Starting Drawing\n");
More information about the Bf-blender-cvs
mailing list