diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-05 17:26:38 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-05 17:26:38 +0300 |
commit | d16547ab73e7086d5358bba67093173827d12afe (patch) | |
tree | cdcc994222129063aaf916f972f8ed3311675266 /source/blender/editors/sculpt_paint | |
parent | 01b762e8463ec6192d43b3bfac7d29b0c24757c0 (diff) |
Alt+B view clipping is now taken into account properly for sculpt, particle
edit and snapping, by clipping the view ray.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index cfcd0d90e2c..11ce41c5ff8 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1841,7 +1841,7 @@ int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float ou ViewContext *vc = paint_stroke_view_context(stroke); SculptSession *ss= vc->obact->sculpt; StrokeCache *cache= ss->cache; - float ray_start[3], ray_normal[3]; + float ray_start[3], ray_end[3], ray_normal[3], dist; float obimat[4][4]; float mval[2] = {mouse[0] - vc->ar->winrct.xmin, mouse[1] - vc->ar->winrct.ymin}; @@ -1849,7 +1849,9 @@ int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float ou sculpt_stroke_modifiers_check(C, ss); - viewray(vc->ar, vc->v3d, mval, ray_start, ray_normal); + viewline(vc->ar, vc->v3d, mval, ray_start, ray_end); + sub_v3_v3v3(ray_normal, ray_end, ray_start); + dist= normalize_v3(ray_normal); invert_m4_m4(obimat, ss->ob->obmat); mul_m4_v3(obimat, ray_start); @@ -1859,7 +1861,7 @@ int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float ou srd.ss = vc->obact->sculpt; srd.ray_start = ray_start; srd.ray_normal = ray_normal; - srd.dist = FLT_MAX; + srd.dist = dist; srd.hit = 0; srd.original = (cache)? cache->original: 0; BLI_pbvh_raycast(ss->tree, sculpt_raycast_cb, &srd, |