[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55363] trunk/blender/source/blender/ editors: Fix: Setting cursor to semitransparent objects will fail because of clip

Antony Riakiotakis kalast at gmail.com
Sun Mar 17 21:24:48 CET 2013


Revision: 55363
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55363
Author:   psy-fi
Date:     2013-03-17 20:24:47 +0000 (Sun, 17 Mar 2013)
Log Message:
-----------
Fix: Setting cursor to semitransparent objects will fail because of clip
alpha, added option when drawing depth to disable alpha clip override.
We use that in texture paint cursor now. Not too common but may be
useful for people dealing with cloning plugins.

Reported by kgeogeo on irc, thanks.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_intern.h

Modified: trunk/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_view3d.h	2013-03-17 19:55:10 UTC (rev 55362)
+++ trunk/blender/source/blender/editors/include/ED_view3d.h	2013-03-17 20:24:47 UTC (rev 55363)
@@ -244,7 +244,7 @@
 unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
 
 /* draws and does a 4x4 sample */
-int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]);
+int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride);
 
 /* only draw so ED_view3d_autodist_simple can be called many times after */
 int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-03-17 19:55:10 UTC (rev 55362)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-03-17 20:24:47 UTC (rev 55363)
@@ -4118,7 +4118,7 @@
 
 		view3d_operator_needs_opengl(C);
 
-		if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor))
+		if (!ED_view3d_autodist(scene, ps->ar, v3d, mval_i, cursor, false))
 			return 0;
 
 		ED_region_tag_redraw(ps->ar);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-17 19:55:10 UTC (rev 55362)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-17 20:24:47 UTC (rev 55363)
@@ -2235,7 +2235,7 @@
 
 }
 
-void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *))
+void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride)
 {
 	RegionView3D *rv3d = ar->regiondata;
 	Base *base;
@@ -2247,7 +2247,7 @@
 	
 	/* Setting these temporarily is not nice */
 	v3d->flag &= ~V3D_SELECT_OUTLINE;
-	U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
+	U.glalphaclip = alphaoverride ? 0.5 : glalphaclip; /* not that nice but means we wont zoom into billboards */
 	U.obcenter_dia = 0;
 	
 	setwinmatrixview3d(ar, v3d, NULL);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2013-03-17 19:55:10 UTC (rev 55362)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2013-03-17 20:24:47 UTC (rev 55363)
@@ -457,7 +457,7 @@
 
 		view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
 
-		if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
+		if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true))) {
 			if (rv3d->is_persp) {
 				float my_origin[3]; /* original G.vd->ofs */
 				float my_pivot[3]; /* view */
@@ -2896,7 +2896,7 @@
 
 	/* Get Z Depths, needed for perspective, nice for ortho */
 	bgl_get_mats(&mats);
-	draw_depth(scene, ar, v3d, NULL);
+	draw_depth(scene, ar, v3d, NULL, true);
 	
 	{
 		/* avoid allocating the whole depth buffer */
@@ -3745,7 +3745,7 @@
 
 		if (U.uiflag & USER_ZBUF_CURSOR) {  /* maybe this should be accessed some other way */
 			view3d_operator_needs_opengl(C);
-			if (ED_view3d_autodist(scene, ar, v3d, mval, fp))
+			if (ED_view3d_autodist(scene, ar, v3d, mval, fp, true))
 				depth_used = TRUE;
 		}
 
@@ -3917,7 +3917,7 @@
 }
 
 /* XXX todo Zooms in on a border drawn by the user */
-int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3])
+int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], bool alphaoverride)
 {
 	bglMats mats; /* ZBuffer depth vars */
 	float depth_close = FLT_MAX;
@@ -3925,7 +3925,7 @@
 
 	/* Get Z Depths, needed for perspective, nice for ortho */
 	bgl_get_mats(&mats);
-	draw_depth(scene, ar, v3d, NULL);
+	draw_depth(scene, ar, v3d, NULL, alphaoverride);
 
 	depth_close = view_autodist_depth_margin(ar, mval, 4);
 
@@ -3952,7 +3952,7 @@
 	/* Get Z Depths, needed for perspective, nice for ortho */
 	switch (mode) {
 		case 0:
-			draw_depth(scene, ar, v3d, NULL);
+			draw_depth(scene, ar, v3d, NULL, true);
 			break;
 		case 1:
 			draw_depth_gpencil(scene, ar, v3d);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_intern.h	2013-03-17 19:55:10 UTC (rev 55362)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_intern.h	2013-03-17 20:24:47 UTC (rev 55363)
@@ -152,7 +152,7 @@
 
 /* view3d_draw.c */
 void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
-void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *));
+void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (*func)(void *), bool alphaoverride);
 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
 void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag);
 




More information about the Bf-blender-cvs mailing list