From bcf6524ca1eef214c36775a9599673d3333f6d32 Mon Sep 17 00:00:00 2001 From: Pratik Borhade Date: Sat, 12 Oct 2024 00:23:49 +0200 Subject: [PATCH] Fix #128601: Redoing move operation crash in sculpt mode PBVH is null when redoing the move operation. To fix this, update active object data from evaluated object before sending undo_push. Also fixed the crash in cache_init() after updating depsgraph Pull Request: https://projects.blender.org/blender/blender/pulls/128625 --- source/blender/editors/sculpt_paint/sculpt_transform.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.cc b/source/blender/editors/sculpt_paint/sculpt_transform.cc index d3b95b26d99..fe36c780a40 100644 --- a/source/blender/editors/sculpt_paint/sculpt_transform.cc +++ b/source/blender/editors/sculpt_paint/sculpt_transform.cc @@ -56,7 +56,7 @@ void init_transform(bContext *C, Object &ob, const float mval_fl[2], const char const Scene &scene = *CTX_data_scene(C); const Sculpt &sd = *CTX_data_tool_settings(C)->sculpt; SculptSession &ss = *ob.sculpt; - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ss.init_pivot_pos = ss.pivot_pos; ss.init_pivot_rot = ss.pivot_rot; @@ -66,8 +66,8 @@ void init_transform(bContext *C, Object &ob, const float mval_fl[2], const char ss.prev_pivot_rot = ss.pivot_rot; ss.prev_pivot_scale = ss.pivot_scale; - undo::push_begin_ex(scene, ob, undo_name); BKE_sculpt_update_object_for_edit(depsgraph, &ob, false); + undo::push_begin_ex(scene, ob, undo_name); ss.pivot_rot[3] = 1.0f;