[Bf-blender-cvs] [77eab493adb] temp-lanpr-cleanup: Cleanup: MOD_Explode: sanitize face-without-particle case.
Bastien Montagne
noreply at git.blender.org
Wed Sep 25 03:50:14 CEST 2019
Commit: 77eab493adb9e720125f0c9bf43d9ee0608119d6
Author: Bastien Montagne
Date: Sun Sep 22 18:48:00 2019 +0200
Branches: temp-lanpr-cleanup
https://developer.blender.org/rB77eab493adb9e720125f0c9bf43d9ee0608119d6
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