Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/meshlaplacian.c
| Show First 20 Lines • Show All 1,571 Lines • ▼ Show 20 Lines | static void harmonic_coordinates_bind(MeshDeformModifierData *mmd, MeshDeformBind *mdb) | ||||
| BLI_memarena_free(mdb->memarena); | BLI_memarena_free(mdb->memarena); | ||||
| free_bvhtree_from_mesh(&mdb->bvhdata); | free_bvhtree_from_mesh(&mdb->bvhdata); | ||||
| } | } | ||||
| void ED_mesh_deform_bind_callback( | void ED_mesh_deform_bind_callback( | ||||
| MeshDeformModifierData *mmd, Mesh *cagemesh, | MeshDeformModifierData *mmd, Mesh *cagemesh, | ||||
| float *vertexcos, int totvert, float cagemat[4][4]) | float *vertexcos, int totvert, float cagemat[4][4]) | ||||
| { | { | ||||
| MeshDeformModifierData *mmd_orig = | |||||
| (MeshDeformModifierData *)modifier_get_original(&mmd->modifier); | |||||
| MeshDeformBind mdb; | MeshDeformBind mdb; | ||||
| MVert *mvert; | MVert *mvert; | ||||
| int a; | int a; | ||||
| waitcursor(1); | waitcursor(1); | ||||
| start_progress_bar(); | start_progress_bar(); | ||||
| memset(&mdb, 0, sizeof(MeshDeformBind)); | memset(&mdb, 0, sizeof(MeshDeformBind)); | ||||
| Show All 9 Lines | void ED_mesh_deform_bind_callback( | ||||
| mvert = mdb.cagemesh->mvert; | mvert = mdb.cagemesh->mvert; | ||||
| for (a = 0; a < mdb.totcagevert; a++) | for (a = 0; a < mdb.totcagevert; a++) | ||||
| copy_v3_v3(mdb.cagecos[a], mvert[a].co); | copy_v3_v3(mdb.cagecos[a], mvert[a].co); | ||||
| for (a = 0; a < mdb.totvert; a++) | for (a = 0; a < mdb.totvert; a++) | ||||
| mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a * 3); | mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a * 3); | ||||
| /* solve */ | /* solve */ | ||||
| harmonic_coordinates_bind(mmd, &mdb); | harmonic_coordinates_bind(mmd_orig, &mdb); | ||||
| /* assign bind variables */ | /* assign bind variables */ | ||||
| mmd->bindcagecos = (float *)mdb.cagecos; | mmd_orig->bindcagecos = (float *)mdb.cagecos; | ||||
| mmd->totvert = mdb.totvert; | mmd_orig->totvert = mdb.totvert; | ||||
| mmd->totcagevert = mdb.totcagevert; | mmd_orig->totcagevert = mdb.totcagevert; | ||||
| copy_m4_m4(mmd->bindmat, mmd->object->obmat); | copy_m4_m4(mmd_orig->bindmat, mmd_orig->object->obmat); | ||||
| /* transform bindcagecos to world space */ | /* transform bindcagecos to world space */ | ||||
| for (a = 0; a < mdb.totcagevert; a++) | for (a = 0; a < mdb.totcagevert; a++) | ||||
| mul_m4_v3(mmd->object->obmat, mmd->bindcagecos + a * 3); | mul_m4_v3(mmd_orig->object->obmat, mmd_orig->bindcagecos + a * 3); | ||||
| /* free */ | /* free */ | ||||
| MEM_freeN(mdb.vertexcos); | MEM_freeN(mdb.vertexcos); | ||||
| /* compact weights */ | /* compact weights */ | ||||
| modifier_mdef_compact_influences((ModifierData *)mmd); | modifier_mdef_compact_influences((ModifierData *)mmd_orig); | ||||
| end_progress_bar(); | end_progress_bar(); | ||||
| waitcursor(0); | waitcursor(0); | ||||
| } | } | ||||