diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-01-11 17:42:07 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:28:39 +0300 |
commit | 8499897dfa3a85ad67a8b9cee00fdd3cf42f89ef (patch) | |
tree | 8099046c899997399735f02f013e7d6810227231 /source/blender/blenkernel/BKE_editmesh.h | |
parent | ad7d60909188e632b7fb50142b8e10d4c024fc9d (diff) |
Fix depsgraphs sharing IDs via evaluated edit mesh
The evaluated mesh is a result of evaluated modifiers, and referencing
other evaluated IDs such as materials.
It can not be stored in the EditMesh structure which is intended to be
re-used by many areas. Such sharing was causing ownership errors causing
bugs like
T93855: Cycles crash with edit mode and simultaneous viewport and final render
The proposed solution is to store the evaluated edit mesh and its cage in
the object's runtime field. The motivation goes as following:
- It allows to avoid ownership problems like the ones in the linked report.
- Object level is chosen over mesh level is because the evaluated mesh
is affected by modifiers, which are on the object level.
This patch allows to have modifier stack of an object which shares mesh with
an object which is in edit mode to be properly taken into account (before
the change the modifier stack from the active object will be used for all
objects which share the mesh).
There is a change in the way how copy-on-write is handled in the edit mode to
allow proper state update when changing active scene (or having two windows
with different scenes). Previously, the copt-on-write would have been ignored
by skipping tagging CoW component. Now it is ignored from within the CoW
operation callback. This allows to update edit pointers for objects which are
not from the current depsgraph and where the edit_mesh was never assigned in
the case when the depsgraph was evaluated prior the active depsgraph.
There is no user level changes changes expected with the CoW handling changes:
should not affect on neither performance, nor memory consumption.
Tested scenarios:
- Various modifiers configurations of objects sharing mesh and be part of the
same scene.
- Steps from the reports: T93855, T82952, T77359
This also fixes T76609, T72733 and perhaps other reports.
Differential Revision: https://developer.blender.org/D13824
Diffstat (limited to 'source/blender/blenkernel/BKE_editmesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_editmesh.h | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 5be06dcc5c3..1da7ae3da8a 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -62,14 +62,6 @@ typedef struct BMEditMesh { struct BMLoop *(*looptris)[3]; int tottri; - struct Mesh *mesh_eval_final, *mesh_eval_cage; - - /** Cached cage bounding box of `mesh_eval_cage` for selection. */ - struct BoundBox *bb_cage; - - /** Evaluated mesh data-mask. */ - CustomData_MeshMasks lastDataMask; - /** Selection mode (#SCE_SELECT_VERTEX, #SCE_SELECT_EDGE & #SCE_SELECT_FACE). */ short selectmode; /** The active material (assigned to newly created faces). */ @@ -121,7 +113,6 @@ BMEditMesh *BKE_editmesh_copy(BMEditMesh *em); * don't add NULL data check here. caller must do that */ BMEditMesh *BKE_editmesh_from_object(struct Object *ob); -void BKE_editmesh_free_derived_caches(BMEditMesh *em); /** * \note Does not free the #BMEditMesh struct itself. */ @@ -145,7 +136,7 @@ void BKE_editmesh_lnorspace_update(BMEditMesh *em, struct Mesh *me); * If auto-smooth not already set, set it. */ void BKE_editmesh_ensure_autosmooth(BMEditMesh *em, struct Mesh *me); -struct BoundBox *BKE_editmesh_cage_boundbox_get(BMEditMesh *em); +struct BoundBox *BKE_editmesh_cage_boundbox_get(struct Object *object, BMEditMesh *em); #ifdef __cplusplus } |