diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-26 16:28:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-26 16:28:44 +0300 |
commit | 08ec9b71df3582d0797778baf2ff185c6ea9d3ab (patch) | |
tree | a527c90c584510b9ae35e2678d8cc3f76fd0f5da /source/blender/modifiers/intern | |
parent | 826bd46e661b780c294c1dd076c563f33420e42f (diff) | |
parent | e0772c6607ae6cd48193101b39d7332cb76ab2c9 (diff) |
Merge branch 'blender-v2.90-release' into master
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshdeform.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 79d666d9e2a..4dee70608f8 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -347,9 +347,8 @@ static void meshdeformModifier_do(ModifierData *md, Mesh *cagemesh; MDeformVert *dvert = NULL; float imat[4][4], cagemat[4][4], iobmat[4][4], icagemat[3][3], cmat[4][4]; - float co[3], (*dco)[3] = NULL, (*bindcagecos)[3]; + float(*dco)[3] = NULL, (*bindcagecos)[3]; int a, totvert, totcagevert, defgrp_index; - float(*cagecos)[3] = NULL; MeshdeformUserdata data; static int recursive_bind_sentinel = 0; @@ -400,7 +399,7 @@ static void meshdeformModifier_do(ModifierData *md, /* verify we have compatible weights */ totvert = numVerts; - totcagevert = cagemesh->totvert; + totcagevert = BKE_mesh_wrapper_vert_len(cagemesh); if (mmd->totvert != totvert) { BKE_modifier_set_error(md, "Vertices changed from %d to %d", mmd->totvert, totvert); @@ -416,20 +415,20 @@ static void meshdeformModifier_do(ModifierData *md, goto finally; } - /* setup deformation data */ - cagecos = BKE_mesh_vert_coords_alloc(cagemesh, NULL); - bindcagecos = (float(*)[3])mmd->bindcagecos; - /* We allocate 1 element extra to make it possible to * load the values to SSE registers, which are float4. */ dco = MEM_calloc_arrayN((totcagevert + 1), sizeof(*dco), "MDefDco"); zero_v3(dco[totcagevert]); + + /* setup deformation data */ + BKE_mesh_wrapper_vert_coords_copy(cagemesh, dco, totcagevert); + bindcagecos = (float(*)[3])mmd->bindcagecos; + for (a = 0; a < totcagevert; a++) { /* get cage vertex in world space with binding transform */ - copy_v3_v3(co, cagecos[a]); - - mul_m4_v3(mmd->bindmat, co); + float co[3]; + mul_v3_m4v3(co, mmd->bindmat, dco[a]); /* compute difference with world space bind coord */ sub_v3_v3v3(dco[a], co, bindcagecos[a]); } @@ -453,7 +452,6 @@ static void meshdeformModifier_do(ModifierData *md, finally: MEM_SAFE_FREE(dco); - MEM_SAFE_FREE(cagecos); } static void deformVerts(ModifierData *md, |