diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-18 22:14:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-18 22:14:59 +0400 |
commit | 91bd739a093f8bb3613f52b6a0edeacfd8c09d66 (patch) | |
tree | 7a1ff28acf6ade0870daa7a890746abe42aee9fc /source | |
parent | 7282f8cf98ac7d228b1ffb209fae081acf7d05a1 (diff) |
use window_to_3d for armature_click_extrude operator.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 7d741d31afe..06b2c06d4d2 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2498,8 +2498,8 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e 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,27 +2513,9 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e 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); |