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:
authorCampbell Barton <ideasman42@gmail.com>2012-08-06 00:16:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-06 00:16:14 +0400
commit685592f9d9021e3745c99fb29e33db8434aec335 (patch)
treeba09b8024d5daf7a515a87640603c2f5ebf67a17 /source/blender/editors/transform
parent5c7217da721833233241357b22fd3013056b1564 (diff)
fix for transforming parented nodes (parent relative offset wasn't taken into account)
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_conversions.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 00cde33e799..c8fab021651 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2189,12 +2189,21 @@ cleanup:
void flushTransNodes(TransInfo *t)
{
int a;
- TransData2D *td;
+ TransData *td;
+ TransData2D *td2d;
/* flush to 2d vector from internally used 3d vector */
- for (a = 0, td = t->data2d; a < t->total; a++, td++) {
- td->loc2d[0] = td->loc[0];
- td->loc2d[1] = td->loc[1];
+ 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];
}
/* handle intersection with noodles */
@@ -5527,10 +5536,12 @@ static void createTransObject(bContext *C, TransInfo *t)
static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
// static void NodeToTransData(bContext *C, TransInfo *t, TransData2D *td, bNode *node)
{
- td2d->loc[0] = node->locx; /* hold original location */
- td2d->loc[1] = node->locy;
+ /* hold original location */
+ float locxy[2];
+ nodeToView(node, 0.0f, 0.0f, &locxy[0], &locxy[1]);
+ copy_v2_v2(td2d->loc, locxy);
td2d->loc[2] = 0.0f;
- td2d->loc2d = &node->locx; /* current location */
+ //td2d->loc2d = &node->locx; /* current location */
td->flag = 0;
/* exclude nodes whose parent is also transformed */
@@ -5541,8 +5552,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] = node->locx + 0.5f * (node->totr.xmax - node->totr.xmin);
- td->center[1] = node->locy - 0.5f * (node->totr.ymax - node->totr.ymin); /* node height is used negative */
+ 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[2] = 0.0f;
memset(td->axismtx, 0, sizeof(td->axismtx));
@@ -5585,7 +5596,9 @@ static void createTransNodeData(bContext *C, TransInfo *t)
td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransNode TransData2D");
CTX_DATA_BEGIN(C, bNode *, selnode, selected_nodes)
- NodeToTransData(td++, td2d++, selnode);
+ {
+ NodeToTransData(td++, td2d++, selnode);
+ }
CTX_DATA_END
}