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:
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c13
2 files changed, 17 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index eb2f14fa3a8..d7fe7ebbbf7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2586,9 +2586,10 @@ class VIEW3D_PT_background_image(Panel):
if bg.view_axis != 'CAMERA':
col.prop(bg, "size")
- row = col.row(align=True)
- row.prop(bg, "offset_x", text="X")
- row.prop(bg, "offset_y", text="Y")
+
+ row = col.row(align=True)
+ row.prop(bg, "offset_x", text="X")
+ row.prop(bg, "offset_y", text="Y")
class VIEW3D_PT_transform_orientations(Panel):
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)
{