From 989fbff16f49204ca31a67f56f87c2221e0246f4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 7 Dec 2018 11:17:25 +0100 Subject: Cleanup/refactor binding code for MeshDeform modifier. We had two different ways of doing it, SurfaceDeform and LaplacianDeform would do it through a special modifier stack evaluation triggered from binding operator, while MeshDeform would do it through a regular depsgraph update/eval (also triggered from its binding op). This enforces the later to search back for orig modifier data inside modifier code (to apply binding on that one, and not on useless CoW one). Besides the question of safety about modifying orig data from threaded despgraph (that was *probably* OK, but think it's bad idea in general), it's much better to have a common way of doing that kind of things. For now it remains rather dodgy, but at least it's reasonably consistent and safe now. This commit also fixes a potential memleak from binding process of MeshDeform, and does some general cleanup a bit. --- source/blender/editors/armature/meshlaplacian.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/armature/meshlaplacian.c') diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 001c8ce215f..96799304845 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1427,7 +1427,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind EIG_linear_solver_delete(context); } -static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb) +static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBind *mdb) { MDefBindInfluence *inf; MDefInfluence *mdinf; @@ -1578,7 +1578,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa } void ED_mesh_deform_bind_callback( - Scene *scene, MeshDeformModifierData *mmd, Mesh *cagemesh, + MeshDeformModifierData *mmd, Mesh *cagemesh, float *vertexcos, int totvert, float cagemat[4][4]) { MeshDeformBind mdb; @@ -1606,7 +1606,7 @@ void ED_mesh_deform_bind_callback( mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a * 3); /* solve */ - harmonic_coordinates_bind(scene, mmd, &mdb); + harmonic_coordinates_bind(mmd, &mdb); /* assign bind variables */ mmd->bindcagecos = (float *)mdb.cagecos; -- cgit v1.2.3