diff options
Diffstat (limited to 'source')
12 files changed, 25 insertions, 23 deletions
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index dd0430f4f65..7f3015193ba 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -204,7 +204,7 @@ static bool stroke_elem_project( if (cdd->project.use_plane) { /* get the view vector to 'location' */ float ray_origin[3], ray_direction[3]; - ED_view3d_win_to_ray(cdd->depsgraph, cdd->vc.ar, v3d, mval_fl, ray_origin, ray_direction, false); + ED_view3d_win_to_ray_clipped(cdd->depsgraph, cdd->vc.ar, v3d, mval_fl, ray_origin, ray_direction, false); float lambda; if (isect_ray_plane_v3(ray_origin, ray_direction, cdd->project.plane, &lambda, true)) { diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index dc84dd9253b..0995a73ebfc 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -195,7 +195,7 @@ bool gizmo_window_project_2d( float ray_origin[3], ray_direction[3]; - if (ED_view3d_win_to_ray(CTX_data_depsgraph(C), ar, v3d, mval, ray_origin, ray_direction, false)) { + if (ED_view3d_win_to_ray_clipped(CTX_data_depsgraph(C), ar, v3d, mval, ray_origin, ray_direction, false)) { float lambda; if (isect_ray_plane_v3(ray_origin, ray_direction, plane, &lambda, true)) { float co[3]; diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index 97f45bd53fd..8b504befa16 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -264,7 +264,7 @@ static int gizmo_arrow_modal( int ok = 0; for (int j = 0; j < 2; j++) { - if (ED_view3d_win_to_ray( + if (ED_view3d_win_to_ray_clipped( CTX_data_depsgraph(C), ar, v3d, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction, false)) diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 99cb24c273c..bb272873aec 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -252,11 +252,11 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip); bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]); -bool ED_view3d_win_to_ray( +bool ED_view3d_win_to_ray_clipped( struct Depsgraph *depsgraph, const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3], const bool do_clip); -bool ED_view3d_win_to_ray_ex( +bool ED_view3d_win_to_ray_clipped_ex( struct Depsgraph *depsgraph, const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip); @@ -280,9 +280,10 @@ bool ED_view3d_win_to_3d_on_plane_int( void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]); void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]); -bool ED_view3d_win_to_segment(struct Depsgraph *depsgraph, - const struct ARegion *ar, struct View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_end[3], const bool do_clip); +bool ED_view3d_win_to_segment_clipped( + struct Depsgraph *depsgraph, + const struct ARegion *ar, struct View3D *v3d, const float mval[2], + float r_ray_start[3], float r_ray_end[3], const bool do_clip); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, float obmat[4][4], float pmat[4][4]); diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index d56d9513fc8..4e8985d2a9b 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -100,7 +100,7 @@ static void calc_initial_placement_point_from_view( if (use_mouse_project) { float ray_co[3], ray_no[3]; - if (ED_view3d_win_to_ray( + if (ED_view3d_win_to_ray_clipped( CTX_data_depsgraph(C), ar, v3d, mval, ray_co, ray_no, false)) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 44eceba2ec1..e2f13139718 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1572,8 +1572,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) } /* unproject screen line */ - ED_view3d_win_to_segment(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true); - ED_view3d_win_to_segment(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true); + ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true); + ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true); mul_m4_v3(kcd->ob->imat, v1); mul_m4_v3(kcd->ob->imat, v2); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index ce564e10e60..311df0a54c6 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1118,7 +1118,7 @@ bool EDBM_unified_findnearest_from_raycast( BMElem *ele; } best = {0, NULL}; - if (ED_view3d_win_to_ray( + if (ED_view3d_win_to_ray_clipped( vc->depsgraph, vc->ar, vc->v3d, mval_fl, ray_origin, ray_direction, true)) diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index fd87ba32653..d5b83b71bc3 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1502,7 +1502,7 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, BMEdge *e, ar->winy / 2.0f, }; - ED_view3d_win_to_segment(depsgraph, ar, v3d, mval_f, origin, end, false); + ED_view3d_win_to_segment_clipped(depsgraph, ar, v3d, mval_f, origin, end, false); invert_m4_m4(invmat, obedit->obmat); mul_m4_v3(invmat, origin); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 19488064c97..361eb031ea6 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3751,7 +3751,7 @@ static void brush_add_count_iter( mco[1] = data->mval[1] + dmy; float co1[3], co2[3]; - ED_view3d_win_to_segment(depsgraph, data->vc.ar, data->vc.v3d, mco, co1, co2, true); + ED_view3d_win_to_segment_clipped(depsgraph, data->vc.ar, data->vc.v3d, mco, co1, co2, true); mul_m4_v3(iter_data->imat, co1); mul_m4_v3(iter_data->imat, co2); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ccba962a6f8..7365101b9f2 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4697,7 +4697,7 @@ static float sculpt_raycast_init( RegionView3D *rv3d = vc->ar->regiondata; /* TODO: what if the segment is totally clipped? (return == 0) */ - ED_view3d_win_to_segment(vc->depsgraph, vc->ar, vc->v3d, mouse, ray_start, ray_end, true); + ED_view3d_win_to_segment_clipped(vc->depsgraph, vc->ar, vc->v3d, mouse, ray_start, ray_end, true); invert_m4_m4(obimat, ob->obmat); mul_m4_v3(obimat, ray_start); diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 0885d0e84c4..719530c7293 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -370,7 +370,7 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float * \param do_clip_planes Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray_ex( +bool ED_view3d_win_to_ray_clipped_ex( struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip_planes) @@ -400,12 +400,12 @@ bool ED_view3d_win_to_ray_ex( * \param do_clip_planes Optionally clip the start of the ray by the view clipping planes. * \return success, false if the ray is totally clipped. */ -bool ED_view3d_win_to_ray( +bool ED_view3d_win_to_ray_clipped( struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_normal[3], const bool do_clip_planes) { - return ED_view3d_win_to_ray_ex(depsgraph, ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes); + return ED_view3d_win_to_ray_clipped_ex(depsgraph, ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes); } /** @@ -660,9 +660,10 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3 * \param do_clip_planes Optionally clip the ray by the view clipping planes. * \return success, false if the segment is totally clipped. */ -bool ED_view3d_win_to_segment(struct Depsgraph *depsgraph, - const ARegion *ar, View3D *v3d, const float mval[2], - float r_ray_start[3], float r_ray_end[3], const bool do_clip_planes) +bool ED_view3d_win_to_segment_clipped( + struct Depsgraph *depsgraph, + const ARegion *ar, View3D *v3d, const float mval[2], + float r_ray_start[3], float r_ray_end[3], const bool do_clip_planes) { view3d_win_to_ray_segment(depsgraph, ar, v3d, mval, NULL, NULL, r_ray_start, r_ray_end); diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 33eb481e528..777ff47b69c 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2606,7 +2606,7 @@ static short transform_snap_context_project_view3d_mixed_impl( if (snap_to_flag & SCE_SNAP_MODE_FACE || use_occlusion_test) { float ray_start[3], ray_normal[3]; - if (!ED_view3d_win_to_ray_ex( + if (!ED_view3d_win_to_ray_clipped_ex( sctx->depsgraph, sctx->v3d_data.ar, sctx->v3d_data.v3d, mval, NULL, ray_normal, ray_start, true)) @@ -2770,7 +2770,7 @@ bool ED_transform_snap_object_project_all_view3d_ex( { float ray_start[3], ray_normal[3]; - if (!ED_view3d_win_to_ray_ex( + if (!ED_view3d_win_to_ray_clipped_ex( sctx->depsgraph, sctx->v3d_data.ar, sctx->v3d_data.v3d, mval, NULL, ray_normal, ray_start, true)) |