[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36754] trunk/blender/source/blender/ editors/armature/editarmature.c: use window_to_3d for armature_click_extrude operator.

Campbell Barton ideasman42 at gmail.com
Wed May 18 20:14:59 CEST 2011


Revision: 36754
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36754
Author:   campbellbarton
Date:     2011-05-18 18:14:59 +0000 (Wed, 18 May 2011)
Log Message:
-----------
use window_to_3d for armature_click_extrude operator.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2011-05-18 18:01:01 UTC (rev 36753)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2011-05-18 18:14:59 UTC (rev 36754)
@@ -2498,8 +2498,8 @@
 	ARegion *ar;
 	View3D *v3d;
 	RegionView3D *rv3d;
-	float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
-	int mx, my, mval[2];
+	float *fp = NULL, tvec[3], oldcurs[3];
+	int mx, my;
 	int retv;
 
 	scene= CTX_data_scene(C);
@@ -2513,28 +2513,10 @@
 	
 	mx= event->x - ar->winrct.xmin;
 	my= event->y - ar->winrct.ymin;
-	project_int_noclip(ar, fp, mval);
-	
-	initgrabz(rv3d, fp[0], fp[1], fp[2]);
-	
-	if(mval[0]!=IS_CLIPPED) {
-		
-		window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
-		sub_v3_v3v3(fp, fp, dvec);
-	}
-	else {
-		
-		dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
-		dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
-		
-		fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
-		fz= fz/rv3d->zfac;
-		
-		fp[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0];
-		fp[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1];
-		fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2];
-	}
 
+	window_to_3d(ar, tvec, fp, mx, my);
+	copy_v3_v3(fp, tvec);
+
 	/* extrude to the where new cursor is and store the operation result */
 	retv= armature_click_extrude_exec(C, op);
 




More information about the Bf-blender-cvs mailing list