[Bf-blender-cvs] [de0dab66ff8] master: Fix T63086: Navigation problem with Background/Reference Images

Sebastian Parborg noreply at git.blender.org
Sat Mar 30 08:22:52 CET 2019


Commit: de0dab66ff896992251763d6e799cc682ff03543
Author: Sebastian Parborg
Date:   Sat Mar 30 08:21:09 2019 +0100
Branches: master
https://developer.blender.org/rBde0dab66ff896992251763d6e799cc682ff03543

Fix T63086: Navigation problem with Background/Reference Images

The issue was the manipulated depth for images would be used when doing distance depth checks.
Now we will use the actual depth of the image object when doing such tests.

Reviewed By: Clément Foucault

Differential Revision: http://developer.blender.org/D4616

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

M	source/blender/draw/modes/object_mode.c

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

diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index bce68623536..3cb3d28a29c 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -945,12 +945,21 @@ static void DRW_shgroup_empty_image(
 	float image_aspect[2];
 	image_calc_aspect(ob->data, size, image_aspect);
 
+	char depth_mode;
+	if (DRW_state_is_depth()) {
+		/* Use the actual depth if we are doing depth tests to determine the distance to the object */
+		depth_mode = OB_EMPTY_IMAGE_DEPTH_DEFAULT;
+	}
+	else {
+		depth_mode = ob->empty_image_depth;
+	}
+
 	{
 		DRWShadingGroup *grp = DRW_shgroup_create(sh_data->object_empty_image_wire, sgl->non_meshes);
 		/* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */
 		DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
 		DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]);
-		DRW_shgroup_uniform_int_copy(grp, "depthMode", ob->empty_image_depth);
+		DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode);
 		DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1);
 		DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
 		DRW_shgroup_uniform_vec3(grp, "color", color, 1);
@@ -969,7 +978,7 @@ static void DRW_shgroup_empty_image(
 		                                          (use_alpha_blend) ? sgl->image_empties : sgl->non_meshes);
 		DRW_shgroup_uniform_float_copy(grp, "aspectX", image_aspect[0]);
 		DRW_shgroup_uniform_float_copy(grp, "aspectY", image_aspect[1]);
-		DRW_shgroup_uniform_int_copy(grp, "depthMode", ob->empty_image_depth);
+		DRW_shgroup_uniform_int_copy(grp, "depthMode", depth_mode);
 		DRW_shgroup_uniform_float(grp, "size", &ob->empty_drawsize, 1);
 		DRW_shgroup_uniform_vec2(grp, "offset", ob->ima_ofs, 1);
 		DRW_shgroup_uniform_texture(grp, "image", tex);



More information about the Bf-blender-cvs mailing list