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 committed by Jeroen Bakker
parent 6ec565d1f5
commit 1e53ca9b71
Notes: blender-bot 2023-02-14 02:08:37 +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

@ -135,7 +135,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];
@ -162,7 +162,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];