Fix: Incorrect logic in mesh validation for removing layers

The mask is only used if it's not zero. Adding the normal mask made
it not zero, but it didn't include anything else, so all custom data
layers except normals were removed. The fix is to only add normals
to the mask when it should be used.
This commit is contained in:
Hans Goudey 2022-01-13 16:36:50 -06:00
parent cfa53e0fbe
commit 0c5ccae79d
1 changed files with 4 additions and 5 deletions

View File

@ -1008,13 +1008,12 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata,
CustomData_MeshMasks mask = {0};
if (check_meshmask) {
mask = CD_MASK_MESH;
/* Normal data isn't in the mask since it is derived data,
* but it is valid and should not be removed. */
mask.vmask |= CD_MASK_NORMAL;
mask.pmask |= CD_MASK_NORMAL;
}
/* Normal data isn't in the mask since it is derived data,
* but it is valid and should not be removed. */
mask.vmask |= CD_MASK_NORMAL;
mask.pmask |= CD_MASK_NORMAL;
is_valid &= mesh_validate_customdata(
vdata, mask.vmask, totvert, do_verbose, do_fixes, &is_change_v);
is_valid &= mesh_validate_customdata(