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
This commit is contained in:
@@ -1187,7 +1187,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;
|
||||
@@ -1508,6 +1516,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,
|
||||
@@ -1525,6 +1534,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,
|
||||
@@ -1541,6 +1551,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,
|
||||
|
||||
Reference in New Issue
Block a user