diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-06 13:08:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-06 13:08:24 +0400 |
commit | 3b743582ec282cfffc84c5e235f58fe2745327c9 (patch) | |
tree | 7fb775236f11f261525b4c26a576c60716dc609e /source/blender | |
parent | df81b50bf2b250e09faae0af469e676203a4ff3e (diff) |
node transform for frames was broken since the frames locx, locy are used as offsets, now node transform uses node ccenters (works nicer for regular nodes too).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5a8e83d3df0..0fdd8736248 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2195,15 +2195,7 @@ void flushTransNodes(TransInfo *t) /* flush to 2d vector from internally used 3d vector */ for (a = 0, td = t->data, td2d = t->data2d; a < t->total; a++, td++, td2d++) { bNode *node = td->extra; - float locxy[2]; - if (node->parent) { - nodeFromView(node->parent, td2d->loc[0], td2d->loc[1], &locxy[0], &locxy[1]); - } - else { - copy_v2_v2(locxy, td2d->loc); - } - node->locx = locxy[0]; - node->locy = locxy[1]; + add_v2_v2v2(&node->locx, td2d->loc, td2d->ih1); } /* handle intersection with noodles */ @@ -5536,8 +5528,9 @@ static void createTransObject(bContext *C, TransInfo *t) static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node) { /* hold original location */ - float locxy[2]; - nodeToView(node, 0.0f, 0.0f, &locxy[0], &locxy[1]); + float locxy[2] = {(node->totr.xmax + node->totr.xmin) / 2.0f, + (node->totr.ymax + node->totr.ymin) / 2.0f}; + copy_v2_v2(td2d->loc, locxy); td2d->loc[2] = 0.0f; td2d->loc2d = td2d->loc; /* current location */ @@ -5547,8 +5540,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node) td->loc = td2d->loc; copy_v3_v3(td->iloc, td->loc); /* use node center instead of origin (top-left corner) */ - td->center[0] = locxy[0] + 0.5f * (node->totr.xmax - node->totr.xmin); - td->center[1] = locxy[1] - 0.5f * (node->totr.ymax - node->totr.ymin); /* node height is used negative */ + td->center[0] = locxy[0]; + td->center[1] = locxy[1]; td->center[2] = 0.0f; memset(td->axismtx, 0, sizeof(td->axismtx)); @@ -5562,6 +5555,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node) unit_m3(td->mtx); unit_m3(td->smtx); + sub_v2_v2v2(td2d->ih1, &node->locx, locxy); + td->extra = node; } |