Merge branch 'blender-v2.90-release' into master

This commit is contained in:
Campbell Barton 2020-08-26 23:28:44 +10:00
commit 08ec9b71df
3 changed files with 17 additions and 11 deletions

View File

@ -37,6 +37,7 @@
#include "BKE_bvhutils.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "ED_armature.h"
@ -1761,6 +1762,9 @@ void ED_mesh_deform_bind_callback(MeshDeformModifierData *mmd,
memset(&mdb, 0, sizeof(MeshDeformBind));
/* No need to support other kinds of mesh data as binding is a one-off action. */
BKE_mesh_wrapper_ensure_mdata(cagemesh);
/* get mesh and cage mesh */
mdb.vertexcos = MEM_callocN(sizeof(float[3]) * totvert, "MeshDeformCos");
mdb.totvert = totvert;

View File

@ -795,8 +795,12 @@ const char *buttons_context_dir[] = {
"line_style",
"collection",
"gpencil",
#ifdef WITH_HAIR_NODES
"hair",
#endif
#ifdef WITH_PARTICLE_NODES
"pointcloud",
#endif
"volume",
NULL,
};

View File

@ -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,