From ab0bc65c24bdf68c356adb2566f3669153c931ea Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 7 Mar 2019 11:13:40 +0100 Subject: Refactor CDData masks, to have one mask per mesh elem type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- source/blender/blenkernel/BKE_customdata.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source/blender/blenkernel/BKE_customdata.h') 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. -- cgit v1.2.3