Index: release/scripts/startup/bl_ui/space_view3d.py =================================================================== --- release/scripts/startup/bl_ui/space_view3d.py (revisione 43485) +++ release/scripts/startup/bl_ui/space_view3d.py (copia locale) @@ -2351,9 +2351,13 @@ box.prop(bg, "opacity", slider=True) if bg.view_axis != 'CAMERA': box.prop(bg, "size") + box.prop(bg, "rotate") row = box.row(align=True) row.prop(bg, "offset_x", text="X") row.prop(bg, "offset_y", text="Y") + row = box.row(align=True) + row.prop(bg, "flip_x") + row.prop(bg, "flip_y") class VIEW3D_PT_transform_orientations(Panel): Index: source/blender/editors/space_view3d/view3d_draw.c =================================================================== --- source/blender/editors/space_view3d/view3d_draw.c (revisione 43485) +++ source/blender/editors/space_view3d/view3d_draw.c (copia locale) @@ -1497,7 +1497,7 @@ MovieClip *clip; ImBuf *ibuf= NULL, *freeibuf; float vec[4], fac, asp, zoomx, zoomy; - float x1, y1, x2, y2, cx, cy; + float x1, y1, x2, y2, cx, cy, centx, centy; for ( bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next ) { @@ -1595,6 +1595,8 @@ zoomx= (x2-x1)/ibuf->x; zoomy= (y2-y1)/ibuf->y; + centx = x1 + ((x2 - x1)/2); + centy = y1 + ((y2 - y1)/2); /* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */ if(zoomx < 1.0f || zoomy < 1.0f) { float tzoom= MIN2(zoomx, zoomy); @@ -1628,7 +1630,20 @@ glMatrixMode(GL_MODELVIEW); glPushMatrix(); ED_region_pixelspace(ar); - + + glTranslatef(centx, centy, 0.0); + glRotatef(bgpic->rotate* 180/M_PI, 0, 0, 1); + glTranslatef(-centx, -centy, 0.0); + + if (bgpic->flip & V3D_BGPIC_FLIP_X) { + y1 = y1 + (y2-y1); + zoomy = (-1) * zoomy; + } + if (bgpic->flip & V3D_BGPIC_FLIP_Y) { + x1 = x1 + (x2-x1); + zoomx = (-1) * zoomx; + } + glPixelZoom(zoomx, zoomy); glColor4f(1.0f, 1.0f, 1.0f, 1.0f-bgpic->blend); glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect); Index: source/blender/makesdna/DNA_view3d_types.h =================================================================== --- source/blender/makesdna/DNA_view3d_types.h (revisione 43485) +++ source/blender/makesdna/DNA_view3d_types.h (copia locale) @@ -74,7 +74,8 @@ struct ImageUser iuser; struct MovieClip *clip; struct MovieClipUser cuser; - float xof, yof, size, blend; + float xof, yof, size, rotate, blend; + int flip; short view; short flag; short source, pad; @@ -318,6 +319,11 @@ #define V3D_BGPIC_IMAGE 0 #define V3D_BGPIC_MOVIE 1 +/* BGPic->flip */ +/* may want to use 1 for select ?*/ +#define V3D_BGPIC_FLIP_X (1<<0) +#define V3D_BGPIC_FLIP_Y (1<<1) + #define RV3D_CAMZOOM_MIN -30 #define RV3D_CAMZOOM_MAX 600 Index: source/blender/makesrna/intern/rna_space.c =================================================================== --- source/blender/makesrna/intern/rna_space.c (revisione 43485) +++ source/blender/makesrna/intern/rna_space.c (copia locale) @@ -1290,6 +1290,21 @@ RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + prop= RNA_def_property(srna, "rotate", PROP_FLOAT, PROP_EULER); + RNA_def_property_float_sdna(prop, NULL, "rotate"); + RNA_def_property_ui_text(prop, "Rotation", "Rotation factor for the background image"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "flip_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flip", V3D_BGPIC_FLIP_X); + RNA_def_property_ui_text(prop, "Flip X", "Flip the image according to the X axis"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + + prop= RNA_def_property(srna, "flip_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flip", V3D_BGPIC_FLIP_Y); + RNA_def_property_ui_text(prop, "Flip Y", "Flip the image according to the Y axis"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); + prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "blend"); RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);