diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-04 19:22:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-04 19:22:19 +0400 |
commit | e8e100738674cba65f70c7be49e0fb210645c06a (patch) | |
tree | 63c62be7935c1641cab4e63fefb9a3be30c83fa9 /source/blender/src/transform_conversions.c | |
parent | 6b6e5eb4c979e050478baa39d7402c03bcc73c80 (diff) |
moved some duplicate lines into their own function
Diffstat (limited to 'source/blender/src/transform_conversions.c')
-rw-r--r-- | source/blender/src/transform_conversions.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index a93e43b0f3f..a21ba1fa210 100644 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -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) { TransData *td = NULL; @@ -1309,12 +1321,7 @@ static void createTransCurveVerts(TransInfo *t) td->tdi = NULL; td->val = NULL; - 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; + hdata = initTransDataCurveHandes(td, bezt); Mat3CpyMat3(td->smtx, smtx); Mat3CpyMat3(td->mtx, mtx); @@ -1350,12 +1357,7 @@ static void createTransCurveVerts(TransInfo *t) if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0) /* 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 */ - 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; + hdata = initTransDataCurveHandes(td, bezt); } td++; @@ -1381,12 +1383,7 @@ static void createTransCurveVerts(TransInfo *t) td->val = NULL; if (hdata==NULL) { /* if the handle was not saved by the previous handle */ - 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; + hdata = initTransDataCurveHandes(td, bezt); } Mat3CpyMat3(td->smtx, smtx); |