[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49600] trunk/blender/source/blender/ editors/transform/transform_conversions.c: 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).

Campbell Barton ideasman42 at gmail.com
Mon Aug 6 11:08:24 CEST 2012


Revision: 49600
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49600
Author:   campbellbarton
Date:     2012-08-06 09:08:24 +0000 (Mon, 06 Aug 2012)
Log Message:
-----------
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).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform_conversions.c

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2012-08-06 08:41:45 UTC (rev 49599)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2012-08-06 09:08:24 UTC (rev 49600)
@@ -2195,15 +2195,7 @@
 	/* 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 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 @@
 	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 @@
 	unit_m3(td->mtx);
 	unit_m3(td->smtx);
 
+	sub_v2_v2v2(td2d->ih1, &node->locx, locxy);
+
 	td->extra = node;
 }
 




More information about the Bf-blender-cvs mailing list