diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-31 11:05:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-31 11:05:56 +0300 |
commit | 963917e1b9beaa8dc0863f1e4a9b54620d3610fa (patch) | |
tree | 947645c7ed0ec21c422c0f9806f570c096cb6a88 /source/blender/blenkernel | |
parent | 2c4a9f771803a7e8e4225e6d1126f80683f708f4 (diff) |
Fix T65285: Crash with Object.to_mesh() in certain conditions
Was happening when modifier stack detected that mesh is not deformed
and is not modified and attempted to share result across multiple
objects.
This was introduced in 2f77119.
Now functions which are supposed to return mesh owned by caller will
do so again. Shouldn't be a huge impact on memory print since the
data layers are referenced.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index dce8f348704..e3301062a1d 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1129,6 +1129,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, const CustomData_MeshMasks *dataMask, const int index, const bool use_cache, + const bool allow_shared_mesh, /* return args */ Mesh **r_deform, Mesh **r_final) @@ -1538,7 +1539,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, * need to apply these back onto the Mesh. If we have no * Mesh then we need to build one. */ if (mesh_final == NULL) { - if (deformed_verts == NULL) { + if (deformed_verts == NULL && allow_shared_mesh) { mesh_final = mesh_input; } else { @@ -2053,6 +2054,7 @@ static void mesh_build_data(struct Depsgraph *depsgraph, dataMask, -1, true, + true, &ob->runtime.mesh_deform_eval, &ob->runtime.mesh_eval); @@ -2253,7 +2255,7 @@ Mesh *mesh_create_eval_final_render(Depsgraph *depsgraph, { Mesh *final; - mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, -1, false, NULL, &final); + mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, -1, false, false, NULL, &final); return final; } @@ -2266,7 +2268,7 @@ Mesh *mesh_create_eval_final_index_render(Depsgraph *depsgraph, { Mesh *final; - mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, index, false, NULL, &final); + mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, index, false, false, NULL, &final); return final; } @@ -2284,7 +2286,7 @@ Mesh *mesh_create_eval_final_view(Depsgraph *depsgraph, */ ob->transflag |= OB_NO_PSYS_UPDATE; - mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, -1, false, NULL, &final); + mesh_calc_modifiers(depsgraph, scene, ob, 1, false, dataMask, -1, false, false, NULL, &final); ob->transflag &= ~OB_NO_PSYS_UPDATE; @@ -2298,7 +2300,7 @@ Mesh *mesh_create_eval_no_deform(Depsgraph *depsgraph, { Mesh *final; - mesh_calc_modifiers(depsgraph, scene, ob, 0, false, dataMask, -1, false, NULL, &final); + mesh_calc_modifiers(depsgraph, scene, ob, 0, false, dataMask, -1, false, false, NULL, &final); return final; } @@ -2310,7 +2312,7 @@ Mesh *mesh_create_eval_no_deform_render(Depsgraph *depsgraph, { Mesh *final; - mesh_calc_modifiers(depsgraph, scene, ob, 0, false, dataMask, -1, false, NULL, &final); + mesh_calc_modifiers(depsgraph, scene, ob, 0, false, dataMask, -1, false, false, NULL, &final); return final; } |