[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52672] trunk/blender/source/blender/ editors/space_view3d: make setting local view take the view lens int account.
Campbell Barton
ideasman42 at gmail.com
Fri Nov 30 06:29:38 CET 2012
Revision: 52672
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52672
Author: campbellbarton
Date: 2012-11-30 05:29:34 +0000 (Fri, 30 Nov 2012)
Log Message:
-----------
make setting local view take the view lens int account.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
trunk/blender/source/blender/editors/space_view3d/view3d_view.c
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2012-11-30 04:40:32 UTC (rev 52671)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2012-11-30 05:29:34 UTC (rev 52672)
@@ -2240,10 +2240,8 @@
}
size = ED_view3d_dist_from_radius(focallength_to_fov(lens, sensor_size), size / 2.0f);
- if (size <= v3d->near * 1.5f) {
- /* do not zoom closer than the near clipping plane */
- size = v3d->near * 1.5f;
- }
+ /* do not zoom closer than the near clipping plane */
+ size = max_ff(size, v3d->near * 1.5f);
}
else { /* ortho */
if (size < 0.0001f) {
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2012-11-30 04:40:32 UTC (rev 52671)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2012-11-30 05:29:34 UTC (rev 52672)
@@ -1028,7 +1028,8 @@
{
View3D *v3d = sa->spacedata.first;
Base *base;
- float size = 0.0, min[3], max[3], box[3];
+ float min[3], max[3], box[3];
+ float size = 0.0, size_persp;
unsigned int locallay;
int ok = FALSE;
@@ -1068,7 +1069,12 @@
box[1] = (max[1] - min[1]);
box[2] = (max[2] - min[2]);
size = MAX3(box[0], box[1], box[2]);
- if (size <= 0.01f) size = 0.01f;
+
+ /* do not zoom closer than the near clipping plane */
+ size = max_ff(size, v3d->near * 1.5f);
+
+ /* perspective size (we always switch out of camera view so no need to use its lens size) */
+ size_persp = ED_view3d_dist_from_radius(focallength_to_fov(v3d->lens, DEFAULT_SENSOR_WIDTH), size / 2.0f);
}
if (ok == TRUE) {
@@ -1085,14 +1091,20 @@
rv3d->localvd = MEM_mallocN(sizeof(RegionView3D), "localview region");
memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
- rv3d->ofs[0] = -(min[0] + max[0]) / 2.0f;
- rv3d->ofs[1] = -(min[1] + max[1]) / 2.0f;
- rv3d->ofs[2] = -(min[2] + max[2]) / 2.0f;
+ mid_v3_v3v3(v3d->cursor, min, max);
+ negate_v3_v3(rv3d->ofs, v3d->cursor);
- rv3d->dist = size;
+ if (rv3d->persp == RV3D_CAMOB) {
+ rv3d->persp = RV3D_PERSP;
+ }
+
/* perspective should be a bit farther away to look nice */
- if (rv3d->persp == RV3D_ORTHO)
- rv3d->dist *= 0.7f;
+ if (rv3d->persp != RV3D_ORTHO) {
+ rv3d->dist = size_persp;
+ }
+ else {
+ rv3d->dist = size * 0.7f;
+ }
/* correction for window aspect ratio */
if (ar->winy > 2 && ar->winx > 2) {
@@ -1100,12 +1112,6 @@
if (asp < 1.0f) asp = 1.0f / asp;
rv3d->dist *= asp;
}
-
- if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP;
-
- v3d->cursor[0] = -rv3d->ofs[0];
- v3d->cursor[1] = -rv3d->ofs[1];
- v3d->cursor[2] = -rv3d->ofs[2];
}
}
More information about the Bf-blender-cvs
mailing list