Fix T79180: Object disappears when scaled, set origin etc after applying smooth modifier.

Very dummy mistake in modifier code would generate invalid number
(divisions by zero)...

Should also be ported to 2.83.
This commit is contained in:
Bastien Montagne 2020-07-28 14:42:17 +02:00
parent 76d489fe23
commit b99358315e
Notes: blender-bot 2023-02-14 08:38:14 +01:00
Referenced by issue #79180, Object disappears when scaled, set origin etc after applying smooth modifier.
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ static void smoothModifier_do(
MDeformVert *dv = dvert;
for (int i = 0; i < numVerts; i++, dv++) {
float *vco_orig = vertexCos[i];
if (num_accumulated_vecs[0] > 0) {
if (num_accumulated_vecs[i] > 0) {
mul_v3_fl(accumulated_vecs[i], 1.0f / (float)num_accumulated_vecs[i]);
}
float *vco_new = accumulated_vecs[i];
@ -174,7 +174,7 @@ static void smoothModifier_do(
else { /* no vertex group */
for (int i = 0; i < numVerts; i++) {
float *vco_orig = vertexCos[i];
if (num_accumulated_vecs[0] > 0) {
if (num_accumulated_vecs[i] > 0) {
mul_v3_fl(accumulated_vecs[i], 1.0f / (float)num_accumulated_vecs[i]);
}
float *vco_new = accumulated_vecs[i];