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);