Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-09-22 19:48:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-09-22 19:48:00 +0300
commit591c1a1372a86217fe99a42917873462fdfda99b (patch)
tree44cfff95ac9777198a85cf00533d26dde6057bf8 /source/blender/modifiers/intern/MOD_explode.c
parent6eea69a7ad3eb92cf7feca2b06704a0b54ff12fe (diff)
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.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_explode.c')
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c15
1 files changed, 12 insertions, 3 deletions
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);