Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2011-03-02 20:32:01 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-03-02 20:32:01 +0300
commite6a5715773f8ad09a4666cbb1da3422a1c60526a (patch)
tree9502888f2c2a87570db647a2730302825549135b /source/blender/editors/transform/transform_conversions.c
parent415e8df10e7acb65de83ab1568e3a44a999a410c (diff)
Fix for [#25326] FCurve rotate gives strange results.
* The fcurve points changed their order when rotating, but the transform data wasn't updated properly for this change so some curve handle pointers got lost. * Also found a second bug while fixing this: The fcurve handle type pointers weren't updated at all when the order changed, so some auto handles could turn into aligned handles even if the transform was canceled (no undo possible in this case!).
Diffstat (limited to 'source/blender/editors/transform/transform_conversions.c')
-rw-r--r--source/blender/editors/transform/transform_conversions.c70
1 files changed, 39 insertions, 31 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 79e787919ee..9f8727351e2 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3547,7 +3547,8 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
{
BezTriple *bezts = fcu->bezt;
BeztMap *bezm;
- TransData2D *td;
+ TransData2D *td2d;
+ TransData *td;
int i, j;
char *adjusted;
@@ -3563,43 +3564,50 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
/* loop through transdata, testing if we have a hit
* for the handles (vec[0]/vec[2]), we must also check if they need to be swapped...
*/
- td= t->data2d;
- for (j= 0; j < t->total; j++, td++) {
+ td2d= t->data2d;
+ td= t->data;
+ for (j= 0; j < t->total; j++, td2d++, td++) {
/* skip item if already marked */
if (adjusted[j] != 0) continue;
- /* only selected verts */
- if (bezm->pipo == BEZT_IPO_BEZ) {
- if (use_handle && bezm->bezt->f1 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[0]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- adjusted[j] = 1;
- }
- }
+ /* update all transdata pointers, no need to check for selections etc,
+ * since only points that are really needed were created as transdata
+ */
+ if (td2d->loc2d == bezm->bezt->vec[0]) {
+ if (bezm->swapHs == 1)
+ td2d->loc2d= (bezts + bezm->newIndex)->vec[2];
+ else
+ td2d->loc2d= (bezts + bezm->newIndex)->vec[0];
+ adjusted[j] = 1;
}
- if (bezm->cipo == BEZT_IPO_BEZ) {
- if (use_handle && bezm->bezt->f3 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[2]) {
- if (bezm->swapHs == 1)
- td->loc2d= (bezts + bezm->newIndex)->vec[0];
- else
- td->loc2d= (bezts + bezm->newIndex)->vec[2];
- adjusted[j] = 1;
- }
- }
+ else if (td2d->loc2d == bezm->bezt->vec[2]) {
+ if (bezm->swapHs == 1)
+ td2d->loc2d= (bezts + bezm->newIndex)->vec[0];
+ else
+ td2d->loc2d= (bezts + bezm->newIndex)->vec[2];
+ adjusted[j] = 1;
}
- if (bezm->bezt->f2 & SELECT) {
- if (td->loc2d == bezm->bezt->vec[1]) {
- td->loc2d= (bezts + bezm->newIndex)->vec[1];
+ else if (td2d->loc2d == bezm->bezt->vec[1]) {
+ td2d->loc2d= (bezts + bezm->newIndex)->vec[1];
- /* if only control point is selected, the handle pointers need to be updated as well */
- td->h1= (bezts + bezm->newIndex)->vec[0];
- td->h2= (bezts + bezm->newIndex)->vec[2];
+ /* if only control point is selected, the handle pointers need to be updated as well */
+ if(td2d->h1)
+ td2d->h1= (bezts + bezm->newIndex)->vec[0];
+ if(td2d->h2)
+ td2d->h2= (bezts + bezm->newIndex)->vec[2];
- adjusted[j] = 1;
+ adjusted[j] = 1;
+ }
+
+ /* the handle type pointer has to be updated too */
+ if (adjusted[j] && td->flag & TD_BEZTRIPLE && td->hdata) {
+ if(bezm->swapHs == 1) {
+ td->hdata->h1 = &(bezts + bezm->newIndex)->h2;
+ td->hdata->h2 = &(bezts + bezm->newIndex)->h1;
+ }
+ else {
+ td->hdata->h1 = &(bezts + bezm->newIndex)->h1;
+ td->hdata->h2 = &(bezts + bezm->newIndex)->h2;
}
}
}