From 5d548dc3a12cfaed982da2ad60bc5fbe21cf7a0d Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 29 Oct 2024 11:20:30 +0100 Subject: [PATCH] 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 --- source/blender/editors/uvedit/uvedit_unwrap_ops.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc index 92b139fa42c..42db6c2dafe 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc @@ -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(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;