Fix #128958: UV unwrap crash with "Use Subdivision" option

When the modifier is disabled with level 0, the corner_vert array
wasn't properly created in the subdivided mesh. The simplest
solution is to just skip the subdiv processing for the unwrap when
the level is 0 and nothing would happen anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/129447
This commit is contained in:
Hans Goudey
2024-10-29 11:20:30 +01:00
committed by Hans Goudey
parent 28a8486e2b
commit 5d548dc3a1

View File

@@ -222,7 +222,15 @@ static void modifier_unwrap_state(Object *obedit,
* only if modifier is first or right after mirror. */
if (subsurf) {
if (md && md->type == eModifierType_Subsurf) {
subsurf = true;
const SubsurfModifierData &smd = *reinterpret_cast<const SubsurfModifierData *>(md);
if (smd.levels > 0) {
/* Skip all calculation for zero subdivision levels, similar to the way the modifier is
* disabled in that case. */
subsurf = true;
}
else {
subsurf = false;
}
}
else {
subsurf = false;