Corrected View Selected operator for image editor so now it works
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 21 Jul 2011 09:50:39 +0000 (09:50 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 21 Jul 2011 09:50:39 +0000 (09:50 +0000)
fine for images with different X and Y aspect ratio.

source/blender/editors/space_image/image_ops.c

index 10b8cb238aa2217a22445c2c49545c42f6f4ef51..d5515bd1cf85ae10658a06da04c0e664e2170a57 100644 (file)
@@ -500,7 +500,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
        Scene *scene;
        Object *obedit;
        Image *ima;
-       float size, min[2], max[2], d[2];
+       float size, min[2], max[2], d[2], aspx, aspy;
        int width, height;
 
        /* retrieve state */
@@ -511,6 +511,10 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 
        ima= ED_space_image(sima);
        ED_space_image_size(sima, &width, &height);
+       ED_image_aspect(ima, &aspx, &aspy);
+
+       width= width*aspx;
+       height= height*aspy;
 
        /* get bounds */
        if(!ED_uvedit_minmax(scene, ima, obedit, min, max))