diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 08:22:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 08:22:52 +0300 |
commit | 469d43b1dbc54d2afcbfe104a2d8ca9c03df9b81 (patch) | |
tree | 380520b1c0566a8f2687b42156c0cd82ff9a4e97 /source/blender/editors/sculpt_paint | |
parent | bf593a8631e84a258d1c8e5e7b198b458811c11b (diff) |
WM: publish Object.mode changes on mode switching
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 7 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 3207b4f6a0a..cbf755d26b5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -73,6 +73,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" #include "RNA_access.h" #include "RNA_define.h" @@ -1057,6 +1058,7 @@ static int texture_paint_toggle_poll(bContext *C) static int texture_paint_toggle_exec(bContext *C, wmOperator *op) { + struct wmMsgBus *mbus = CTX_wm_message_bus(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_TEXTURE_PAINT; @@ -1130,10 +1132,10 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) toggle_paint_cursor(C, 1); } - // ED_workspace_object_mode_sync_from_object(wm, workspace, ob); - WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); + WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d5991ac67d4..196505c9542 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -68,6 +68,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" #include "ED_object.h" #include "ED_mesh.h" @@ -1217,6 +1218,7 @@ void ED_object_wpaintmode_exit(struct bContext *C) */ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + struct wmMsgBus *mbus = CTX_wm_message_bus(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_WEIGHT_PAINT; const bool is_mode_set = (ob->mode & mode_flag) != 0; @@ -1248,6 +1250,8 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); + WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); + return OPERATOR_FINISHED; } @@ -2349,6 +2353,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) */ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + struct wmMsgBus *mbus = CTX_wm_message_bus(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_VERTEX_PAINT; const bool is_mode_set = (ob->mode & mode_flag) != 0; @@ -2379,6 +2384,8 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); + WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 5f5fa044f1e..048555d3fcc 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -76,6 +76,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "WM_message.h" #include "ED_sculpt.h" #include "ED_object.h" @@ -5795,6 +5796,7 @@ void ED_object_sculptmode_exit(bContext *C) static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) { + struct wmMsgBus *mbus = CTX_wm_message_bus(C); Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); @@ -5816,6 +5818,8 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); + WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode); + return OPERATOR_FINISHED; } |