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/BKE_customdata.h | |
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/BKE_customdata.h')
-rw-r--r-- | source/blender/blenkernel/BKE_customdata.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index ba3d1dbf187..4a7e6b22b0c 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -36,19 +36,21 @@ extern "C" { struct BMesh; struct CustomData; +struct CustomData_MeshMasks; struct ID; typedef uint64_t CustomDataMask; /*a data type large enough to hold 1 element from any customdata layer type*/ typedef struct {unsigned char data[64]; } CDBlockBytes; -extern const CustomDataMask CD_MASK_BAREMESH; -extern const CustomDataMask CD_MASK_MESH; -extern const CustomDataMask CD_MASK_EDITMESH; -extern const CustomDataMask CD_MASK_DERIVEDMESH; -extern const CustomDataMask CD_MASK_BMESH; -extern const CustomDataMask CD_MASK_FACECORNERS; -extern const CustomDataMask CD_MASK_EVERYTHING; +extern const CustomData_MeshMasks CD_MASK_BAREMESH; +extern const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX; +extern const CustomData_MeshMasks CD_MASK_MESH; +extern const CustomData_MeshMasks CD_MASK_EDITMESH; +extern const CustomData_MeshMasks CD_MASK_DERIVEDMESH; +extern const CustomData_MeshMasks CD_MASK_BMESH; +extern const CustomData_MeshMasks CD_MASK_FACECORNERS; +extern const CustomData_MeshMasks CD_MASK_EVERYTHING; /* for ORIGINDEX layer type, indicates no original index for this element */ #define ORIGINDEX_NONE -1 @@ -69,12 +71,15 @@ typedef enum eCDAllocType { #define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type)) -void customData_mask_layers__print(CustomDataMask mask); +void customData_mask_layers__print(const struct CustomData_MeshMasks *mask); typedef void (*cd_interp)(const void **sources, const float *weights, const float *sub_weights, int count, void *dest); typedef void (*cd_copy)(const void *source, void *dest, int count); typedef bool (*cd_validate)(void *item, const uint totitems, const bool do_fixes); +void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src); +bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required); + /** * Checks if the layer at physical offset \a layer_n (in data->layers) support math * the below operations. |