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/editors/space_view3d/view3d_draw_legacy.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/editors/space_view3d/view3d_draw_legacy.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 0afdd36dbb6..a52fd89d284 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -879,40 +879,37 @@ void ED_view3d_draw_depth_gpencil( /* *********************** customdata **************** */ -CustomDataMask ED_view3d_datamask(const bContext *C, const Scene *UNUSED(scene), const View3D *v3d) +void ED_view3d_datamask( + const bContext *C, const Scene *UNUSED(scene), const View3D *v3d, CustomData_MeshMasks *r_cddata_masks) { - CustomDataMask mask = 0; const int drawtype = view3d_effective_drawtype(v3d); if (ELEM(drawtype, OB_TEXTURE, OB_MATERIAL)) { - mask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; + r_cddata_masks->lmask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL; if (drawtype == OB_MATERIAL) - mask |= CD_MASK_ORCO; + r_cddata_masks->vmask |= CD_MASK_ORCO; } if ((CTX_data_mode_enum(C) == CTX_MODE_EDIT_MESH) && (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT)) { - mask |= CD_MASK_MDEFORMVERT; + r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT; } - - return mask; } /* goes over all modes and view3d settings */ -CustomDataMask ED_view3d_screen_datamask(const bContext *C, const Scene *scene, const bScreen *screen) +void ED_view3d_screen_datamask( + const bContext *C, const Scene *scene, const bScreen *screen, CustomData_MeshMasks *r_cddata_masks) { - CustomDataMask mask = CD_MASK_BAREMESH; + CustomData_MeshMasks_update(r_cddata_masks, &CD_MASK_BAREMESH); /* check if we need tfaces & mcols due to view mode */ for (const ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { if (sa->spacetype == SPACE_VIEW3D) { - mask |= ED_view3d_datamask(C, scene, sa->spacedata.first); + ED_view3d_datamask(C, scene, sa->spacedata.first, r_cddata_masks); } } - - return mask; } /** |