moved some duplicate lines into their own function
This commit is contained in:
@@ -46,7 +46,7 @@ struct View3D;
|
|||||||
struct ScrArea;
|
struct ScrArea;
|
||||||
struct bPose;
|
struct bPose;
|
||||||
struct bConstraint;
|
struct bConstraint;
|
||||||
|
struct BezTriple;
|
||||||
|
|
||||||
typedef struct NDofInput {
|
typedef struct NDofInput {
|
||||||
int flag;
|
int flag;
|
||||||
@@ -472,6 +472,8 @@ void postTrans (TransInfo *t);
|
|||||||
|
|
||||||
void drawLine(float *center, float *dir, char axis, short options);
|
void drawLine(float *center, float *dir, char axis, short options);
|
||||||
|
|
||||||
|
TransDataCurveHandleFlags *initTransDataCurveHandes(TransData *td, struct BezTriple *bezt);
|
||||||
|
|
||||||
/* DRAWLINE options flags */
|
/* DRAWLINE options flags */
|
||||||
#define DRAWLIGHT 1
|
#define DRAWLIGHT 1
|
||||||
#define DRAWDASHED 2
|
#define DRAWDASHED 2
|
||||||
|
|||||||
@@ -5172,23 +5172,12 @@ void make_ipo_transdata (TransInfo *t)
|
|||||||
/* only include handles if selected, and interpolaton mode uses beztriples */
|
/* only include handles if selected, and interpolaton mode uses beztriples */
|
||||||
if (ei->icu->ipo==IPO_BEZ) {
|
if (ei->icu->ipo==IPO_BEZ) {
|
||||||
if (bezt->f1 & SELECT) {
|
if (bezt->f1 & SELECT) {
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
|
|
||||||
bezt_to_transdata(td++, td2d++, bezt->vec[0], bezt->vec[1], 1, onlytime);
|
bezt_to_transdata(td++, td2d++, bezt->vec[0], bezt->vec[1], 1, onlytime);
|
||||||
}
|
}
|
||||||
if (bezt->f3 & SELECT) {
|
if (bezt->f3 & SELECT) {
|
||||||
if (hdata==NULL) {
|
if (hdata==NULL) {
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
}
|
}
|
||||||
bezt_to_transdata(td++, td2d++, bezt->vec[2], bezt->vec[1], 1, onlytime);
|
bezt_to_transdata(td++, td2d++, bezt->vec[2], bezt->vec[1], 1, onlytime);
|
||||||
}
|
}
|
||||||
@@ -5199,12 +5188,7 @@ void make_ipo_transdata (TransInfo *t)
|
|||||||
|
|
||||||
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0) {
|
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0) {
|
||||||
if (hdata==NULL) {
|
if (hdata==NULL) {
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1235,6 +1235,18 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Utility function for getting the handle data from bezier's */
|
||||||
|
TransDataCurveHandleFlags *initTransDataCurveHandes(TransData *td, struct BezTriple *bezt) {
|
||||||
|
TransDataCurveHandleFlags *hdata;
|
||||||
|
td->flag |= TD_BEZTRIPLE;
|
||||||
|
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
||||||
|
hdata->ih1 = bezt->h1;
|
||||||
|
hdata->h1 = &bezt->h1;
|
||||||
|
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
||||||
|
hdata->h2 = &bezt->h2;
|
||||||
|
return hdata;
|
||||||
|
}
|
||||||
|
|
||||||
static void createTransCurveVerts(TransInfo *t)
|
static void createTransCurveVerts(TransInfo *t)
|
||||||
{
|
{
|
||||||
TransData *td = NULL;
|
TransData *td = NULL;
|
||||||
@@ -1309,12 +1321,7 @@ static void createTransCurveVerts(TransInfo *t)
|
|||||||
td->tdi = NULL;
|
td->tdi = NULL;
|
||||||
td->val = NULL;
|
td->val = NULL;
|
||||||
|
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
|
|
||||||
Mat3CpyMat3(td->smtx, smtx);
|
Mat3CpyMat3(td->smtx, smtx);
|
||||||
Mat3CpyMat3(td->mtx, mtx);
|
Mat3CpyMat3(td->mtx, mtx);
|
||||||
@@ -1350,12 +1357,7 @@ static void createTransCurveVerts(TransInfo *t)
|
|||||||
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0)
|
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0)
|
||||||
/* If the middle is selected but the sides arnt, this is needed */
|
/* If the middle is selected but the sides arnt, this is needed */
|
||||||
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td++;
|
td++;
|
||||||
@@ -1381,12 +1383,7 @@ static void createTransCurveVerts(TransInfo *t)
|
|||||||
td->val = NULL;
|
td->val = NULL;
|
||||||
|
|
||||||
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
||||||
td->flag |= TD_BEZTRIPLE;
|
hdata = initTransDataCurveHandes(td, bezt);
|
||||||
hdata = td->misc.hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
||||||
hdata->ih1 = bezt->h1;
|
|
||||||
hdata->h1 = &bezt->h1;
|
|
||||||
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
||||||
hdata->h2 = &bezt->h2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mat3CpyMat3(td->smtx, smtx);
|
Mat3CpyMat3(td->smtx, smtx);
|
||||||
|
|||||||
Reference in New Issue
Block a user