diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-22 05:01:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-22 05:11:45 +0400 |
commit | 61baf6e8135d11bc53cbfa45c75f910a99e57971 (patch) | |
tree | 26cd515da4240d2fb3344fcacb5717f4af2fd0cf /release/scripts/templates_py | |
parent | 217095f622282d5ec9ded524ddd7f24c68ed11f5 (diff) |
Fix T41902: Flipped persp/ortho region_2d_to_vector_3d
- Ortho result from view3d_utils.region_2d_to_vector_3d was flipped.
- Persp result wasn't normalized.
- operator_modal_view3d_raycast.py failed for ortho views.
Thanks to Philipp Oeser for the initial fix.
Diffstat (limited to 'release/scripts/templates_py')
-rw-r--r-- | release/scripts/templates_py/operator_modal_view3d_raycast.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/release/scripts/templates_py/operator_modal_view3d_raycast.py b/release/scripts/templates_py/operator_modal_view3d_raycast.py index 6c59603239b..1aa13c90ca3 100644 --- a/release/scripts/templates_py/operator_modal_view3d_raycast.py +++ b/release/scripts/templates_py/operator_modal_view3d_raycast.py @@ -2,7 +2,7 @@ import bpy from bpy_extras import view3d_utils -def main(context, event, ray_max=10000.0): +def main(context, event, ray_max=1000.0): """Run this function on left mouse, execute the ray cast""" # get the context arguments scene = context.scene @@ -13,6 +13,11 @@ def main(context, event, ray_max=10000.0): # get the ray from the viewport and mouse view_vector = view3d_utils.region_2d_to_vector_3d(region, rv3d, coord) ray_origin = view3d_utils.region_2d_to_origin_3d(region, rv3d, coord) + + if rv3d.view_perspective == 'ORTHO': + # move ortho origin back + ray_origin = ray_origin - (view_vector * (ray_max / 2.0)) + ray_target = ray_origin + (view_vector * ray_max) def visible_objects_and_duplis(): |