diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-02-10 22:00:44 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-02-10 22:00:44 +0300 |
commit | 3c5d5fb1cad25d75df3a3a032e86a58957311fd2 (patch) | |
tree | 7065899ee9e1a75d79b9558607827009874f212d /object_grease_scatter.py | |
parent | 039f3646b5a2a3a76fd43df1a2cf68bc0242f1c7 (diff) | |
parent | 6266b4139503bb614576f15ea4e90870ac5e597d (diff) |
Merge branch 'master' into fbx_io_export_ignore_parentsfbx_io_export_ignore_parents
Conflicts:
io_scene_fbx/import_fbx.py
Diffstat (limited to 'object_grease_scatter.py')
-rw-r--r-- | object_grease_scatter.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/object_grease_scatter.py b/object_grease_scatter.py index 1535698b..105b40ea 100644 --- a/object_grease_scatter.py +++ b/object_grease_scatter.py @@ -91,8 +91,8 @@ def _main(self, DEBUG = False def fix_point(p): - hit, no, ind = closest_point_on_mesh(obj_mat_inv * p) - if ind != -1: + ok, hit, no, ind = closest_point_on_mesh(obj_mat_inv * p) + if ok: if DEBUG: return [p, no, None] else: @@ -151,13 +151,12 @@ def _main(self, m_alt_2 = Matrix.Rotation(radians(-22.5), 3, n) for _m in mats: for m in (_m, m_alt_1 * _m, m_alt_2 * _m): - hit, nor, ind = ray(pofs, pofs + (m * n_seek)) - if ind != -1: - dist = (pofs - hit).length - if dist < best_dist: - best_dist = dist - best_nor = nor - #best_hit = hit + pdir = m * n_seek + ok, hit, nor, ind = ray(pofs, pdir, best_dist) + if ok: + best_dist = (pofs - hit).length + best_nor = nor + # best_hit = hit if best_nor: pt[1].length = best_dist @@ -211,9 +210,9 @@ def _main(self, ntmp.y += uniform(-l, l) * RAND_LOC ntmp.z += uniform(-l, l) * RAND_LOC - hit, hit_no, ind = ray(vantage, vantage + ntmp) + ok, hit, hit_no, ind = ray(vantage, ntmp, ntmp.length) # print(hit, hit_no) - if ind != -1: + if ok: if hit_no.angle(Z_UP) < WALL_LIMIT: hits.append(hit) nors.append(hit_no) |