Median center didn't use TD_NOCENTER properly, making it work incorrectly with hinge...
authorMartin Poirier <theeth@yahoo.com>
Tue, 11 Nov 2008 03:12:31 +0000 (03:12 +0000)
committerMartin Poirier <theeth@yahoo.com>
Tue, 11 Nov 2008 03:12:31 +0000 (03:12 +0000)
source/blender/src/transform_generics.c

index a1440b8cbce2a2395eae9e593c87ee9dde00b885..2a91b66ad8ecb29d73af2ffb240c65a6440cea3e 100644 (file)
@@ -876,12 +876,16 @@ void calculateCenterCursor2D(TransInfo *t)
 void calculateCenterMedian(TransInfo *t)
 {
        float partial[3] = {0.0f, 0.0f, 0.0f};
+       int total = 0;
        int i;
        
        for(i = 0; i < t->total; i++) {
                if (t->data[i].flag & TD_SELECTED) {
                        if (!(t->data[i].flag & TD_NOCENTER))
+                       {
                                VecAddf(partial, partial, t->data[i].center);
+                               total++;
+                       }
                }
                else {
                        /* 
@@ -892,7 +896,7 @@ void calculateCenterMedian(TransInfo *t)
                }
        }
        if(i)
-               VecMulf(partial, 1.0f / i);
+               VecMulf(partial, 1.0f / total);
        VECCOPY(t->center, partial);
 
        calculateCenter2D(t);