From d6d101feca09ae17af00f080a76acbc4d6785c3e Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 21 Jan 2019 16:43:30 +0100 Subject: Fix T59395: Subdivision modifier with quality 1 crashes blender This is actually a workaround for the crash in OpenSubdiv. Topology refiner will have a crash when special conditions are met: - Refiner is configured to use infinitely sharp patches. - Refinement happens for the level 1 (which we call Quality 1 on Blender side). - Mesh has non-quad faces. The workaround is to force refinement to happen to level 2 (or quality 2 on Blender side) when those conditions are met. Later on with the next OpenSubdiv update we can remove this workaround, since there was work done on OpenSubdiv side to deal better with such configurations. The modifier will now be somewhat slower, but this will be compensated with upcoming topology cache enabled by default. The workaround is done when initializing settings, so the comparison of topology refiner settings is happening without any extra workarounds there. --- source/blender/modifiers/intern/MOD_multires.c | 1 + source/blender/modifiers/intern/MOD_subsurf.c | 1 + 2 files changed, 2 insertions(+) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 9775a536e99..a18fd6a4c5e 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -159,6 +159,7 @@ static Mesh *applyModifier(ModifierData *md, if (subdiv_settings.level == 0) { return result; } + BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh); Subdiv *subdiv = subdiv_descriptor_ensure(mmd, &subdiv_settings, mesh); if (subdiv == NULL) { /* Happens on bad topology, ut also on empty input mesh. */ diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 6394ab458e7..3cabd1131cb 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -206,6 +206,7 @@ static Mesh *applyModifier(ModifierData *md, if (subdiv_settings.level == 0) { return result; } + BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh); Subdiv *subdiv = subdiv_descriptor_ensure(smd, &subdiv_settings, mesh); if (subdiv == NULL) { /* Happens on bad topology, but also on empty input mesh. */ -- cgit v1.2.3