[Bf-blender-cvs] [50c29e23911] blender2.8: Cleanup: pass the use_depth parameter to the `SnapObjectParams` struct in the ED_transform_snap_object_project_view3d_mixed.

Germano noreply at git.blender.org
Tue May 15 19:32:40 CEST 2018


Commit: 50c29e239114b7f5dd533ec080fc75f4fbda6a99
Author: Germano
Date:   Tue May 15 14:32:30 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB50c29e239114b7f5dd533ec080fc75f4fbda6a99

Cleanup: pass the use_depth parameter to the `SnapObjectParams` struct in the ED_transform_snap_object_project_view3d_mixed.

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

M	source/blender/editors/curve/editcurve.c
M	source/blender/editors/include/ED_transform_snap_object_context.h
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/space_view3d/view3d_manipulator_ruler.c
M	source/blender/editors/space_view3d/view3d_ruler.c
M	source/blender/editors/transform/transform_snap_object.c

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

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index f97ac98107c..7e540ee074a 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5021,8 +5021,9 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 			        &(const struct SnapObjectParams){
 			            .snap_select = (vc.obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL,
 			            .use_object_edit_cage = false,
+			            .use_occlusion_test = true,
 			        },
-			        mval, NULL, true,
+			        mval, NULL,
 			        location, NULL);
 
 
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 f1d47911cdd..465a91ad0d0 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -72,6 +72,9 @@ struct SnapObjectParams {
 	char snap_select;
 	/* use editmode cage */
 	unsigned int use_object_edit_cage : 1;
+	/* snap to the closest element, use when using more than one snap type */
+	unsigned int use_occlusion_test   : 1;
+
 };
 
 typedef struct SnapObjectContext SnapObjectContext;
@@ -132,7 +135,6 @@ bool ED_transform_snap_object_project_view3d_mixed(
         const unsigned short snap_to_flag,
         const struct SnapObjectParams *params,
         const float mval_fl[2], float *dist_px,
-        bool use_depth,
         float r_co[3], float r_no[3]);
 
 bool ED_transform_snap_object_project_all_view3d_ex(
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index e03f04c48f0..3782b9e2c10 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -379,8 +379,9 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
 				        &(const struct SnapObjectParams){
 				            .snap_select = SNAP_NOT_ACTIVE,
 				            .use_object_edit_cage = false,
+				            .use_occlusion_test = true,
 				        },
-				        mval, NULL, true,
+				        mval, NULL,
 				        co_proj, NULL))
 				{
 					mul_v3_m4v3(eve->co, obedit->imat, co_proj);
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
index eedc346db1d..9f69a33861d 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
@@ -326,8 +326,9 @@ static bool view3d_ruler_item_mousemove(
 			        &(const struct SnapObjectParams){
 			            .snap_select = SNAP_ALL,
 			            .use_object_edit_cage = true,
+			            .use_occlusion_test = true,
 			        },
-			        mval_fl, &dist_px, true,
+			        mval_fl, &dist_px,
 			        co, ray_normal))
 			{
 				negate_v3(ray_normal);
@@ -355,8 +356,9 @@ static bool view3d_ruler_item_mousemove(
 			        &(const struct SnapObjectParams){
 			            .snap_select = SNAP_ALL,
 			            .use_object_edit_cage = true,
+			            .use_occlusion_test = use_depth,
 			        },
-			        mval_fl, &dist_px, use_depth,
+			        mval_fl, &dist_px,
 			        co, NULL))
 			{
 				ruler_info->snap_flag |= RULER_SNAP_OK;
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index 6706a98ba55..64b5d32191f 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -767,8 +767,9 @@ static bool view3d_ruler_item_mousemove(
 			        &(const struct SnapObjectParams){
 			            .snap_select = SNAP_ALL,
 			            .use_object_edit_cage = true,
+			            .use_occlusion_test = true,
 			        },
-			        mval_fl, &dist_px, true,
+			        mval_fl, &dist_px,
 			        co, ray_normal))
 			{
 				negate_v3(ray_normal);
@@ -796,8 +797,9 @@ static bool view3d_ruler_item_mousemove(
 			        &(const struct SnapObjectParams){
 			            .snap_select = SNAP_ALL,
 			            .use_object_edit_cage = true,
+			            .use_occlusion_test = use_depth,
 			        },
-			        mval_fl, &dist_px, use_depth,
+			        mval_fl, &dist_px,
 			        co, NULL))
 			{
 				ruler_info->snap_flag |= RULER_SNAP_OK;
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 4e9fd01ba8a..2419ab7ec92 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -2122,7 +2122,6 @@ static bool transform_snap_context_project_view3d_mixed_impl(
         const unsigned short snap_to_flag,
         const struct SnapObjectParams *params,
         const float mval[2], float *dist_px,
-        bool use_depth,
         float r_co[3], float r_no[3])
 {
 	float ray_depth = BVH_RAYCAST_DIST_MAX;
@@ -2133,7 +2132,7 @@ static bool transform_snap_context_project_view3d_mixed_impl(
 	BLI_assert(snap_to_flag != 0);
 	BLI_assert((snap_to_flag & ~(1 | 2 | 4)) == 0);
 
-	if (use_depth) {
+	if (params->use_occlusion_test) {
 		const float dist_px_orig = dist_px ? *dist_px : 0;
 		for (int i = 2; i >= 0; i--) {
 			if (snap_to_flag & (1 << i)) {
@@ -2182,7 +2181,6 @@ static bool transform_snap_context_project_view3d_mixed_impl(
  * \param sctx: Snap context.
  * \param mval_fl: Screenspace coordinate.
  * \param dist_px: Maximum distance to snap (in pixels).
- * \param use_depth: Snap to the closest element, use when using more than one snap type.
  * \param r_co: hit location.
  * \param r_no: hit normal (optional).
  * \return Snap success
@@ -2192,13 +2190,12 @@ bool ED_transform_snap_object_project_view3d_mixed(
         const unsigned short snap_to_flag,
         const struct SnapObjectParams *params,
         const float mval_fl[2], float *dist_px,
-        bool use_depth,
         float r_co[3], float r_no[3])
 {
 	return transform_snap_context_project_view3d_mixed_impl(
 	        sctx,
 	        snap_to_flag, params,
-	        mval_fl, dist_px, use_depth,
+	        mval_fl, dist_px,
 	        r_co, r_no);
 }



More information about the Bf-blender-cvs mailing list