[Bf-blender-cvs] [591c1a1372a] master: Cleanup: MOD_Explode: sanitize face-without-particle case.
Bastien Montagne
noreply at git.blender.org
Sun Sep 22 18:55:10 CEST 2019
Commit: 591c1a1372a86217fe99a42917873462fdfda99b
Author: Bastien Montagne
Date: Sun Sep 22 18:48:00 2019 +0200
Branches: master
https://developer.blender.org/rB591c1a1372a86217fe99a42917873462fdfda99b
Cleanup: MOD_Explode: sanitize face-without-particle case.
Systematically reset particle pointer to NULL and use it to detect
invalid particle case, instead of checking value of the face's
particle index everywhere in a confusing and prone-to-bug way
(see T70150 and previous commit).
No behavioral change expected here.
===================================================================
M source/blender/modifiers/intern/MOD_explode.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 5ba61ea818b..02008de9a88 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -938,10 +938,13 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
continue;
}
}
+ else {
+ pa = NULL;
+ }
/* do mindex + totvert to ensure the vertex index to be the first
* with BLI_edgehashIterator_getKey */
- if (facepa[i] == totpart || cfra < (pars + facepa[i])->time) {
+ if (pa == NULL || cfra < pa->time) {
mindex = totvert + totpart;
}
else {
@@ -1022,6 +1025,9 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
mul_m4_v3(imat, vertco);
}
+ else {
+ pa = NULL;
+ }
}
BLI_edgehashIterator_free(ehi);
@@ -1043,13 +1049,16 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
continue;
}
}
+ else {
+ pa = NULL;
+ }
source = mesh->mface[i];
mf = &explode->mface[u];
orig_v4 = source.v4;
- if (facepa[i] != totpart && cfra < pa->time) {
+ if (pa != NULL && cfra < pa->time) {
mindex = totvert + totpart;
}
else {
@@ -1069,7 +1078,7 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
/* override uv channel for particle age */
if (mtface) {
- float age = (facepa[i] != totpart) ? (cfra - pa->time) / pa->lifetime : 0.0f;
+ float age = (pa != NULL) ? (cfra - pa->time) / pa->lifetime : 0.0f;
/* Clamp to this range to avoid flipping to the other side of the coordinates. */
CLAMP(age, 0.001f, 0.999f);
More information about the Bf-blender-cvs
mailing list