[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12826] trunk/blender/source/blender/src/ drawview.c: Fixed bug #6870, Sculpt mode + wireframe = nothing

Nicholas Bishop nicholasbishop at gmail.com
Sat Dec 8 22:53:18 CET 2007


Revision: 12826
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12826
Author:   nicholasbishop
Date:     2007-12-08 22:53:17 +0100 (Sat, 08 Dec 2007)

Log Message:
-----------
Fixed bug #6870, Sculpt mode + wireframe = nothing

When sculpt object is in wireframe mode (including if the current view is in wireframe mode) a second copy is drawn only to the depth buffer so that sculpting can take place as normal.

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawview.c

Modified: trunk/blender/source/blender/src/drawview.c
===================================================================
--- trunk/blender/source/blender/src/drawview.c	2007-12-08 18:46:44 UTC (rev 12825)
+++ trunk/blender/source/blender/src/drawview.c	2007-12-08 21:53:17 UTC (rev 12826)
@@ -2774,6 +2774,37 @@
 	}
 }
 
+/* Enable sculpting in wireframe mode by drawing sculpt object only to the depth buffer */
+static void draw_sculpt_depths(View3D *v3d)
+{
+	Object *ob = OBACT;
+
+	int dt= MIN2(v3d->drawtype, ob->dt);
+	if(v3d->zbuf==0 && dt>OB_WIRE)
+		dt= OB_WIRE;
+	if(dt == OB_WIRE) {
+		GLboolean depth_on;
+		int orig_vdt = v3d->drawtype;
+		int orig_zbuf = v3d->zbuf;
+		int orig_odt = ob->dt;
+
+		glGetBooleanv(GL_DEPTH_TEST, &depth_on);
+		v3d->drawtype = ob->dt = OB_SOLID;
+		v3d->zbuf = 1;
+
+		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+		glEnable(GL_DEPTH_TEST);
+		draw_object(BASACT, 0);
+		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+		if(!depth_on)
+			glDisable(GL_DEPTH_TEST);
+
+		v3d->drawtype = orig_vdt;
+		v3d->zbuf = orig_zbuf;
+		ob->dt = orig_odt;
+	}
+}
+
 void drawview3dspace(ScrArea *sa, void *spacedata)
 {
 	View3D *v3d= spacedata;
@@ -2921,8 +2952,10 @@
 		}
 	}
 
-	if(!retopo && sculpt && !(obact && (obact->dtx & OB_DRAWXRAY)))
+	if(!retopo && sculpt && !(obact && (obact->dtx & OB_DRAWXRAY))) {
+		draw_sculpt_depths(v3d);
 		view3d_update_depths(v3d);
+	}
 
 	if(G.moving) {
 		BIF_drawConstraint();
@@ -2936,9 +2969,11 @@
 	/* Transp and X-ray afterdraw stuff */
 	view3d_draw_xray(v3d, 0);	// clears zbuffer if it is used!
 	view3d_draw_transp(v3d, 0);
-	
-	if(!retopo && sculpt && (obact && (OBACT->dtx & OB_DRAWXRAY)))
+
+	if(!retopo && sculpt && (obact && (OBACT->dtx & OB_DRAWXRAY))) {
+		draw_sculpt_depths(v3d);
 		view3d_update_depths(v3d);
+	}
 	
 	if(v3d->flag & V3D_CLIPPING)
 		view3d_clr_clipping();





More information about the Bf-blender-cvs mailing list