diff options
author | Germano <germano.costa@ig.com.br> | 2018-05-17 05:04:28 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-05-17 05:04:28 +0300 |
commit | 41cba97f47e71b77adb7db6d80bb13b8c10d2f7d (patch) | |
tree | 3c9bfe15193062f0cc1b4ebf4d4c50e6cfab5114 | |
parent | efe3042368cfeff6004ccc08f9df3b2b21087722 (diff) |
Cleanup: Use `ED_view3d_win_to_ray_ex` to get the ray and remove unused parameter.
4 files changed, 11 insertions, 29 deletions
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index 465a91ad0d0..d65679e1872 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -119,7 +119,6 @@ bool ED_transform_snap_object_project_view3d_ex( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, float r_loc[3], float r_no[3], int *r_index, struct Object **r_ob, float r_obmat[4][4]); bool ED_transform_snap_object_project_view3d( @@ -127,7 +126,6 @@ bool ED_transform_snap_object_project_view3d( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, /* return args */ float r_loc[3], float r_no[3]); bool ED_transform_snap_object_project_view3d_mixed( diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index a3990091b12..c479267603d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4607,7 +4607,7 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2]) .snap_select = SNAP_ALL, .use_object_edit_cage = false, }, - mval_fl, &dist_px, NULL, + mval_fl, &dist_px, cursor_curr->location, ray_no, NULL, &ob_dummy, obmat)) { diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 87e46f996b9..948eb47965f 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1195,7 +1195,7 @@ bool snapObjectsTransform( float *dist_px, float r_loc[3], float r_no[3]) { - return ED_transform_snap_object_project_view3d_ex( + return ED_transform_snap_object_project_view3d( t->tsnap.object_context, t->scene->toolsettings->snap_mode, &(const struct SnapObjectParams){ @@ -1203,9 +1203,7 @@ bool snapObjectsTransform( .use_object_edit_cage = (t->flag & T_EDIT) != 0, .use_occlusion_test = t->scene->toolsettings->snap_mode != SCE_SNAP_MODE_FACE, }, - mval, dist_px, NULL, - r_loc, r_no, NULL, - NULL, NULL); + mval, dist_px, r_loc, r_no); } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 84a4c7dbf14..ec3f9793889 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2310,7 +2310,7 @@ static bool transform_snap_context_project_view3d_mixed_impl( if (ED_transform_snap_object_project_view3d( sctx, elem_type[i], params, - mval, dist_px, NULL, + mval, dist_px, r_co, r_no)) { return true; @@ -2352,7 +2352,6 @@ bool ED_transform_snap_object_project_view3d_ex( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, float r_loc[3], float r_no[3], int *r_index, Object **r_ob, float r_obmat[4][4]) { @@ -2369,33 +2368,22 @@ bool ED_transform_snap_object_project_view3d_ex( const RegionView3D *rv3d = ar->regiondata; if (snap_to == SCE_SNAP_MODE_FACE || params->use_occlusion_test) { - float ray_origin[3], ray_end[3], ray_start[3], ray_normal[3], depth_range[2]; - - ED_view3d_win_to_origin(ar, mval, ray_origin); - ED_view3d_win_to_vector(ar, mval, ray_normal); + float ray_start[3], ray_normal[3]; - ED_view3d_clip_range_get( + if (!ED_view3d_win_to_ray_ex( sctx->depsgraph, - sctx->v3d_data.v3d, sctx->v3d_data.ar->regiondata, - &depth_range[0], &depth_range[1], false); - - madd_v3_v3v3fl(ray_start, ray_origin, ray_normal, depth_range[0]); - madd_v3_v3v3fl(ray_end, ray_origin, ray_normal, depth_range[1]); - - if (!ED_view3d_clip_segment(rv3d, ray_start, ray_end)) { + sctx->v3d_data.ar, sctx->v3d_data.v3d, + mval, NULL, ray_normal, ray_start, true)) + { return false; } - float ray_depth_fallback; - if (ray_depth == NULL) { - ray_depth_fallback = BVH_RAYCAST_DIST_MAX; - ray_depth = &ray_depth_fallback; - } + float dummy_ray_depth = BVH_RAYCAST_DIST_MAX; has_hit = raycastObjects( sctx, params, ray_start, ray_normal, - ray_depth, loc, no, + &dummy_ray_depth, loc, no, r_index, &ob, obmat, NULL); retval = has_hit && (snap_to == SCE_SNAP_MODE_FACE); @@ -2463,7 +2451,6 @@ bool ED_transform_snap_object_project_view3d( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, float r_loc[3], float r_no[3]) { return ED_transform_snap_object_project_view3d_ex( @@ -2471,7 +2458,6 @@ bool ED_transform_snap_object_project_view3d( snap_to, params, mval, dist_px, - ray_depth, r_loc, r_no, NULL, NULL, NULL); } |