From a5f046f44931a61272a065334438af86ddf9915c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jun 2018 12:55:15 +0200 Subject: Cleanup: rename 3D cursor calculation vars --- source/blender/editors/space_view3d/view3d_edit.c | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'source/blender/editors/space_view3d') diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 6bc8f5fc36d..5cf167165cd 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4529,7 +4529,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* cursor position in vec, result in vec, mval in region coords */ /* note: cannot use event->mval here (called by object_add() */ -void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) +void ED_view3d_cursor3d_position(bContext *C, const int mval[2], float cursor_co[3]) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -4544,25 +4544,25 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) if (rv3d == NULL) return; - ED_view3d_calc_zfac(rv3d, fp, &flip); + ED_view3d_calc_zfac(rv3d, cursor_co, &flip); /* reset the depth based on the view offset (we _know_ the offset is infront of us) */ if (flip) { - negate_v3_v3(fp, rv3d->ofs); + negate_v3_v3(cursor_co, rv3d->ofs); /* re initialize, no need to check flip again */ - ED_view3d_calc_zfac(rv3d, fp, NULL /* &flip */ ); + ED_view3d_calc_zfac(rv3d, cursor_co, NULL /* &flip */ ); } if (U.uiflag & USER_DEPTH_CURSOR) { /* maybe this should be accessed some other way */ view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(bmain, scene, ar, v3d, mval, fp, true, NULL)) + if (ED_view3d_autodist(bmain, scene, ar, v3d, mval, cursor_co, true, NULL)) depth_used = true; } if (depth_used == false) { float depth_pt[3]; - copy_v3_v3(depth_pt, fp); - ED_view3d_win_to_3d_int(v3d, ar, depth_pt, mval, fp); + copy_v3_v3(depth_pt, cursor_co); + ED_view3d_win_to_3d_int(v3d, ar, depth_pt, mval, cursor_co); } } @@ -4571,12 +4571,12 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2]) Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); - float *fp_curr = ED_view3d_cursor3d_get(scene, v3d); - float fp_prev[3]; + float *cursor_co_curr = ED_view3d_cursor3d_get(scene, v3d); + float cursor_co_prev[3]; - copy_v3_v3(fp_prev, fp_curr); + copy_v3_v3(cursor_co_prev, cursor_co_curr); - ED_view3d_cursor3d_position(C, fp_curr, mval); + ED_view3d_cursor3d_position(C, mval, cursor_co_curr); /* offset the cursor lock to avoid jumping to new offset */ if (v3d->ob_centre_cursor) { @@ -4585,13 +4585,15 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2]) if (U.uiflag & USER_LOCK_CURSOR_ADJUST) { - float co_curr[2], co_prev[2]; + float co_2d_curr[2], co_2d_prev[2]; - if ((ED_view3d_project_float_global(ar, fp_prev, co_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) && - (ED_view3d_project_float_global(ar, fp_curr, co_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) + if ((ED_view3d_project_float_global( + ar, cursor_co_prev, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) && + (ED_view3d_project_float_global( + ar, cursor_co_curr, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) { - rv3d->ofs_lock[0] += (co_curr[0] - co_prev[0]) / (ar->winx * 0.5f); - rv3d->ofs_lock[1] += (co_curr[1] - co_prev[1]) / (ar->winy * 0.5f); + rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (ar->winx * 0.5f); + rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (ar->winy * 0.5f); } } else { -- cgit v1.2.3