[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32757] trunk/blender/source/blender/ editors/screen/screen_edit.c: bugfix [#24428] Interface Regions will not keep relative proportions
Campbell Barton
ideasman42 at gmail.com
Thu Oct 28 19:46:31 CEST 2010
Revision: 32757
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32757
Author: campbellbarton
Date: 2010-10-28 19:46:31 +0200 (Thu, 28 Oct 2010)
Log Message:
-----------
bugfix [#24428] Interface Regions will not keep relative proportions
screen verts were being rounded so resizing a window would end up moving the border in one direction.
for this to work properly we should store floats internally but for now compensate for this.
Modified Paths:
--------------
trunk/blender/source/blender/editors/screen/screen_edit.c
Modified: trunk/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_edit.c 2010-10-28 13:35:33 UTC (rev 32756)
+++ trunk/blender/source/blender/editors/screen/screen_edit.c 2010-10-28 17:46:31 UTC (rev 32757)
@@ -608,6 +608,10 @@
}
/* test if screen vertices should be scaled */
+
+/* needed to alternate AREAGRID snapping else it shifts one way
+ * to avoid this we should use floats at least during runtime [#24428]. */
+static char scale_alt_bool= 0;
static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
{
ScrVert *sv=NULL;
@@ -643,20 +647,26 @@
/* make sure it fits! */
for(sv= sc->vertbase.first; sv; sv= sv->next) {
+ /* 0.1519 was 0.5f, but tweaked so resizing the window doesnt favor one direction
+ * also note scale_alt_bool */
tempf= ((float)sv->vec.x)*facx;
- sv->vec.x= (short)(tempf+0.5);
- sv->vec.x+= AREAGRID-1;
+ sv->vec.x= (short)(tempf+0.1519);
+ sv->vec.x+= AREAGRID-2;
+ sv->vec.x-= scale_alt_bool;
sv->vec.x-= (sv->vec.x % AREAGRID);
CLAMP(sv->vec.x, 0, winsizex);
tempf= ((float)sv->vec.y )*facy;
- sv->vec.y= (short)(tempf+0.5);
- sv->vec.y+= AREAGRID-1;
+ sv->vec.y= (short)(tempf+0.1519);
+ sv->vec.y+= AREAGRID-2;
+ sv->vec.y-= scale_alt_bool;
sv->vec.y-= (sv->vec.y % AREAGRID);
CLAMP(sv->vec.y, 0, winsizey);
}
+
+ scale_alt_bool= scale_alt_bool ? 0:1;
}
/* test for collapsed areas. This could happen in some blender version... */
More information about the Bf-blender-cvs
mailing list