Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-22 13:55:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-22 13:55:15 +0300
commita5f046f44931a61272a065334438af86ddf9915c (patch)
treec3ee3e4ed60ae7a94fb76c4cfb7bb7dc12b46993 /source
parent2fe528424d168f124efca5d94c6b0363be49dbf3 (diff)
Cleanup: rename 3D cursor calculation vars
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/object/object_add.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c34
3 files changed, 22 insertions, 20 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 8cde96fc898..fe1fc7dc0cc 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -92,7 +92,7 @@ typedef struct ViewDepths {
} ViewDepths;
float *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d);
-void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
+void ED_view3d_cursor3d_position(struct bContext *C, const int mval[2], float cursor_co[3]);
void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2]);
struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 10121e8ae2f..9f016e13f49 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -860,7 +860,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
/* add under the mouse */
ED_object_location_from_view(C, ob->loc);
- ED_view3d_cursor3d_position(C, ob->loc, event->mval);
+ ED_view3d_cursor3d_position(C, event->mval, ob->loc);
}
BKE_object_empty_draw_type_set(ob, OB_EMPTY_IMAGE);
@@ -984,7 +984,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
const int mval[2] = {event->x - ar->winrct.xmin,
event->y - ar->winrct.ymin};
ED_object_location_from_view(C, loc);
- ED_view3d_cursor3d_position(C, loc, mval);
+ ED_view3d_cursor3d_position(C, mval, loc);
RNA_float_set_array(op->ptr, "location", loc);
}
}
@@ -2384,7 +2384,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
const int mval[2] = {event->x - ar->winrct.xmin,
event->y - ar->winrct.ymin};
ED_object_location_from_view(C, basen->object->loc);
- ED_view3d_cursor3d_position(C, basen->object->loc, mval);
+ ED_view3d_cursor3d_position(C, mval, basen->object->loc);
}
ED_base_object_select(basen, BA_SELECT);
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 {