Fix for bug #5986: snap circle too big when far away from the origin
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 21 Feb 2008 14:28:20 +0000 (14:28 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 21 Feb 2008 14:28:20 +0000 (14:28 +0000)
(e.g. 1000 blender units).

source/blender/include/transform.h
source/blender/src/transform_manipulator.c
source/blender/src/transform_snap.c

index 96e45da22da226feb6e06185d6207f9c7366e134..7ac417fda7ca269fd699c5c2688c57c444bb8e2e 100644 (file)
@@ -376,7 +376,7 @@ int clipUVTransform(TransInfo *t, float *vec, int resize);
 /*********************** exported from transform_manipulator.c ********** */
 void draw_manipulator_ext(struct ScrArea *sa, int type, char axis, int col, float vec[3], float mat[][3]);
 int calc_manipulator_stats(struct ScrArea *sa);
-float get_drawsize(struct View3D *v3d);
+float get_drawsize(struct View3D *v3d, float *co);
 
 /*********************** TransData Creation and General Handling *********** */
 void createTransData(TransInfo *t);
index 36e5da7f51eeb6fc267de79fab79cf972e863611..8fcb329f2f9bd54e81a35a0631ed4734c79f54c5 100644 (file)
@@ -1359,13 +1359,13 @@ static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflag
 
 /* ********************************************* */
 
-float get_drawsize(View3D *v3d)
+float get_drawsize(View3D *v3d, float *co)
 {
        ScrArea *sa = v3d->area;
        float size, vec[3], len1, len2;
        
        /* size calculus, depending ortho/persp settings, like initgrabz() */
-       size= v3d->persmat[0][3]*v3d->twmat[3][0]+ v3d->persmat[1][3]*v3d->twmat[3][1]+ v3d->persmat[2][3]*v3d->twmat[3][2]+ v3d->persmat[3][3];
+       size= v3d->persmat[0][3]*co[0]+ v3d->persmat[1][3]*co[1]+ v3d->persmat[2][3]*co[2]+ v3d->persmat[3][3];
        
        VECCOPY(vec, v3d->persinv[0]);
        len1= Normalize(vec);
@@ -1384,7 +1384,7 @@ float get_drawsize(View3D *v3d)
 static float get_manipulator_drawsize(ScrArea *sa)
 {
        View3D *v3d= sa->spacedata.first;
-       float size = get_drawsize(v3d);
+       float size = get_drawsize(v3d, v3d->twmat[3]);
        
        size*= (float)U.tw_size;
 
index 2a92629e4c96d0e18f1f0cd93c60f00acff7314a..1016f74abb35b1d6bc311d32229553ce6d162ab8 100644 (file)
@@ -126,7 +126,7 @@ void drawSnapping(TransInfo *t)
                        
                        glDisable(GL_DEPTH_TEST);
        
-                       size = get_drawsize(G.vd);
+                       size = get_drawsize(G.vd, t->tsnap.snapPoint);
                        
                        size *= 0.5f * BIF_GetThemeValuef(TH_VERTEX_SIZE);