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:
authorCampbell Barton <ideasman42@gmail.com>2018-09-07 06:35:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-07 06:41:31 +0300
commit066afa219839b6953c1cb6a0b1ba3c35002bc7a2 (patch)
tree9caeb25d3298160240030de255cf83b3022eace2 /source/blender/editors/gpencil/gpencil_edit.c
parentee6b95f7e0c19c47e8e4a550e0b0bb51de79508e (diff)
Fix T56707: Assert changing grease pencil modes
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 48fd5736a13..116c16c6ea4 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -73,6 +73,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
+#include "WM_toolsystem.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -113,8 +115,10 @@ static bool gpencil_editmode_toggle_poll(bContext *C)
static int gpencil_editmode_toggle_exec(bContext *C, wmOperator *op)
{
const int back = RNA_boolean_get(op->ptr, "back");
- Depsgraph *depsgraph = CTX_data_depsgraph(C); \
- bGPdata *gpd = ED_gpencil_data_get_active(C);
+
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ bGPdata *gpd = ED_gpencil_data_get_active(C);
bool is_object = false;
short mode;
/* if using a gpencil object, use this datablock */
@@ -161,6 +165,13 @@ static int gpencil_editmode_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_GPENCIL | ND_GPENCIL_EDITMODE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+ if (is_object) {
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
+ }
+ if (G.background == false) {
+ WM_toolsystem_update_from_context_view3d(C);
+ }
+
return OPERATOR_FINISHED;
}
@@ -201,6 +212,7 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op)
{
const bool back = RNA_boolean_get(op->ptr, "back");
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -250,6 +262,13 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+ if (is_object) {
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
+ }
+ if (G.background == false) {
+ WM_toolsystem_update_from_context_view3d(C);
+ }
+
return OPERATOR_FINISHED;
}
@@ -290,6 +309,7 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op)
{
const bool back = RNA_boolean_get(op->ptr, "back");
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
bool is_object = false;
short mode;
@@ -330,6 +350,13 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+ if (is_object) {
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
+ }
+ if (G.background == false) {
+ WM_toolsystem_update_from_context_view3d(C);
+ }
+
return OPERATOR_FINISHED;
}
@@ -370,6 +397,7 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
{
const bool back = RNA_boolean_get(op->ptr, "back");
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
bGPdata *gpd = ED_gpencil_data_get_active(C);
bool is_object = false;
short mode;
@@ -410,6 +438,13 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+ if (is_object) {
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
+ }
+ if (G.background == false) {
+ WM_toolsystem_update_from_context_view3d(C);
+ }
+
return OPERATOR_FINISHED;
}