Fix #124484: Debug assert on undoing out of Sculpt Mode

While this is a rather fragile fix, the alternative also seems fragile.
We can instead check the operator name inside `push_begin_ex` to see if
the operator is transitioning into Sculpt Mode and initialize the
StepData.type to a custom "Mode Change" type instead of using "None"

Pull Request: https://projects.blender.org/blender/blender/pulls/124640
This commit is contained in:
Sean Kim
2024-07-16 21:27:11 +02:00
committed by Sean Kim
parent dd86ad6f23
commit 2e487ec92e

View File

@@ -911,6 +911,12 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, StepData &step_data)
return;
}
/* Switching to sculpt mode does not push a particular type.
* See #124484. */
if (step_data.type == Type::None && step_data.nodes.is_empty()) {
return;
}
const bool tag_update = ID_REAL_USERS(object.data) > 1 ||
!BKE_sculptsession_use_pbvh_draw(&object, rv3d) || ss.shapekey_active ||
ss.deform_modifiers_active;