diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-17 14:28:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-12-17 14:33:37 +0300 |
commit | a84c823b891fcf440e134eb284024ea06aa1a9ff (patch) | |
tree | ae07aaa5b4d32a8817ffefe96dc6416b0957c27d /source/blender/blenkernel/intern/mesh_runtime.c | |
parent | dcc11360c619f51a70466e7b3622cc1aebe08fd9 (diff) |
Fix T58652: Crash editing shape keys weirdness with instances
This is a second attempt to get the crash fixed. The original fix
worked, but it was reverted by d3e0d7f0825.
Now the logic goes as:
- All pointers which we can not have shared (the ones which are
owned by the runtime) are cleared.
- The rest of runtime stays untouched.
This seems to be enough to keep particles happy.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_runtime.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_runtime.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index 14d77b5288b..9e71f5f5156 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -60,6 +60,20 @@ void BKE_mesh_runtime_reset(Mesh *mesh) memset(&mesh->runtime, 0, sizeof(mesh->runtime)); } +/* Clear all pointers which we don't want to be shared on copying the datablock. + * However, keep all the flags which defines what the mesh is (for example, that + * it's deformed only, or that its custom data layers are out of date.) */ +void BKE_mesh_runtime_reset_on_copy(Mesh *mesh) +{ + Mesh_Runtime *runtime = &mesh->runtime; + runtime->edit_data = NULL; + runtime->batch_cache = NULL; + runtime->subdiv_ccg = NULL; + memset(&runtime->looptris, 0, sizeof(runtime->looptris)); + runtime->bvh_cache = NULL; + runtime->shrinkwrap_data = NULL; +} + void BKE_mesh_runtime_clear_cache(Mesh *mesh) { BKE_mesh_runtime_clear_geometry(mesh); |