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 d3e0d7f082.

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.
This commit is contained in:
2018-12-17 12:28:16 +01:00
parent dcc11360c6
commit a84c823b89
9 changed files with 37 additions and 14 deletions

View File

@@ -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);