[Bf-blender-cvs] [4df99bd6013] blender2.8: Ruler: Fix mixed snap.
Germano
noreply at git.blender.org
Fri May 18 22:12:35 CEST 2018
Commit: 4df99bd60134066c04911c6865c72b262783bc10
Author: Germano
Date: Fri May 18 17:12:20 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB4df99bd60134066c04911c6865c72b262783bc10
Ruler: Fix mixed snap.
===================================================================
M source/blender/editors/transform/transform_snap_object.c
===================================================================
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 26288b162f7..e5397790cf8 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -2242,8 +2242,6 @@ static short snapObjectsRay(
float r_loc[3], float r_no[3], int *r_index,
Object **r_ob, float r_obmat[4][4])
{
- float original_dist_px = *dist_px;
-
struct SnapObjUserData data = {
.snapdata = snapdata,
.dist_px = dist_px,
@@ -2257,15 +2255,6 @@ static short snapObjectsRay(
iter_snap_objects(sctx, params, sanp_obj_cb, &data);
- if ((data.ret == SCE_SELECT_EDGE) &&
- (snapdata->snap_to_flag & SCE_SELECT_VERTEX))
- {
- data.ret = snap_mesh_edge_verts_mixed(
- sctx, snapdata,
- *r_ob, r_obmat, original_dist_px,
- dist_px, r_loc, r_no, r_index);
- }
-
return data.ret;
}
@@ -2459,19 +2448,15 @@ static short transform_snap_context_project_view3d_mixed_impl(
float r_loc[3], float r_no[3], int *r_index,
Object **r_ob, float r_obmat[4][4])
{
- short retval = 0;
-
BLI_assert(snap_to_flag != 0);
BLI_assert((snap_to_flag & ~(1 | 2 | 4)) == 0);
+ short retval = 0;
+ int index = -1;
+
float loc[3], no[3], obmat[4][4];
Object *ob = NULL;
- int index_fallback;
- if (r_index == NULL) {
- r_index = &index_fallback;
- }
-
const ARegion *ar = sctx->v3d_data.ar;
const RegionView3D *rv3d = ar->regiondata;
@@ -2492,7 +2477,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
sctx, params,
ray_start, ray_normal,
&dummy_ray_depth, loc, no,
- r_index, &ob, obmat, NULL) ? SCE_SELECT_FACE : 0;
+ &index, &ob, obmat, NULL) ? SCE_SELECT_FACE : 0;
}
if (snap_to_flag & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) {
@@ -2522,7 +2507,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
/* Try to snap only to the polygon. */
elem = snap_mesh_polygon(
sctx, &snapdata, ob, obmat,
- &dist_px_tmp, loc, no, r_index);
+ &dist_px_tmp, loc, no, &index);
if (elem) {
retval = elem;
@@ -2538,12 +2523,21 @@ static short transform_snap_context_project_view3d_mixed_impl(
elem = snapObjectsRay(
sctx, &snapdata, params,
- &dist_px_tmp, loc, no, r_index, &ob, obmat);
+ &dist_px_tmp, loc, no, &index, &ob, obmat);
if (elem) {
retval = elem;
}
+ if ((retval == SCE_SELECT_EDGE) &&
+ (snapdata.snap_to_flag & SCE_SELECT_VERTEX))
+ {
+ retval = snap_mesh_edge_verts_mixed(
+ sctx, &snapdata,
+ ob, obmat, *dist_px,
+ &dist_px_tmp, loc, no, &index);
+ }
+
*dist_px = dist_px_tmp;
}
@@ -2558,6 +2552,9 @@ static short transform_snap_context_project_view3d_mixed_impl(
if (r_obmat) {
copy_m4_m4(r_obmat, obmat);
}
+ if (r_index) {
+ *r_index = index;
+ }
return retval;
}
More information about the Bf-blender-cvs
mailing list