diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-25 16:56:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-25 16:56:34 +0300 |
commit | c336947dbb53dbc35306f6cada391bfc3d7bd0e8 (patch) | |
tree | d84185367305c786bea05971b3fbc11abbc3aab4 /source | |
parent | 9dd4d87f186545cad24fc95e182ab58d1bc87ea1 (diff) | |
parent | 33ac3582bbd5551bdfbc7ef8856640b5e61888f8 (diff) |
Merge branch 'blender-v2.90-release' into master
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract.h | 1 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.c | 14 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 13 |
3 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h index 2653b3127ae..5f77dac98be 100644 --- a/source/blender/draw/intern/draw_cache_extract.h +++ b/source/blender/draw/intern/draw_cache_extract.h @@ -260,6 +260,7 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, Mesh *me, const bool is_editmode, const bool is_paint_mode, + const bool is_mode_active, const float obmat[4][4], const bool do_final, const bool do_uvedit, diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index fe48ce00b86..528a6eec69e 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -311,9 +311,14 @@ static void mesh_render_data_update_normals(MeshRenderData *mr, } } +/** + * \param is_mode_active: When true, use the modifiers from the edit-data, + * otherwise don't use modifiers as they are not from this object. + */ static MeshRenderData *mesh_render_data_create(Mesh *me, const bool is_editmode, const bool is_paint_mode, + const bool is_mode_active, const float obmat[4][4], const bool do_final, const bool do_uvedit, @@ -333,7 +338,7 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, mr->bm = me->edit_mesh->bm; mr->edit_bmesh = me->edit_mesh; mr->me = (do_final) ? me->edit_mesh->mesh_eval_final : me->edit_mesh->mesh_eval_cage; - mr->edit_data = mr->me->runtime.edit_data; + mr->edit_data = is_mode_active ? mr->me->runtime.edit_data : NULL; if (mr->edit_data) { EditMeshData *emd = mr->edit_data; @@ -348,8 +353,9 @@ static MeshRenderData *mesh_render_data_create(Mesh *me, mr->bm_poly_centers = mr->edit_data->polyCos; } - bool has_mdata = (mr->me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA); - bool use_mapped = has_mdata && !do_uvedit && mr->me && !mr->me->runtime.is_original; + bool has_mdata = is_mode_active && (mr->me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA); + bool use_mapped = is_mode_active && + (has_mdata && !do_uvedit && mr->me && !mr->me->runtime.is_original); int bm_ensure_types = BM_VERT | BM_EDGE | BM_LOOP | BM_FACE; @@ -5534,6 +5540,7 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, const bool is_editmode, const bool is_paint_mode, + const bool is_mode_active, const float obmat[4][4], const bool do_final, const bool do_uvedit, @@ -5633,6 +5640,7 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, MeshRenderData *mr = mesh_render_data_create(me, is_editmode, is_paint_mode, + is_mode_active, obmat, do_final, do_uvedit, diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 4acae2fc816..e8a712b6881 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -1186,7 +1186,15 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, BLI_assert(me->edit_mesh->mesh_eval_final != NULL); } - const bool is_editmode = (me->edit_mesh != NULL) && DRW_object_is_in_edit_mode(ob); + /* Don't check `DRW_object_is_in_edit_mode(ob)` here because it means the same mesh + * may draw with edit-mesh data and regular mesh data. + * In this case the custom-data layers used wont always match in `me->runtime.batch_cache`. + * If we want to display regular mesh data, we should have a separate cache for the edit-mesh. + * See T77359. */ + const bool is_editmode = (me->edit_mesh != NULL) /* && DRW_object_is_in_edit_mode(ob) */; + + /* This could be set for paint mode too, currently it's only used for edit-mode. */ + const bool is_mode_active = is_editmode && DRW_object_is_in_edit_mode(ob); DRWBatchFlag batch_requested = cache->batch_requested; cache->batch_requested = 0; @@ -1507,6 +1515,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, me, is_editmode, is_paint_mode, + is_mode_active, ob->obmat, false, true, @@ -1524,6 +1533,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, me, is_editmode, is_paint_mode, + is_mode_active, ob->obmat, false, false, @@ -1540,6 +1550,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, me, is_editmode, is_paint_mode, + is_mode_active, ob->obmat, true, false, |