Fix T58310: Crash when removing multires modifier from sculpt object

This commit is contained in:
Sergey Sharybin 2018-12-06 15:20:16 +01:00
parent b0726b31e6
commit c8467ccc8d
Notes: blender-bot 2023-06-21 19:23:24 +02:00
Referenced by issue #58310, Crash When Removing Multi-Res Modifier from Sculpt Object
2 changed files with 8 additions and 0 deletions

View File

@ -1163,6 +1163,11 @@ bool multiresModifier_reshapeFromCCG(
return false;
}
MDisps *mdisps = CustomData_get_layer(&coarse_mesh->ldata, CD_MDISPS);
if (mdisps == NULL) {
/* Multires displacement has been removed before current changes were
* applies to all the levels. */
return false;
}
GridPaintMask *grid_paint_mask =
CustomData_get_layer(&coarse_mesh->ldata, CD_GRID_PAINT_MASK);
Subdiv *subdiv = subdiv_ccg->subdiv;

View File

@ -425,6 +425,9 @@ static void object_update_from_subsurf_ccg(Object *object)
Mesh *mesh_cow = object->runtime.mesh_orig;
copy_ccg_data(mesh_cow, mesh_orig, CD_MDISPS);
copy_ccg_data(mesh_cow, mesh_orig, CD_GRID_PAINT_MASK);
/* Everything is now up-to-date. */
subdiv_ccg->dirty.coords = false;
subdiv_ccg->dirty.hidden = false;
}
/* free data derived from mesh, called when mesh changes or is freed */