Correct armature-sketch snap context use
Use scene snap mode. Also allow passing NULL ray-depth which falls back to BVH_RAYCAST_DIST_MAX.
This commit is contained in:
parent
ce65fae8f3
commit
401e710807
@ -1092,13 +1092,13 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
|
||||
CTX_data_main(C), CTX_data_scene(C), 0,
|
||||
CTX_wm_region(C), CTX_wm_view3d(C));
|
||||
|
||||
found = ED_transform_snap_object_project_view3d_mixed(
|
||||
found = ED_transform_snap_object_project_view3d(
|
||||
snap_context,
|
||||
&(const struct SnapObjectParams){
|
||||
.snap_select = SNAP_NOT_SELECTED,
|
||||
.snap_to_flag = SCE_SELECT_FACE,
|
||||
.snap_to = ts->snap_mode,
|
||||
},
|
||||
mval, &dist_px, true,
|
||||
mval, &dist_px, NULL,
|
||||
vec, no);
|
||||
|
||||
ED_transform_snap_object_context_destroy(snap_context);
|
||||
|
@ -1287,8 +1287,6 @@ bool snapObjectsTransform(
|
||||
float *dist_px,
|
||||
float r_loc[3], float r_no[3])
|
||||
{
|
||||
float ray_dist = BVH_RAYCAST_DIST_MAX;
|
||||
|
||||
return ED_transform_snap_object_project_view3d_ex(
|
||||
t->tsnap.object_context,
|
||||
&(const struct SnapObjectParams){
|
||||
@ -1297,8 +1295,7 @@ bool snapObjectsTransform(
|
||||
.use_object_edit = (t->flag & T_EDIT) != 0,
|
||||
.use_object_active = (t->options & CTX_GPENCIL_STROKES) == 0,
|
||||
},
|
||||
mval, dist_px,
|
||||
&ray_dist,
|
||||
mval, dist_px, NULL,
|
||||
r_loc, r_no, NULL);
|
||||
}
|
||||
|
||||
|
@ -1449,6 +1449,12 @@ bool ED_transform_snap_object_project_view3d_ex(
|
||||
{
|
||||
float ray_start[3], ray_normal[3], ray_orgigin[3];
|
||||
|
||||
float ray_depth_fallback;
|
||||
if (ray_depth == NULL) {
|
||||
ray_depth_fallback = BVH_RAYCAST_DIST_MAX;
|
||||
ray_depth = &ray_depth_fallback;
|
||||
}
|
||||
|
||||
if (!ED_view3d_win_to_ray_ex(
|
||||
sctx->v3d_data.ar, sctx->v3d_data.v3d,
|
||||
mval, ray_orgigin, ray_normal, ray_start, true))
|
||||
|
Loading…
Reference in New Issue
Block a user