Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2020-05-19 17:23:44 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-05-19 17:27:09 +0300
commit7fcf2e7d4af1429b461dec92b6d66ff09e9be9f3 (patch)
tree9b102ead39eb8b04b4a45c6937811b67687a9065 /release
parent0c20fce2f2bf3ef8ebca8bc20d676a1d65d5203d (diff)
Fix T74577: world_to_camera_view broken for off-axis projection
The issue was that the projection would be inverted. So if you shifted 0.1 along the y axis, world_to_camera_view would act as if you had shited it -0.1 along the y axis.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy_extras/object_utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 540bc75cece..5b7f26ff89c 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -256,15 +256,15 @@ def world_to_camera_view(scene, obj, coord):
z = -co_local.z
camera = obj.data
- frame = [-v for v in camera.view_frame(scene=scene)[:3]]
+ frame = [v for v in camera.view_frame(scene=scene)[:3]]
if camera.type != 'ORTHO':
if z == 0.0:
return Vector((0.5, 0.5, 0.0))
else:
- frame = [(v / (v.z / z)) for v in frame]
+ frame = [-(v / (v.z / z)) for v in frame]
- min_x, max_x = frame[1].x, frame[2].x
- min_y, max_y = frame[0].y, frame[1].y
+ min_x, max_x = frame[2].x, frame[1].x
+ min_y, max_y = frame[1].y, frame[0].y
x = (co_local.x - min_x) / (max_x - min_x)
y = (co_local.y - min_y) / (max_y - min_y)