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
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-28 23:57:22 +0300
committerHans Goudey <h.goudey@me.com>2022-06-28 23:57:22 +0300
commit1c61db5346d05113ced80d174a80539666e5d97d (patch)
tree8626a8a29cded3239401cfa5498360bd6c3c9385 /source
parent33be9c08856fb0fbdafdc12843addc944ce4183b (diff)
Fix: Flush mode to evaluated object when exiting curves sculpt mode
Tagging the object for copy on write in order to change the mode on the evaluated object was already done when entering sculpt mode, it should happen when exiting sculpt mode as well. Also use the message system to tag updates of the mode property. This is commonly done for other "mode switch" operators. It's best to be consistent here, though I don't know that lacking that caused any issues.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_ops.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index 2ecbc7ab051..e6da2039433 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -8,6 +8,7 @@
#include "BKE_paint.h"
#include "WM_api.h"
+#include "WM_message.h"
#include "WM_toolsystem.h"
#include "ED_curves_sculpt.h"
@@ -250,6 +251,8 @@ static bool curves_sculptmode_toggle_poll(bContext *C)
static void curves_sculptmode_enter(bContext *C)
{
Scene *scene = CTX_data_scene(C);
+ wmMsgBus *mbus = CTX_wm_message_bus(C);
+
Object *ob = CTX_data_active_object(C);
BKE_paint_ensure(scene->toolsettings, (Paint **)&scene->toolsettings->curves_sculpt);
CurvesSculpt *curves_sculpt = scene->toolsettings->curves_sculpt;
@@ -258,8 +261,9 @@ static void curves_sculptmode_enter(bContext *C)
ED_paint_cursor_start(&curves_sculpt->paint, CURVES_SCULPT_mode_poll_view3d);
- /* Update for mode change. */
+ /* Necessary to change the object mode on the evaluated object. */
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, nullptr);
}
@@ -272,6 +276,8 @@ static void curves_sculptmode_exit(bContext *C)
static int curves_sculptmode_toggle_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
+ wmMsgBus *mbus = CTX_wm_message_bus(C);
+
const bool is_mode_set = ob->mode == OB_MODE_SCULPT_CURVES;
if (is_mode_set) {
@@ -288,6 +294,10 @@ static int curves_sculptmode_toggle_exec(bContext *C, wmOperator *op)
}
WM_toolsystem_update_from_context_view3d(C);
+
+ /* Necessary to change the object mode on the evaluated object. */
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, nullptr);
return OPERATOR_FINISHED;
}