[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52677] trunk/blender: add margin to view fitting view-all/local-view (wasn' t obvious with the models I was testing with).

Campbell Barton ideasman42 at gmail.com
Fri Nov 30 07:55:37 CET 2012


Revision: 52677
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52677
Author:   campbellbarton
Date:     2012-11-30 06:55:36 +0000 (Fri, 30 Nov 2012)
Log Message:
-----------
add margin to view fitting view-all/local-view (wasn't obvious with the models I was testing with).

Modified Paths:
--------------
    trunk/blender/release/scripts/templates/script_stub.py
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/release/scripts/templates/script_stub.py
===================================================================
--- trunk/blender/release/scripts/templates/script_stub.py	2012-11-30 06:39:24 UTC (rev 52676)
+++ trunk/blender/release/scripts/templates/script_stub.py	2012-11-30 06:55:36 UTC (rev 52677)
@@ -9,6 +9,6 @@
 
 filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename)
 global_namespace = {"__file__": filepath, "__name__": "__main__"}
-file_handle = open(filepath, 'rb')
-exec(compile(file_handle.read(), filepath, 'exec'), global_namespace)
-file_handle.close()
+file = open(filepath, 'rb')
+exec(compile(file.read(), filepath, 'exec'), global_namespace)
+file.close()

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2012-11-30 06:39:24 UTC (rev 52676)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2012-11-30 06:55:36 UTC (rev 52677)
@@ -100,11 +100,6 @@
 /* Projection */
 #define IS_CLIPPED        12000
 
-/* TODO, these functions work quite differently, we should make them behave in a uniform way
- * otherwise we can't be sure bugs are not added when we need to move from short->float types for eg
- * - Campbell */
-
-
 /* return values for ED_view3d_project_...() */
 typedef enum {
 	V3D_PROJ_RET_OK   = 0,
@@ -298,6 +293,7 @@
 void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
 void ED_view3D_background_image_clear(struct View3D *v3d);
 
+#define VIEW3D_MARGIN 1.4f
 float ED_view3d_offset_distance(float mat[4][4], float ofs[3]);
 float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit);
 

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2012-11-30 06:39:24 UTC (rev 52676)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2012-11-30 06:55:36 UTC (rev 52677)
@@ -2238,7 +2238,7 @@
 				lens = v3d->lens;
 				sensor_size = DEFAULT_SENSOR_WIDTH;
 			}
-			size = ED_view3d_radius_to_persp_dist(focallength_to_fov(lens, sensor_size), size / 2.0f);
+			size = ED_view3d_radius_to_persp_dist(focallength_to_fov(lens, sensor_size), size / 2.0f) * VIEW3D_MARGIN;
 
 			/* do not zoom closer than the near clipping plane */
 			size = max_ff(size, v3d->near * 1.5f);
@@ -2250,7 +2250,7 @@
 			}
 			else {
 				/* adjust zoom so it looks nicer */
-				size = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f);
+				size = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
 			}
 		}
 	}

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2012-11-30 06:39:24 UTC (rev 52676)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2012-11-30 06:55:36 UTC (rev 52677)
@@ -1080,8 +1080,8 @@
 		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_radius_to_persp_dist(focallength_to_fov(v3d->lens, DEFAULT_SENSOR_WIDTH), size / 2.0f);
-		size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f);
+		size_persp = ED_view3d_radius_to_persp_dist(focallength_to_fov(v3d->lens, DEFAULT_SENSOR_WIDTH), size / 2.0f) * VIEW3D_MARGIN;
+		size_ortho = ED_view3d_radius_to_ortho_dist(v3d->lens, size / 2.0f) * VIEW3D_MARGIN;
 	}
 	
 	if (ok == TRUE) {




More information about the Bf-blender-cvs mailing list