diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-07 13:13:40 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-07 13:29:50 +0300 |
commit | ab0bc65c24bdf68c356adb2566f3669153c931ea (patch) | |
tree | 23909478874a13d84e504a905809eb211e62a9e2 /source/blender/blenkernel/intern/mesh_validate.c | |
parent | cee53160d2bd9067a3d43cc862ce61e36ff70454 (diff) |
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_validate.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_validate.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 29879be3d45..a5aa198bc4e 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -40,6 +40,7 @@ #include "BLI_math_base.h" #include "BLI_math_vector.h" +#include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_mesh.h" @@ -888,12 +889,15 @@ bool BKE_mesh_validate_all_customdata( bool is_valid = true; bool is_change_v, is_change_e, is_change_l, is_change_p; int tot_uvloop, tot_vcolloop; - CustomDataMask mask = check_meshmask ? CD_MASK_MESH : 0; + CustomData_MeshMasks mask = {0}; + if (check_meshmask) { + mask = CD_MASK_MESH; + } - is_valid &= mesh_validate_customdata(vdata, mask, totvert, do_verbose, do_fixes, &is_change_v); - is_valid &= mesh_validate_customdata(edata, mask, totedge, do_verbose, do_fixes, &is_change_e); - is_valid &= mesh_validate_customdata(ldata, mask, totloop, do_verbose, do_fixes, &is_change_l); - is_valid &= mesh_validate_customdata(pdata, mask, totpoly, do_verbose, do_fixes, &is_change_p); + is_valid &= mesh_validate_customdata(vdata, mask.vmask, totvert, do_verbose, do_fixes, &is_change_v); + is_valid &= mesh_validate_customdata(edata, mask.emask, totedge, do_verbose, do_fixes, &is_change_e); + is_valid &= mesh_validate_customdata(ldata, mask.lmask, totloop, do_verbose, do_fixes, &is_change_l); + is_valid &= mesh_validate_customdata(pdata, mask.pmask, totpoly, do_verbose, do_fixes, &is_change_p); tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV); tot_vcolloop = CustomData_number_of_layers(ldata, CD_MLOOPCOL); |