[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36633] trunk/blender/source/blender/ editors/space_view3d: window_to_3d_vector was incorrect but dolly view operator was accounting for it .

Campbell Barton ideasman42 at gmail.com
Thu May 12 08:52:24 CEST 2011


Revision: 36633
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36633
Author:   campbellbarton
Date:     2011-05-12 06:52:24 +0000 (Thu, 12 May 2011)
Log Message:
-----------
window_to_3d_vector was incorrect but dolly view operator was accounting for it. fixed so result isnt negated and mouse coords dont need to be adjusted.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-05-12 06:48:45 UTC (rev 36632)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2011-05-12 06:52:24 UTC (rev 36633)
@@ -396,7 +396,7 @@
 	}
 
 	/* for dolly */
-	window_to_3d_vector(vod->ar, vod->mousevec, (vod->oldx - vod->ar->winrct.xmin)-(vod->ar->winx)/2, (vod->oldy - vod->ar->winrct.ymin)-(vod->ar->winy)/2);
+	window_to_3d_vector(vod->ar, vod->mousevec, vod->oldx - vod->ar->winrct.xmin, vod->oldy - vod->ar->winrct.ymin);
 
 	/* lookup, we dont pass on v3d to prevent confusement */
 	vod->grid= v3d->grid;
@@ -1349,7 +1349,7 @@
 static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
 {
 	RegionView3D *rv3d= ar->regiondata;
-	madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, 1.0 - dfac);
+	madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac));
 }
 
 static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert)
@@ -1444,7 +1444,8 @@
 	else {
 		sa= CTX_wm_area(C);
 		ar= CTX_wm_region(C);
-		normalize_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
+		negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
+		normalize_v3(mousevec);
 	}
 
 	/* v3d= sa->spacedata.first; */ /* UNUSED */
@@ -1498,7 +1499,8 @@
 
 		/* overwrite the mouse vector with the view direction (zoom into the center) */
 		if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
-			normalize_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
+			negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
+			normalize_v3(vod->mousevec);
 		}
 
 		if (event->type == MOUSEZOOM) {

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2011-05-12 06:48:45 UTC (rev 36632)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2011-05-12 06:52:24 UTC (rev 36633)
@@ -687,15 +687,15 @@
 	float dx, dy;
 	float viewvec[3];
 
-	dx= 2.0f*mx/ar->winx;
-	dy= 2.0f*my/ar->winy;
+	dx= (2.0f * mx / ar->winx) - 1.0f;
+	dy= (2.0f * my / ar->winy) - 1.0f;
 
 	/* normalize here so vecs are proportional to eachother */
 	normalize_v3_v3(viewvec, rv3d->viewinv[2]);
 
-	out[0]= viewvec[0] - (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy);
-	out[1]= viewvec[1] - (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy);
-	out[2]= viewvec[2] - (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy);
+	out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy) - viewvec[0];
+	out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy) - viewvec[1];
+	out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy) - viewvec[2];
 
 	normalize_v3(out);
 }




More information about the Bf-blender-cvs mailing list