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
This commit is contained in:
Pratik Borhade
2024-10-12 00:23:49 +02:00
committed by Sean Kim
parent d177388979
commit bcf6524ca1

View File

@@ -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;