diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-27 19:17:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-27 19:22:29 +0300 |
commit | 490f966af5b76c5112ff161e2c9a784ae86b0b5d (patch) | |
tree | d9f8ffc2f56e6118184fc931497ddaf812fa1ea4 /source/blender/blenkernel/intern/subdiv_mesh.c | |
parent | c5b8d3b6d78fead1ca8c871d86c3d92924267c55 (diff) |
Fix multires modifier using too much memory outside of sculpt mode
This reduce memory usage by about 25% in object mode for multires meshes.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_mesh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 1ff9140681f..9d713d1937d 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -498,9 +498,14 @@ static bool subdiv_mesh_topology_info(const SubdivForeachContext *foreach_contex const int num_loops, const int num_polygons) { + /* Multires grid data will be applied or become invalid after subdivision, + * so don't try to preserve it and use memory. */ + CustomData_MeshMasks mask = CD_MASK_EVERYTHING; + mask.lmask &= ~CD_MASK_MULTIRES_GRIDS; + SubdivMeshContext *subdiv_context = foreach_context->user_data; - subdiv_context->subdiv_mesh = BKE_mesh_new_nomain_from_template( - subdiv_context->coarse_mesh, num_vertices, num_edges, 0, num_loops, num_polygons); + subdiv_context->subdiv_mesh = BKE_mesh_new_nomain_from_template_ex( + subdiv_context->coarse_mesh, num_vertices, num_edges, 0, num_loops, num_polygons, mask); subdiv_mesh_ctx_cache_custom_data_layers(subdiv_context); subdiv_mesh_prepare_accumulator(subdiv_context, num_vertices); return true; |