Fix T76573: Make links with Multires leading to crash

This commit is contained in:
Sergey Sharybin 2020-05-18 10:48:45 +02:00
parent 52d8b3a014
commit 04d15f1625
Notes: blender-bot 2023-02-14 11:21:43 +01:00
Referenced by issue #76573, Make links with Multires leading to crash
1 changed files with 10 additions and 1 deletions

View File

@ -188,7 +188,16 @@ void multiresModifier_subdivide_to_level(struct Object *object,
if (!has_mdisps) {
CustomData_add_layer(&coarse_mesh->ldata, CD_MDISPS, CD_CALLOC, NULL, coarse_mesh->totloop);
}
if (!has_mdisps || top_level == 1) {
/* NOTE: Subdivision happens from the top level of the existing multires modifier. If it is set
* to 0 and there is mdisps layer it would mean that the modifier went out of sync with the data.
* This happens when, for example, linking modifiers from one object to another.
*
* In such cases simply ensure grids to be the proper level.
*
* If something smarter is needed it is up to the operators which does data synchronization, so
* that the mdisps layer is also synchronized. */
if (!has_mdisps || top_level == 1 || mmd->totlvl == 0) {
multires_reshape_ensure_grids(coarse_mesh, top_level);
multires_set_tot_level(object, mmd, top_level);
return;