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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-20 04:38:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-20 04:38:11 +0300
commitce56088bcdd2e5ea14918bd1fe491c3bb2e7c0dc (patch)
treed4045dd40868a7e5960f958691ec162a4fa937f2 /source/blender
parent6a01f62df44cf8d55711ce3a7224f86721547bd5 (diff)
Gizmo: use ED_view3d_win_to_3d_on_plane
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c18
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c11
2 files changed, 8 insertions, 21 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index ffb043ee01f..6b1a76c47ee 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -197,10 +197,9 @@ static void dial_ghostarc_draw(
}
static void dial_ghostarc_get_angles(
- struct Depsgraph *depsgraph,
const wmGizmo *gz,
const wmEvent *event,
- const ARegion *ar, const View3D *v3d,
+ const ARegion *ar,
float mat[4][4], const float co_outer[3],
float *r_start, float *r_delta)
{
@@ -220,25 +219,17 @@ static void dial_ghostarc_get_angles(
float proj_mval_new_rel[3];
float proj_mval_init_rel[3];
float dial_plane[4];
- float ray_co[3], ray_no[3];
- float ray_lambda;
plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
- if (!ED_view3d_win_to_ray(depsgraph, ar, v3d, inter->init.mval, ray_co, ray_no, false) ||
- !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false))
- {
+ if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, proj_mval_init_rel)) {
goto fail;
}
- madd_v3_v3v3fl(proj_mval_init_rel, ray_co, ray_no, ray_lambda);
sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
- if (!ED_view3d_win_to_ray(depsgraph, ar, v3d, mval, ray_co, ray_no, false) ||
- !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false))
- {
+ if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, proj_mval_new_rel)) {
goto fail;
}
- madd_v3_v3v3fl(proj_mval_new_rel, ray_co, ray_no, ray_lambda);
sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
const int draw_options = RNA_enum_get(gz->ptr, "draw_options");
@@ -429,8 +420,7 @@ static int gizmo_dial_modal(
float angle_ofs, angle_delta;
dial_ghostarc_get_angles(
- CTX_data_depsgraph(C),
- gz, event, CTX_wm_region(C), CTX_wm_view3d(C), gz->matrix_basis, co_outer, &angle_ofs, &angle_delta);
+ gz, event, CTX_wm_region(C), gz->matrix_basis, co_outer, &angle_ofs, &angle_delta);
if (tweak_flag & WM_GIZMO_TWEAK_SNAP) {
const double snap = DEG2RAD(5);
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index c5d948a7a2e..038a45650bf 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -537,15 +537,12 @@ static void gizmo_mesh_spin_redo_modal_from_setup(
float plane_co[3], plane_no[3];
RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_no, plane_no);
- float cursor_co[3], cursor_no[3];
+ float cursor_co[3];
const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
- ED_view3d_win_to_3d_int(v3d, ar, plane_co, mval, cursor_co);
- ED_view3d_global_to_vector(ar->regiondata, cursor_co, cursor_no);
-
- float lambda, plane[4];
+ float plane[4];
plane_from_point_normal_v3(plane, plane_co, plane_no);
- if (isect_ray_plane_v3(cursor_co, cursor_no, plane, &lambda, false)) {
- madd_v3_v3fl(cursor_co, cursor_no, lambda);
+ if (UNLIKELY(!ED_view3d_win_to_3d_on_plane_int(ar, plane, mval, cursor_co))) {
+ ED_view3d_win_to_3d_int(v3d, ar, plane, mval, cursor_co);
}
sub_v3_v3v3(ggd->data.orient_axis, cursor_co, plane_co);
normalize_v3(ggd->data.orient_axis);