[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55606] trunk/blender/source/blender/ editors/uvedit/uvedit_unwrap_ops.c: report [#34772] Incorrect aspect for tex mapping from camera view
Campbell Barton
ideasman42 at gmail.com
Tue Mar 26 22:26:45 CET 2013
Revision: 55606
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55606
Author: campbellbarton
Date: 2013-03-26 21:26:44 +0000 (Tue, 26 Mar 2013)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
Modified: trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c 2013-03-26 20:51:43 UTC (rev 55605)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c 2013-03-26 21:26:44 UTC (rev 55606)
@@ -1339,10 +1339,14 @@
}
}
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 @@
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);
}
More information about the Bf-blender-cvs
mailing list