Fix for #1864
In transform code the old global G.totvertsel was still used to define centroid (editmesh). Replaced with nice local variable.
This commit is contained in:
@@ -3883,8 +3883,9 @@ void make_trans_verts(float *min, float *max, int mode)
|
|||||||
TransVert *tv=NULL;
|
TransVert *tv=NULL;
|
||||||
MetaElem *ml;
|
MetaElem *ml;
|
||||||
EditVert *eve;
|
EditVert *eve;
|
||||||
int a;
|
|
||||||
EditBone *ebo;
|
EditBone *ebo;
|
||||||
|
float total;
|
||||||
|
int a;
|
||||||
|
|
||||||
tottrans= 0; // global!
|
tottrans= 0; // global!
|
||||||
|
|
||||||
@@ -4086,18 +4087,21 @@ void make_trans_verts(float *min, float *max, int mode)
|
|||||||
|
|
||||||
/* cent etc */
|
/* cent etc */
|
||||||
tv= transvmain;
|
tv= transvmain;
|
||||||
|
total= 0.0;
|
||||||
for(a=0; a<tottrans; a++, tv++) {
|
for(a=0; a<tottrans; a++, tv++) {
|
||||||
if(tv->flag & SELECT) {
|
if(tv->flag & SELECT) {
|
||||||
centroid[0]+= tv->oldloc[0];
|
centroid[0]+= tv->oldloc[0];
|
||||||
centroid[1]+= tv->oldloc[1];
|
centroid[1]+= tv->oldloc[1];
|
||||||
centroid[2]+= tv->oldloc[2];
|
centroid[2]+= tv->oldloc[2];
|
||||||
|
total+= 1.0;
|
||||||
DO_MINMAX(tv->oldloc, min, max);
|
DO_MINMAX(tv->oldloc, min, max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
centroid[0]/= G.totvertsel;
|
if(total!=0.0) {
|
||||||
centroid[1]/= G.totvertsel;
|
centroid[0]/= total;
|
||||||
centroid[2]/= G.totvertsel;
|
centroid[1]/= total;
|
||||||
|
centroid[2]/= total;
|
||||||
|
}
|
||||||
|
|
||||||
centre[0]= (min[0]+max[0])/2.0;
|
centre[0]= (min[0]+max[0])/2.0;
|
||||||
centre[1]= (min[1]+max[1])/2.0;
|
centre[1]= (min[1]+max[1])/2.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user