diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 01:26:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 01:26:44 +0400 |
commit | 974d73bfbfbd3f10ad28c3da52e2a6cd84a3b8b8 (patch) | |
tree | 200c1be76eb3472a48a24f0163918108518d469a /source | |
parent | aaa547faff8709cc92a6eaa73ac2fe4c1f042b2c (diff) |
report [#34772] Incorrect aspect for tex mapping from camera view
There was no good way to UV project from a camera with non-square view-border without it stretching the image (even using 'Correct Aspect').
While this isnt a bug its useful to do a UV projection without stretching the image, added 'Camera Bounds' option.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 7585f872f1a..ba8b26c9083 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1339,10 +1339,14 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) } } else if (camera) { + const bool camera_bounds = RNA_boolean_get(op->ptr, "camera_bounds"); struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat, - scene->r.xsch * scene->r.xasp, - scene->r.ysch * scene->r.yasp); + camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f, + camera_bounds ? (scene->r.ysch * scene->r.yasp) : 1.0f); + + // BLI_uvproject_camera_info_scale + if (uci) { BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) @@ -1403,7 +1407,10 @@ void UV_OT_project_from_view(wmOperatorType *ot) ot->poll = uv_from_view_poll; /* properties */ - RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", "Use orthographic projection"); + RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", + "Use orthographic projection"); + RNA_def_boolean(ot->srna, "camera_bounds", 1, "Camera Bounds", + "Map UVs to the camera region taking resolution and aspect into account"); uv_map_clip_correct_properties(ot); } |