Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
| Show All 40 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_mesh_runtime.h" | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| ▲ Show 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | void update_mesh_edit_mode_pointers(const ID *id_orig, ID *id_cow) | ||||
| * the CoW object, so need to be accurate about using link from | * the CoW object, so need to be accurate about using link from | ||||
| * edit_mesh to object. */ | * edit_mesh to object. */ | ||||
| const Mesh *mesh_orig = (const Mesh *)id_orig; | const Mesh *mesh_orig = (const Mesh *)id_orig; | ||||
| Mesh *mesh_cow = (Mesh *)id_cow; | Mesh *mesh_cow = (Mesh *)id_cow; | ||||
| if (mesh_orig->edit_mesh == nullptr) { | if (mesh_orig->edit_mesh == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh); | 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; | |||||
| } | } | ||||
| /* Edit data is stored and owned by original datablocks, copied ones | /* Edit data is stored and owned by original datablocks, copied ones | ||||
| * are simply referencing to them. */ | * are simply referencing to them. */ | ||||
| void update_edit_mode_pointers(const Depsgraph *depsgraph, const ID *id_orig, ID *id_cow) | void update_edit_mode_pointers(const Depsgraph *depsgraph, const ID *id_orig, ID *id_cow) | ||||
| { | { | ||||
| const ID_Type type = GS(id_orig->name); | const ID_Type type = GS(id_orig->name); | ||||
| switch (type) { | switch (type) { | ||||
| ▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void discard_mesh_edit_mode_pointers(ID *id_cow) | void discard_mesh_edit_mode_pointers(ID *id_cow) | ||||
| { | { | ||||
| Mesh *mesh_cow = (Mesh *)id_cow; | Mesh *mesh_cow = (Mesh *)id_cow; | ||||
| if (mesh_cow->edit_mesh == nullptr) { | if (mesh_cow->edit_mesh == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| BKE_editmesh_free_derivedmesh(mesh_cow->edit_mesh); | BKE_mesh_runtime_clear_geometry_for_edit_mode(mesh_cow); | ||||
| MEM_freeN(mesh_cow->edit_mesh); | MEM_freeN(mesh_cow->edit_mesh); | ||||
| mesh_cow->edit_mesh = nullptr; | mesh_cow->edit_mesh = nullptr; | ||||
| } | } | ||||
| void discard_scene_pointers(ID *id_cow) | void discard_scene_pointers(ID *id_cow) | ||||
| { | { | ||||
| Scene *scene_cow = (Scene *)id_cow; | Scene *scene_cow = (Scene *)id_cow; | ||||
| scene_cow->toolsettings = nullptr; | scene_cow->toolsettings = nullptr; | ||||
| ▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines | |||||