diff options
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index e1959c8bf5e..e5d7bd70214 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -304,7 +304,8 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) bool result = (BKE_id_copy_ex(nullptr, (ID *)id_for_copy, &newid, - LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != nullptr); + (LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE | + LIB_ID_COPY_SET_COPIED_ON_WRITE)) != nullptr); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -333,7 +334,8 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) bool result = (BKE_id_copy_ex(nullptr, id_for_copy, (ID **)&new_scene, - LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != nullptr); + (LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE | + LIB_ID_COPY_SET_COPIED_ON_WRITE)) != nullptr); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -604,20 +606,12 @@ void update_lattice_edit_mode_pointers(const Depsgraph * /*depsgraph*/, void update_mesh_edit_mode_pointers(const ID *id_orig, ID *id_cow) { - /* For meshes we need to update edit_mesh to make it to point - * to the CoW version of object. - * - * This is kind of confusing, because actual bmesh is not owned by - * the CoW object, so need to be accurate about using link from - * edit_mesh to object. */ const Mesh *mesh_orig = (const Mesh *)id_orig; Mesh *mesh_cow = (Mesh *)id_cow; if (mesh_orig->edit_mesh == nullptr) { return; } - mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh); - mesh_cow->edit_mesh->mesh_eval_cage = nullptr; - mesh_cow->edit_mesh->mesh_eval_final = nullptr; + mesh_cow->edit_mesh = mesh_orig->edit_mesh; } /* Edit data is stored and owned by original datablocks, copied ones @@ -999,11 +993,6 @@ void discard_lattice_edit_mode_pointers(ID *id_cow) void discard_mesh_edit_mode_pointers(ID *id_cow) { Mesh *mesh_cow = (Mesh *)id_cow; - if (mesh_cow->edit_mesh == nullptr) { - return; - } - BKE_editmesh_free_derivedmesh(mesh_cow->edit_mesh); - MEM_freeN(mesh_cow->edit_mesh); mesh_cow->edit_mesh = nullptr; } |