[Bf-blender-cvs] [d6f02cd1d75] master: Fix T63340: Transform Snap Object: Simulate occlusion only when `use_occlusion_test` is true.

mano-wii noreply at git.blender.org
Mon Apr 8 15:49:49 CEST 2019


Commit: d6f02cd1d75a9f7bb4fd9a5bf945779324c86896
Author: mano-wii
Date:   Mon Apr 8 10:49:15 2019 -0300
Branches: master
https://developer.blender.org/rBd6f02cd1d75a9f7bb4fd9a5bf945779324c86896

Fix T63340: Transform Snap Object: Simulate occlusion only when `use_occlusion_test` is true.

And cleanup.

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

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 ea3657b8729..7ca62b89bf9 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -673,21 +673,22 @@ static bool raycastObj(
 {
 	bool retval = false;
 
-	if (use_occlusion_test) {
-		if (use_obedit && sctx->use_v3d &&
-		    !V3D_IS_ZBUF(sctx->v3d_data.v3d))
-		{
-			/* Use of occlude geometry in editing mode disabled. */
-			return false;
-		}
-	}
-
 	switch (ob->type) {
 		case OB_MESH:
 		{
-			if (ob->dt == OB_BOUNDBOX || ob->dt == OB_WIRE) {
-				/* Do not hit objects that are in wire or bounding box display mode */
-				return false;
+			if (use_occlusion_test) {
+				if (use_obedit && sctx->use_v3d &&
+				    !V3D_IS_ZBUF(sctx->v3d_data.v3d))
+				{
+					/* Use of occlude geometry in editing mode disabled. */
+					return false;
+				}
+
+				if (ELEM(ob->dt, OB_BOUNDBOX, OB_WIRE)) {
+					/* Do not hit objects that are in wire or bounding box
+					 * display mode. */
+					return false;
+				}
 			}
 
 			Mesh *me = ob->data;
@@ -2540,8 +2541,7 @@ static short transform_snap_context_project_view3d_mixed_impl(
 	const RegionView3D *rv3d = ar->regiondata;
 
 	bool use_occlusion_test =
-	        params->use_occlusion_test &&
-	        !(sctx->v3d_data.v3d->shading.flag & V3D_XRAY_FLAG(sctx->v3d_data.v3d));
+	        params->use_occlusion_test && V3D_IS_ZBUF(sctx->v3d_data.v3d);
 
 	if (snap_to_flag & SCE_SNAP_MODE_FACE || use_occlusion_test) {
 		float ray_start[3], ray_normal[3];



More information about the Bf-blender-cvs mailing list