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/makesdna | |
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/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_customdata_types.h | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 7 |
3 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 4bacfd15751..91412044e0e 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -190,6 +190,19 @@ typedef enum CustomDataType { #define CD_MASK_TESSLOOPNORMAL (1LL << CD_TESSLOOPNORMAL) #define CD_MASK_CUSTOMLOOPNORMAL (1LL << CD_CUSTOMLOOPNORMAL) +/** Data types that may be defined for all mesh elements types. */ +#define CD_MASK_GENERIC_DATA (CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR) + + +typedef struct CustomData_MeshMasks { + uint64_t vmask; + uint64_t emask; + uint64_t fmask; + uint64_t pmask; + uint64_t lmask; +} CustomData_MeshMasks; + + /* CustomData.flag */ enum { /* Indicates layer should not be copied by CustomData_from_template or CustomData_copy_data */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index eac8b82d6ea..3b09801b4b7 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -28,6 +28,7 @@ #include "DNA_object_enums.h" #include "DNA_defs.h" +#include "DNA_customdata_types.h" #include "DNA_listBase.h" #include "DNA_ID.h" #include "DNA_action_types.h" /* bAnimVizSettings */ @@ -122,13 +123,15 @@ typedef struct LodLevel { * TODO(sergey): Consider moving it to more appropriate place. */ struct ObjectBBoneDeform; +struct CustomData_MeshMasks; + /* Not saved in file! */ typedef struct Object_Runtime { /** * The custom data layer mask that was last used * to calculate mesh_eval and mesh_deform_eval. */ - uint64_t last_data_mask; + CustomData_MeshMasks last_data_mask; /** Did last modifier stack generation need mapping support? */ char last_need_mapping; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5e1f4304389..2607ca5f333 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -34,6 +34,7 @@ extern "C" { #endif #include "DNA_color_types.h" /* color management */ +#include "DNA_customdata_types.h" /* Scene's runtime cddata masks. */ #include "DNA_vec_types.h" #include "DNA_listBase.h" #include "DNA_ID.h" @@ -50,6 +51,7 @@ struct Brush; struct Collection; struct ColorSpace; struct CurveMapping; +struct CustomData_MeshMasks; struct Editing; struct Image; struct MovieClip; @@ -1752,10 +1754,9 @@ typedef struct Scene { void *_pad8; /* XXX. runtime flag for drawing, actually belongs in the window, * only used by BKE_object_handle_update() */ - uint64_t customdata_mask; + struct CustomData_MeshMasks customdata_mask; /* XXX. same as above but for temp operator use (gl renders) */ - uint64_t customdata_mask_modal; - + struct CustomData_MeshMasks customdata_mask_modal; /* Color Management */ ColorManagedViewSettings view_settings; |