diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-09-07 14:08:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-09-07 14:28:05 +0300 |
commit | 1b0dd5a2150c2207768ba74c1a25b842f3d4ece1 (patch) | |
tree | 8ab9418bf8e110942258a0135fbd39e1bf8103bb /release/scripts/modules/bpy_extras | |
parent | ed779333bb82a483c3f7833b959610c08f0bacb7 (diff) |
Cleanup: style, spelling
Diffstat (limited to 'release/scripts/modules/bpy_extras')
-rw-r--r-- | release/scripts/modules/bpy_extras/view3d_utils.py | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index a2e394b270f..9e4958802f1 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -47,10 +47,11 @@ def region_2d_to_vector_3d(region, rv3d, coord): if rv3d.is_perspective: persinv = rv3d.perspective_matrix.inverted() - out = Vector(((2.0 * coord[0] / region.width) - 1.0, - (2.0 * coord[1] / region.height) - 1.0, - -0.5 - )) + out = Vector(( + (2.0 * coord[0] / region.width) - 1.0, + (2.0 * coord[1] / region.height) - 1.0, + -0.5 + )) w = out.dot(persinv[3].xyz) + persinv[3][3] @@ -99,9 +100,11 @@ def region_2d_to_origin_3d(region, rv3d, coord, clamp=None): dx = (2.0 * coord[0] / region.width) - 1.0 dy = (2.0 * coord[1] / region.height) - 1.0 persinv = persmat.inverted() - origin_start = ((persinv.col[0].xyz * dx) + - (persinv.col[1].xyz * dy) + - persinv.translation) + origin_start = ( + (persinv.col[0].xyz * dx) + + (persinv.col[1].xyz * dy) + + persinv.translation + ) if clamp != 0.0: if rv3d.view_perspective != 'CAMERA': @@ -149,17 +152,19 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location): from mathutils.geometry import intersect_line_plane viewinv = rv3d.view_matrix.inverted() view_vec = viewinv.col[2].copy() - return intersect_line_plane(origin_start, - origin_end, - depth_location, - view_vec, 1, - ) + return intersect_line_plane( + origin_start, + origin_end, + depth_location, + view_vec, 1, + ) else: from mathutils.geometry import intersect_point_line - return intersect_point_line(depth_location, - origin_start, - origin_end, - )[0] + return intersect_point_line( + depth_location, + origin_start, + origin_end, + )[0] def location_3d_to_region_2d(region, rv3d, coord, default=None): @@ -184,8 +189,9 @@ def location_3d_to_region_2d(region, rv3d, coord, default=None): width_half = region.width / 2.0 height_half = region.height / 2.0 - return Vector((width_half + width_half * (prj.x / prj.w), - height_half + height_half * (prj.y / prj.w), - )) + return Vector(( + width_half + width_half * (prj.x / prj.w), + height_half + height_half * (prj.y / prj.w), + )) else: return default |