Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-03-17 19:34:04 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-03-17 19:40:54 +0300
commitf958560a990a8974446c2c63def7ba387dcfb275 (patch)
treedcb00295a6a75e2c6268424eb92a7e598efe7ba5 /source/blender/blenkernel/intern/multires_reshape_apply_base.c
parent1504cb26b0aa4e91b5c0ec432d2702d9e9c5275f (diff)
Multires: Properly support virtual modifiers for Apply Base
The initial code from earlier from today didn't really work reliable since it is not possible to apply virtual modifiers but not the real multires one (in a situation like mesh with shapekeys and multires). New code uses less memory and has better performance for the case when there are actual modifiers leading the multires. The case when there is only multires will not be as performant as possible at this moment.
Diffstat (limited to 'source/blender/blenkernel/intern/multires_reshape_apply_base.c')
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_apply_base.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/multires_reshape_apply_base.c b/source/blender/blenkernel/intern/multires_reshape_apply_base.c
index 958fb60bbdc..62418150ff1 100644
--- a/source/blender/blenkernel/intern/multires_reshape_apply_base.c
+++ b/source/blender/blenkernel/intern/multires_reshape_apply_base.c
@@ -189,16 +189,11 @@ void multires_reshape_apply_base_refine_from_deform(MultiresReshapeContext *resh
BLI_assert(object != NULL);
BLI_assert(mmd != NULL);
- /* If there are no modifiers prior to the multires can use base mesh as it have all the updated
- * vertices already. */
- if (mmd->modifier.prev == NULL) {
- BKE_subdiv_eval_update_from_mesh(reshape_context->subdiv, reshape_context->base_mesh, NULL);
- }
- else {
- /* TODO(sergey): Possible optimization is to only evaluate new verticies positions without
- * construction of the entire mesh. */
- Mesh *deformed_base_mesh = BKE_multires_create_deformed_base_mesh(depsgraph, object, mmd);
- BKE_subdiv_eval_update_from_mesh(reshape_context->subdiv, deformed_base_mesh, NULL);
- BKE_id_free(NULL, deformed_base_mesh);
- }
+ float(*deformed_verts)[3] = BKE_multires_create_deformed_base_mesh_vert_coords(
+ depsgraph, object, mmd, NULL);
+
+ BKE_subdiv_eval_update_from_mesh(
+ reshape_context->subdiv, reshape_context->base_mesh, deformed_verts);
+
+ MEM_freeN(deformed_verts);
}