From 0c5ccae79d62127106af589f2d732cf40aa5213a Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 13 Jan 2022 16:36:50 -0600 Subject: 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. --- source/blender/blenkernel/intern/mesh_validate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index f11e8b3f93c..005c916b4e0 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -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( -- cgit v1.2.3