Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-08-25 16:49:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-08-25 16:54:26 +0300
commit33ac3582bbd5551bdfbc7ef8856640b5e61888f8 (patch)
tree13c9bef0922ebfd0eb19a98190ce8c9ccc700f1e /source/blender/draw/intern/draw_cache_extract_mesh.c
parent3ea324488ac9a45cb96d6fc98f4021a38e2ff20f (diff)
Fix T77359: Crash adding UV's in edit-mode with linked duplicates
This prevents UV layer mix up in MeshBatchCache.cd_used/cd_needed/cd_used_over_time which depends on the extraction method. One object's mesh can be accessed with MR_EXTRACT_MESH, another object that uses the same mesh can use MR_EXTRACT_BMESH based on (Object.mode & OB_MODE_EDIT), this causes a problem as the edit-mesh and the mesh aren't always in sync, the custom data layers wont necessarily match up, causing T77359. Reviewed by @jbakker, @brecht Ref D8645
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.c')
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c
index 63efc82f87e..503232fa560 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.c
@@ -313,9 +313,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,
@@ -335,7 +340,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;
@@ -350,8 +355,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;
@@ -5412,6 +5418,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,
@@ -5511,6 +5518,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,