[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39231] branches/soc-2011-tomato/source/ blender/editors/space_view3d/view3d_draw.c: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Tue Aug 9 21:58:16 CEST 2011


Revision: 39231
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39231
Author:   nazgul
Date:     2011-08-09 19:58:14 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================

Forgot to port draw sensor code to new sensor usa case.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c

Modified: branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c	2011-08-09 19:30:17 UTC (rev 39230)
+++ branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_draw.c	2011-08-09 19:58:14 UTC (rev 39231)
@@ -1243,21 +1243,24 @@
 			uiSetRoundBox(15);
 			uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
 		}
-#if 0 /* XXX: ... */
 		if (ca && (ca->flag & CAM_SHOWSENSOR)) {
 			/* assume fixed sensor width for now */
+			float aspx = (float) scene->r.xsch*scene->r.xasp;
+			float aspy = (float) scene->r.ysch*scene->r.yasp;
 			float sensor_scale = (x2i-x1i) / ca->sensor_x;
-			float sensor_height = sensor_scale * ca->sensor_y;
+			float sensor_height, ymid, sy1, sy2;
 
-			float ymid = y1i + (y2i-y1i)/2.f;
-			float sy1= ymid - sensor_height/2.f;
-			float sy2= ymid + sensor_height/2.f;
+			if(aspx < aspy) sensor_height = ca->sensor_x * sensor_scale * aspx / aspy;
+			else sensor_height = ca->sensor_x * sensor_scale * aspy / aspx;
 
+			ymid = y1i + (y2i-y1i)/2.f;
+			sy1= ymid - sensor_height/2.f;
+			sy2= ymid + sensor_height/2.f;
+
 			UI_ThemeColorShade(TH_WIRE, 100);
 
 			uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0);
 		}
-#endif
 	}
 
 	setlinestyle(0);




More information about the Bf-blender-cvs mailing list