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>2019-06-28 14:54:09 +0300
committerAntonioya <blendergit@gmail.com>2019-06-28 14:56:16 +0300
commit4f3f68df300539472264412f3b79e1024f70eb0d (patch)
tree36386b46260afc6e562888bcc853c5f281262948 /source/blender/editors/gpencil
parentd7d9320f09e0f9f53c50f63a1f10984c2c1eaafe (diff)
Fix T66126: Non-active Grease Pencil object stuck in draw mode
Now the modes are reset for grease pencil objects. Differential Revision: http://developer.blender.org/D5138 Reviewers: @dfelinto
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 9588d4bb570..5459cd09e53 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4515,3 +4515,23 @@ void GPENCIL_OT_stroke_cutter(wmOperatorType *ot)
/* properties */
WM_operator_properties_gesture_lasso(ot);
}
+
+bool ED_object_gpencil_exit(struct Main *bmain, Object *ob)
+{
+ bool ok = false;
+ if (ob) {
+ bGPdata *gpd = (bGPdata *)ob->data;
+
+ gpd->flag &= ~(GP_DATA_STROKE_PAINTMODE | GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE |
+ GP_DATA_STROKE_WEIGHTMODE);
+
+ ob->restore_mode = ob->mode;
+ ob->mode &= ~(OB_MODE_PAINT_GPENCIL | OB_MODE_EDIT_GPENCIL | OB_MODE_SCULPT_GPENCIL |
+ OB_MODE_WEIGHT_GPENCIL);
+
+ /* Inform all CoW versions that we changed the mode. */
+ DEG_id_tag_update_ex(bmain, &ob->id, ID_RECALC_COPY_ON_WRITE);
+ ok = true;
+ }
+ return ok;
+}