Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-13 17:23:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-13 17:23:48 +0400
commit2e72720718d80d3659a4f84143905b0e69724186 (patch)
tree3d78b1ec880517ba7158e535849a1bee5e5e7c23 /source/blender/editors/space_view3d/view3d_draw.c
parent91781c76c4b1bb3eecd31a2b482a4c87754cd2a7 (diff)
apply offset to the camera view - this works exactly like camera shift (transforms X/Y in the same space).
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6ef5d538b24..5073eca96ad 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1618,6 +1618,19 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
y2 = ar->winrct.ymax;
}
+ /* apply offset last - camera offset is different to offset in blender units */
+ /* so this has some sane way of working - this matches camera's shift _exactly_ */
+ {
+ const float max_dim = maxf(x2 - x1, y2 - y1);
+ const float xof_scale = bgpic->xof * max_dim;
+ const float yof_scale = bgpic->yof * max_dim;
+
+ x1 += xof_scale;
+ y1 += yof_scale;
+ x2 += xof_scale;
+ y2 += yof_scale;
+ }
+
/* aspect correction */
if (bgpic->flag & V3D_BGPIC_CAMERA_ASPECT)
{