Fix T46481: Volume grid particles out of volume

The issue was caused by fix for 31017 which resulted in some
missing intersecitons recorded which screwed inner/outer checks.

This is an old bug, so didn't bother with forcing re-distribution
to happen on file open to avoid possible other regressions.
This commit is contained in:
Sergey Sharybin
2016-02-02 13:54:53 +01:00
parent 49247f0fc4
commit 4ceea37db4

View File

@@ -220,13 +220,15 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
copy_v3_v3(v2, mvert[mface->v2].co);
copy_v3_v3(v3, mvert[mface->v3].co);
if (isect_axial_line_segment_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
bool intersects_tri = isect_axial_line_segment_tri_v3(a, co1, co2, v2, v3, v1, &lambda);
if (intersects_tri) {
if (from==PART_FROM_FACE)
(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
else /* store number of intersections */
(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
}
else if (mface->v4) {
if (mface->v4 && (!intersects_tri || from==PART_FROM_VOLUME)) {
copy_v3_v3(v4, mvert[mface->v4].co);
if (isect_axial_line_segment_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {