[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12035] trunk/blender/source/blender/src: changed how shading works in editmode

Campbell Barton cbarton at metavr.com
Fri Sep 14 13:39:53 CEST 2007


Revision: 12035
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12035
Author:   campbellbarton
Date:     2007-09-14 13:39:53 +0200 (Fri, 14 Sep 2007)

Log Message:
-----------
changed how shading works in editmode

Texture Draw; no shading only textures (better for mapping work)
Shaded Draw; textured with shading (in editmode it used to be like solid draw mode)
ZClip Option; dont draw face center dots.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/drawimage.c
    trunk/blender/source/blender/src/drawmesh.c
    trunk/blender/source/blender/src/drawobject.c
    trunk/blender/source/blender/src/editmesh_mods.c

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2007-09-14 06:46:57 UTC (rev 12034)
+++ trunk/blender/source/blender/src/buttons_editing.c	2007-09-14 11:39:53 UTC (rev 12035)
@@ -5286,8 +5286,9 @@
 	MTFace *tf;
 
 	block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_texface", UI_EMBOSS, UI_HELV, curarea->win);
-	if(uiNewPanel(curarea, block, "Texture face", "Editing", 960, 0, 318, 204)==0) return;
-
+	uiNewPanelTabbed("Multires", "Editing");
+	if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
+	
 	tf = get_active_mtface(NULL, NULL);
 	if(tf) {
 		uiBlockBeginAlign(block);
@@ -5314,17 +5315,6 @@
 		uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque",	600,80,60,19, &tf->transp, 2.0, 0.0, 0, 0, "Render color of textured face as color");
 		uiDefButC(block, ROW, REDRAWVIEW3D, "Add",		660,80,60,19, &tf->transp, 2.0, 1.0, 0, 0, "Render face transparent and add color of face");
 		uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",	720,80,60,19, &tf->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
-
-		uiBlockSetCol(block, TH_AUTO);
-
-		uiBlockBeginAlign(block);
-		uiDefButF(block, COL, B_VPCOLSLI, "",			769,40,40,28, &(Gvp.r), 0, 0, 0, 0, "");
-		uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol",	809,40,103,28, 0, 0, 0, 0, 0, "Set Vertex color of selection to current (Shift+K)");
-
-		uiBlockBeginAlign(block);
-		uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode from active face to selected faces");
-		uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex",	  721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures from active face to selected faces");
-		uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol",	  809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colors from active face to selected faces");
 	}
 }
 
@@ -5345,7 +5335,7 @@
 
 	block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_uvautocalculation", UI_EMBOSS, UI_HELV, curarea->win);
 	/* make this a tab of "Texture face" to save screen space*/
-	uiNewPanelTabbed("Modifiers", "Editing");
+	uiNewPanelTabbed("Multires", "Editing");
 	if(uiNewPanel(curarea, block, "UV Calculation", "Editing", 960, 0, 318, 204)==0)
 		return;
 	row-= 4*butHB+butS;
@@ -5475,6 +5465,8 @@
 			editing_panel_mesh_tools(ob, ob->data);
 			editing_panel_mesh_tools1(ob, ob->data);
 			editing_panel_mesh_uvautocalculation();
+			if (EM_texFaceCheck())
+				editing_panel_mesh_texface();
 		}
 		else if(G.f & G_SCULPTMODE) {
 			uiNewPanelTabbed("Multires", "Editing");
@@ -5482,9 +5474,6 @@
 			uiNewPanelTabbed("Multires", "Editing");
 			editing_panel_sculpting_textures();
 		} else {
-			if(FACESEL_PAINT_TEST) {
-				editing_panel_mesh_texface();
-			}
 			if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT) ) {
 				editing_panel_mesh_paint();
 			}

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2007-09-14 06:46:57 UTC (rev 12034)
+++ trunk/blender/source/blender/src/drawimage.c	2007-09-14 11:39:53 UTC (rev 12035)
@@ -293,50 +293,44 @@
 	if(sima->image==NULL)
 		sima->flag &= ~SI_DRAWTOOL;
 	
-	if(sima->mode==SI_TEXTURE) {
+	if(sima->mode!=SI_TEXTURE || !EM_texFaceCheck())
+		return;
 		
-		if(EM_texFaceCheck()) {
-			/* skip assigning these procedural images... */
-			if(sima->image) {
-				if(sima->image->type==IMA_TYPE_R_RESULT)
-					return;
-				if(sima->image->type==IMA_TYPE_COMPOSITE)
-					return;
-			}
-			/*
-			tface= me->mtface;
-			mface = me->mface;
-			a= me->totface;
-			while(a--) {
-				if(mface->flag & ME_FACE_SEL) {
-			*/
-			for (efa= em->faces.first; efa; efa= efa->next) {
-				if (efa->f & SELECT) {
-					tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				
-					if(dotile==2) {
-						tface->mode &= ~TF_TILES;
-					}
-					else {
-						tface->tpage= sima->image;
-						tface->mode |= TF_TEX;
+	/* skip assigning these procedural images... */
+	if(sima->image) {
+		if(sima->image->type==IMA_TYPE_R_RESULT)
+			return;
+		if(sima->image->type==IMA_TYPE_COMPOSITE)
+			return;
+	}
+
+	for (efa= em->faces.first; efa; efa= efa->next) {
+		if (efa->f & SELECT) {
+			tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		
+			if(dotile==2) {
+				tface->mode &= ~TF_TILES;
+			} else {
+				if (sima->image) {
+					tface->tpage= sima->image;
+					tface->mode |= TF_TEX;
 					
-						if(dotile) tface->tile= sima->curtile;
-					}
+					if(sima->image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
+					else tface->mode &= ~TF_TILES;
 					
-					if(sima->image) {
-						if(sima->image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
-						else tface->mode &= ~TF_TILES;
-					
-						if(sima->image->id.us==0) id_us_plus(&sima->image->id);
-						else id_lib_extern(&sima->image->id);
-					}
+					if(sima->image->id.us==0) id_us_plus(&sima->image->id);
+					else id_lib_extern(&sima->image->id);
+				} else {
+					tface->tpage= NULL;
+					tface->mode &= ~TF_TEX;
 				}
+			
+				if(dotile) tface->tile= sima->curtile;
 			}
-			object_uvs_changed(OBACT);
-			allqueue(REDRAWBUTSEDIT, 0);
 		}
 	}
+	object_uvs_changed(OBACT);
+	allqueue(REDRAWBUTSEDIT, 0);
 }
 
 
@@ -896,7 +890,7 @@
 		uiBlockEndAlign(block);
 
 		uiBlockBeginAlign(block);
-		uiDefButBitS(block, TOG, IMA_TILES, B_SIMAGEDRAW1, "Tiles",	160,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of tilemode for faces");
+		uiDefButBitS(block, TOG, IMA_TILES, B_SIMAGEDRAW1, "Tiles",	160,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of tilemode for faces (Shift LMB to pick the tile for selected faces)");
 		uiDefButS(block, NUM, B_SIMAGEDRAW, "X:",		160,130,70,19, &G.sima->image->xrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the X direction");
 		uiDefButS(block, NUM, B_SIMAGEDRAW, "Y:",		230,130,70,19, &G.sima->image->yrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the Y direction");
 		uiBlockBeginAlign(block);

Modified: trunk/blender/source/blender/src/drawmesh.c
===================================================================
--- trunk/blender/source/blender/src/drawmesh.c	2007-09-14 06:46:57 UTC (rev 12034)
+++ trunk/blender/source/blender/src/drawmesh.c	2007-09-14 11:39:53 UTC (rev 12035)
@@ -953,7 +953,7 @@
 	unsigned char obcol[4];
 	int istex, solidtex= 0;
 
-	if(G.vd->drawtype==OB_SOLID || ob==G.obedit) {
+	if(G.vd->drawtype==OB_SOLID || (ob==G.obedit && G.vd->drawtype!=OB_TEXTURE)) {
 		/* draw with default lights in solid draw mode and edit mode */
 		solidtex= 1;
 		Gtexdraw.islit= -1;
@@ -1186,9 +1186,9 @@
 	}
 	else {
 #endif
-		if(ob==G.obedit)
+		if(ob==G.obedit) {
 			dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, G.editMesh);
-		else if(faceselect) {
+		} else if(faceselect) {
 			if(G.f & G_WEIGHTPAINT)
 				dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1);
 			else
@@ -1220,6 +1220,9 @@
 
 	/* reset from negative scale correction */
 	glFrontFace(GL_CCW);
+	
+	/* in editmode, the blend mode needs to be set incase it was ADD */
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
 	dm->release(dm);
 }

Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c	2007-09-14 06:46:57 UTC (rev 12034)
+++ trunk/blender/source/blender/src/drawobject.c	2007-09-14 11:39:53 UTC (rev 12035)
@@ -1632,7 +1632,10 @@
 				draw_dm_verts(cageDM, sel);
 			}
 			
-			if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) {
+			if(	(G.scene->selectmode & SCE_SELECT_FACE) &&
+				(G.vd->drawtype<=OB_SOLID) &&
+				( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) )
+			) {
 				glPointSize(fsize);
 				glColor4ubv((GLubyte *)fcol);
 				draw_dm_face_centers(cageDM, sel);
@@ -1947,8 +1950,9 @@
 	if(dt>OB_WIRE) {
 		if(G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) {
 			draw_mesh_textured(ob, finalDM, 0);
-		}
-		else {
+		} else if(G.vd->drawtype==OB_SHADED && dt>OB_SOLID) {
+			draw_mesh_textured(ob, finalDM, 0);
+		} else {
 			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
 
 			glEnable(GL_LIGHTING);
@@ -4448,7 +4452,10 @@
 	if (facecol) {
 		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0);
 
-		if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) {
+		if(	(G.scene->selectmode & SCE_SELECT_FACE) &&
+			(G.vd->drawtype<=OB_SOLID) &&
+			( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) )
+		) {
 			glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
 		
 			bglBegin(GL_POINTS);

Modified: trunk/blender/source/blender/src/editmesh_mods.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_mods.c	2007-09-14 06:46:57 UTC (rev 12034)
+++ trunk/blender/source/blender/src/editmesh_mods.c	2007-09-14 11:39:53 UTC (rev 12035)
@@ -2078,8 +2078,10 @@
 		countall();
 		  
 		allqueue(REDRAWVIEW3D, 0);
-		if (EM_texFaceCheck())
+		if (EM_texFaceCheck()) {
 			allqueue(REDRAWIMAGE, 0);
+			allqueue(REDRAWBUTSEDIT, 0); /* for the texture face panel */
+		}
 	}
 
 	rightmouse_transform();





More information about the Bf-blender-cvs mailing list