[Bf-blender-cvs] [e8c27b1bbad] blender2.8: Cleanup: use win_to_3d_on_plane function

Campbell Barton noreply at git.blender.org
Thu Sep 20 04:41:50 CEST 2018


Commit: e8c27b1bbad7ad960378ad65ddc41c882fd61bc5
Author: Campbell Barton
Date:   Thu Sep 20 12:53:39 2018 +1000
Branches: blender2.8
https://developer.blender.org/rBe8c27b1bbad7ad960378ad65ddc41c882fd61bc5

Cleanup: use win_to_3d_on_plane function

===================================================================

M	source/blender/editors/gizmo_library/gizmo_library_utils.c
M	source/blender/editors/mesh/editmesh_add_gizmo.c

===================================================================

diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index e3b93e671df..350c9922179 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -188,17 +188,9 @@ bool gizmo_window_project_2d(
 		/* For 3d views, transform 2D mouse pos onto plane. */
 		ARegion *ar = CTX_wm_region(C);
 
-		float plane[4];
-
+		float plane[4], co[3];
 		plane_from_point_normal_v3(plane, mat[3], mat[2]);
-
-		float ray_origin[3], ray_direction[3];
-		float lambda;
-
-		ED_view3d_win_to_ray(ar, mval, ray_origin, ray_direction);
-		if (isect_ray_plane_v3(ray_origin, ray_direction, plane, &lambda, true)) {
-			float co[3];
-			madd_v3_v3v3fl(co, ray_origin, ray_direction, lambda);
+		if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, true, co)) {
 			float imat[4][4];
 			invert_m4_m4(imat, mat);
 			mul_m4_v3(imat, co);
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index 850ca27d26a..253f546c7af 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -99,15 +99,9 @@ static void calc_initial_placement_point_from_view(
 	}
 
 	if (use_mouse_project) {
-		float ray_co[3], ray_no[3];
-		ED_view3d_win_to_ray(
-		        ar, mval,
-		        ray_co, ray_no);
 		float plane[4];
 		plane_from_point_normal_v3(plane, cursor_matrix[3], orient_matrix[2]);
-		float lambda;
-		if (isect_ray_plane_v3(ray_co, ray_no, plane, &lambda, true)) {
-			madd_v3_v3v3fl(r_location, ray_co, ray_no, lambda);
+		if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, true, r_location)) {
 			copy_m3_m3(r_rotation, orient_matrix);
 			return;
 		}



More information about the Bf-blender-cvs mailing list