fix for valgrind warning - strcpy was trying to copy to/from the same value (aparently this can corrupt the value in some cases)

Fixed problem where hidden curve handles could still be transformed.
This commit is contained in:
Campbell Barton
2007-10-25 20:30:18 +00:00
parent 5007d95572
commit fd98d38672
2 changed files with 30 additions and 14 deletions

View File

@@ -409,8 +409,9 @@ static void setup_app_data(BlendFileData *bfd, char *filename)
/* there's an onload scriptlink to execute in screenmain */
mainqenter(ONLOAD_SCRIPT, 1);
}
strcpy(G.sce, filename);
if (G.sce != filename) /* these are the same at times, should never copy to the same location */
strcpy(G.sce, filename);
strcpy(G.main->name, filename); /* is guaranteed current file */
MEM_freeN(bfd);

View File

@@ -1137,10 +1137,15 @@ static void createTransCurveVerts(TransInfo *t)
if((nu->type & 7)==CU_BEZIER) {
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
if(bezt->hide==0) {
if(bezt->f1 & 1) countsel++;
if(bezt->f2 & 1) countsel++;
if(bezt->f3 & 1) countsel++;
if(propmode) count+= 3;
if (G.f & G_HIDDENHANDLES) {
if(bezt->f2 & 1) countsel+=3;
if(propmode) count+= 3;
} else {
if(bezt->f1 & 1) countsel++;
if(bezt->f2 & 1) countsel++;
if(bezt->f3 & 1) countsel++;
if(propmode) count+= 3;
}
}
}
}
@@ -1170,11 +1175,15 @@ static void createTransCurveVerts(TransInfo *t)
head = tail = td;
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
if(bezt->hide==0) {
if(propmode || (bezt->f1 & 1)) {
if( propmode ||
((bezt->f2 & 1) && (G.f & G_HIDDENHANDLES)) ||
((bezt->f1 & 1) && (G.f & G_HIDDENHANDLES)==0)
) {
VECCOPY(td->iloc, bezt->vec[0]);
td->loc= bezt->vec[0];
VECCOPY(td->center, bezt->vec[1]);
if(bezt->f1 & 1) td->flag= TD_SELECTED;
if(bezt->f1 & 1 || G.f & G_HIDDENHANDLES) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
td->tdi = NULL;
@@ -1187,7 +1196,8 @@ static void createTransCurveVerts(TransInfo *t)
count++;
tail++;
}
/* THIS IS THE CV, the other two are handles */
/* This is the Curve Point, the other two are handles */
if(propmode || (bezt->f2 & 1)) {
VECCOPY(td->iloc, bezt->vec[1]);
td->loc= bezt->vec[1];
@@ -1197,12 +1207,14 @@ static void createTransCurveVerts(TransInfo *t)
td->ext = NULL;
td->tdi = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN) {
if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
td->val = &(bezt->radius);
td->ival = bezt->radius;
} else {
} else if (t->mode==TFM_TILT) {
td->val = &(bezt->alfa);
td->ival = bezt->alfa;
} else {
td->val = NULL;
}
Mat3CpyMat3(td->smtx, smtx);
@@ -1212,11 +1224,14 @@ static void createTransCurveVerts(TransInfo *t)
count++;
tail++;
}
if(propmode || (bezt->f3 & 1)) {
if( propmode ||
((bezt->f1 & 1) && (G.f & G_HIDDENHANDLES)) ||
((bezt->f3 & 1) && (G.f & G_HIDDENHANDLES)==0)
) {
VECCOPY(td->iloc, bezt->vec[2]);
td->loc= bezt->vec[2];
VECCOPY(td->center, bezt->vec[1]);
if(bezt->f3 & 1) td->flag= TD_SELECTED;
if(bezt->f3 & 1 || (G.f & G_HIDDENHANDLES)) td->flag= TD_SELECTED;
else td->flag= 0;
td->ext = NULL;
td->tdi = NULL;
@@ -1252,7 +1267,7 @@ static void createTransCurveVerts(TransInfo *t)
td->ext = NULL;
td->tdi = NULL;
if (t->mode==TFM_CURVE_SHRINKFATTEN) {
if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
td->val = &(bp->radius);
td->ival = bp->radius;
} else {