Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-09-04 18:16:14 +0300
committerAntonioya <blendergit@gmail.com>2018-09-04 18:16:36 +0300
commit2dff0c99c08cae80baa14f7f4b1e5d443765e273 (patch)
treea757bd4d116b39e3ea8a5e5bde5720c2154d5e3a /source/blender/editors/gpencil/gpencil_edit.c
parent30ae0ce0e14666d327a9c2cc5d5e0c9633da1e30 (diff)
Fix T56686: Crash when copy and paste Annotations
Annotations are not designed to edit, copy or paste, so the operators must be disabled. By design annotations can only be added or deleted, but not edited. Still pending clean the pie menus, but this will be done during UI cleanup.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index b9832cd6b04..48fd5736a13 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -96,11 +96,17 @@
/* Stroke Edit Mode Management */
static bool gpencil_editmode_toggle_poll(bContext *C)
{
- /* if using gpencil object, use this gpd */
+ /* edit only supported with grease pencil objects */
Object *ob = CTX_data_active_object(C);
- if ((ob) && (ob->type == OB_GPENCIL)) {
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
+ /* if using gpencil object, use this gpd */
+ if (ob->type == OB_GPENCIL) {
return ob->data != NULL;
}
+
return ED_gpencil_data_get_active(C) != NULL;
}
@@ -434,6 +440,12 @@ void GPENCIL_OT_weightmode_toggle(wmOperatorType *ot)
/* poll callback for all stroke editing operators */
static bool gp_stroke_edit_poll(bContext *C)
{
+ /* edit only supported with grease pencil objects */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
/* NOTE: this is a bit slower, but is the most accurate... */
return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
}
@@ -441,6 +453,13 @@ static bool gp_stroke_edit_poll(bContext *C)
/* poll callback to verify edit mode in 3D view only */
static bool gp_strokes_edit3d_poll(bContext *C)
{
+ /* edit only supported with grease pencil objects */
+ Object *ob = CTX_data_active_object(C);
+ if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
+ return false;
+ }
+
+
/* 2 Requirements:
* - 1) Editable GP data
* - 2) 3D View only