Revision: 38473
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38473
Author:   nazgul
Date:     2011-07-18 10:44:23 +0000 (Mon, 18 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================

Fixed bug with incorrect scale of UV project modifier
when Blender camera uses non-default sensor size.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c

Modified: 
branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c
===================================================================
--- branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c    
2011-07-18 09:49:26 UTC (rev 38472)
+++ branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c    
2011-07-18 10:44:23 UTC (rev 38473)
@@ -40,6 +40,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BLI_math.h"
 #include "BLI_uvproject.h"
@@ -159,7 +160,15 @@
        float scax= umd->scalex ? umd->scalex : 1.0f;
        float scay= umd->scaley ? umd->scaley : 1.0f;
        int free_uci= 0;
+       float sensor_x= 32.0f;
+       Scene *scene= umd->modifier.scene;
        
+       if(scene && scene->camera && scene->camera->type == OB_CAMERA) {
+               Camera *camera= (Camera*)scene->camera->data;
+
+               sensor_x= camera->sensor_x;
+       }
+       
        aspect = aspx / aspy;
 
        for(i = 0; i < umd->num_projectors; ++i)
@@ -194,7 +203,7 @@
                                free_uci= 1;
                        }
                        else {
-                               float scale= (cam->type == CAM_PERSP) ? 
cam->clipsta * 32.0f / cam->lens : cam->ortho_scale;
+                               float scale= (cam->type == CAM_PERSP) ? 
cam->clipsta * sensor_x / cam->lens : cam->ortho_scale;
                                float xmax, xmin, ymax, ymin;
 
                                if(aspect > 1.0f) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to