[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14414] trunk/blender/source/blender: UV Editing

Campbell Barton ideasman42 at gmail.com
Sun Apr 13 21:42:46 CEST 2008


Revision: 14414
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14414
Author:   campbellbarton
Date:     2008-04-13 21:42:39 +0200 (Sun, 13 Apr 2008)

Log Message:
-----------
UV Editing
* Changed default UV wire drawing do be a grey line with a black outline, highlighting aroudn selected points.
* Moved some draw options out of the View menu into the View panel.
* Changed header buttons to make Vert/Face modes less confusing.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/drawimage.c
    trunk/blender/source/blender/src/editsima.c
    trunk/blender/source/blender/src/header_image.c
    trunk/blender/source/blender/src/space.c

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2008-04-13 18:50:16 UTC (rev 14413)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2008-04-13 19:42:39 UTC (rev 14414)
@@ -483,10 +483,10 @@
 #define SI_SHOW			1
 
 /* SpaceImage->dt_uv */
-#define SI_UVDT_DASH	0
-#define SI_UVDT_BLACK	1
-#define SI_UVDT_WHITE	2
-#define SI_UVDT_OUTLINE	3
+#define SI_UVDT_OUTLINE	0
+#define SI_UVDT_DASH	1
+#define SI_UVDT_BLACK	2
+#define SI_UVDT_WHITE	3
 
 /* SpaceImage->dt_uvstretch */
 #define SI_UVDT_STRETCH_ANGLE	0

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2008-04-13 18:50:16 UTC (rev 14413)
+++ trunk/blender/source/blender/src/buttons_editing.c	2008-04-13 19:42:39 UTC (rev 14414)
@@ -5048,7 +5048,7 @@
 	
 	uiBlockBeginAlign(block);
 	uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D_IMAGE, "Draw Faces",		955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor");
-	uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 955, 66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
+	uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D_IMAGE, "Draw Edges", 955, 66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights in the 3d view and UV editor");
 	uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases", 955, 42,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
 	uiDefButBitI(block, TOG, G_DRAWBWEIGHTS, REDRAWVIEW3D, "Draw Bevel Weights", 955, 20,150,19, &G.f, 0, 0, 0, 0, "Displays weights created for the Bevel modifier");
 	uiDefButBitI(block, TOG, G_DRAWSEAMS, REDRAWVIEW3D, "Draw Seams", 955, -2,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2008-04-13 18:50:16 UTC (rev 14413)
+++ trunk/blender/source/blender/src/drawimage.c	2008-04-13 19:42:39 UTC (rev 14414)
@@ -409,12 +409,20 @@
 // checks if we are selecting only faces
 int draw_uvs_face_check(void)
 {
-	if (G.sima==NULL)
+	if (G.sima==NULL) {
 		return 0;
-	if (G.sima->flag & SI_SYNC_UVSEL && G.scene->selectmode == SCE_SELECT_FACE)
-		return 2;
-	if (G.sima->flag & SI_SELACTFACE)
-		return 1;
+	}
+	if (G.sima->flag & SI_SYNC_UVSEL) {
+		if (G.scene->selectmode == SCE_SELECT_FACE) {
+			return 2;
+		} else if (G.scene->selectmode & SCE_SELECT_FACE) {
+			return 1;
+		} 
+	} else {
+		if (G.sima->flag & SI_SELACTFACE) {
+			return 1;
+		}
+	}
 	return 0;
 }
 
@@ -464,6 +472,7 @@
 	char col1[4], col2[4];
 	float pointsize;
 	int drawface;
+	int lastsel, sel;
  	
 	if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE))
 		return;
@@ -887,22 +896,64 @@
 		}
 		
 		glLineWidth(1);
-		cpack(0xA8A8A8);
-		for (efa= em->faces.first; efa; efa= efa->next) {
-//			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-//			if (simaFaceDraw_Check(efa, tface)) {
+		col2[0] = col2[1] = col2[2] = 128; col2[3] = 255;
+		glColor4ubv(col2); 
+		
+		if (G.f & G_DRAWEDGES) {
+			glShadeModel(GL_SMOOTH);
+			BIF_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
+			lastsel = sel = 0;
+
+			for (efa= em->faces.first; efa; efa= efa->next) {
+	//			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	//			if (simaFaceDraw_Check(efa, tface)) {
+				
+				/*this is a shortcut to do the same as above but a faster for drawing */
+				if ((tface=(MTFace *)efa->tmp.p)) {
+					
+					glBegin(GL_LINE_LOOP);
+					sel = (simaUVSel_Check(efa, tface, 0) ? 1 : 0);
+					if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+					glVertex2fv(tface->uv[0]);
+					
+					sel = simaUVSel_Check(efa, tface, 1) ? 1 : 0;
+					if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+					glVertex2fv(tface->uv[1]);
+					
+					sel = simaUVSel_Check(efa, tface, 2) ? 1 : 0;
+					if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+					glVertex2fv(tface->uv[2]);
+					
+					if(efa->v4) {
+						sel = simaUVSel_Check(efa, tface, 3) ? 1 : 0;
+						if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
+						glVertex2fv(tface->uv[3]);
+					}
+					
+					glEnd();
+				}
+			}
+			glShadeModel(GL_FLAT);
+		} else { /* No nice edges */
 			
-			/*this is a shortcut to do the same as above but a faster for drawing */
-			if ((tface=(MTFace *)efa->tmp.p)) {
+			for (efa= em->faces.first; efa; efa= efa->next) {
+	//			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	//			if (simaFaceDraw_Check(efa, tface)) {
 				
-				glBegin(GL_LINE_LOOP);
+				/*this is a shortcut to do the same as above but a faster for drawing */
+				if ((tface=(MTFace *)efa->tmp.p)) {
+					
+					glBegin(GL_LINE_LOOP);
 					glVertex2fv(tface->uv[0]);
 					glVertex2fv(tface->uv[1]);
 					glVertex2fv(tface->uv[2]);
-					if(efa->v4) glVertex2fv(tface->uv[3]);
-				glEnd();
+					if(efa->v4)
+						glVertex2fv(tface->uv[3]);
+					glEnd();
+				}
 			}
 		}
+		
 		break;
 	}
 
@@ -1079,31 +1130,6 @@
 	}
 }
 
-static void draw_image_view_icon(void)
-{
-	float xPos = 5.0;
-
-	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA); 
-	
-	
-	if (G.sima->flag & SI_SYNC_UVSEL) {
-		/* take settings from the editmesh */
-		if (G.scene->selectmode == SCE_SELECT_FACE || G.sima->flag & SI_SELACTFACE) {
-			BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f);
-		}
-		
-	} else {
-		/* use the flags for UV mode - normal operation */
-		if(G.sima->flag & SI_SELACTFACE) {
-			BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f);
-		}
-	}
-	
-	glBlendFunc(GL_ONE,  GL_ZERO); 
-	glDisable(GL_BLEND);
-}
-
 static void draw_image_view_tool(void)
 {
 	ToolSettings *settings= G.scene->toolsettings;
@@ -1396,19 +1422,6 @@
 	}
 }
 
-//static void image_panel_transform_properties(short cntrl)	// IMAGE_HANDLER_TRANSFORM_PROPERTIES
-//{
-//	uiBlock *block;
-//
-//	block= uiNewBlock(&curarea->uiblocks, "image_transform_properties", UI_EMBOSS, UI_HELV, curarea->win);
-//	uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
-//	uiSetPanelHandler(IMAGE_HANDLER_TRANSFORM_PROPERTIES);  // for close and esc
-//	if(uiNewPanel(curarea, block, "Transform Properties", "Image", 10, 10, 318, 204)==0)
-//		return;
-//	
-//	image_editvertex_buts(block);
-//}
-
 static void image_panel_view_properties(short cntrl)	// IMAGE_HANDLER_VIEW_PROPERTIES
 {
 	uiBlock *block;
@@ -1434,22 +1447,30 @@
 	
 	
 	if (EM_texFaceCheck()) {
-		uiDefBut(block, LABEL, B_NOP, "Draw Type:",		10, 60,120,19, 0, 0, 0, 0, 0, "");
+		uiDefBut(block, LABEL, B_NOP, "Draw Type:",		10, 80,120,19, 0, 0, 0, 0, 0, "");
 		uiBlockBeginAlign(block);
-		uiDefButC(block,  ROW, B_REDR, "Dash",			10, 40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype");
-		uiDefButC(block,  ROW, B_REDR, "Black",			68, 40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "Black Wire UV drawtype");
-		uiDefButC(block,  ROW, B_REDR, "White",			126,40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "White Wire UV drawtype");
-		uiDefButC(block,  ROW, B_REDR, "Outline",		184,40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype");
+		uiDefButC(block,  ROW, B_REDR, "Outline",		10,60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype");
+		uiDefButC(block,  ROW, B_REDR, "Dash",			68, 60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype");
+		uiDefButC(block,  ROW, B_REDR, "Black",			126, 60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "Black Wire UV drawtype");
+		uiDefButC(block,  ROW, B_REDR, "White",			184,60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "White Wire UV drawtype");
+		
 		uiBlockEndAlign(block);
-		uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth",	250,40,60,19,  &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view");
+		uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth",	250,60,60,19,  &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view");
 		
+		
+		uiDefButBitI(block, TOG, G_DRAWFACES, B_REDR, "Faces",		10,30,60,19,  &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor");
+		uiDefButBitI(block, TOG, G_DRAWEDGES, B_REDR, "Edges", 70, 30,60,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights and UV editor");
+		
+		uiDefButBitI(block, TOG, SI_DRAWSHADOW, B_REDR, "Final Shadow", 130, 30,110,19, &G.sima->flag, 0, 0, 0, 0, "Draw the final result from the objects modifiers");
+		
 		uiDefButBitI(block, TOG, SI_DRAW_STRETCH, B_REDR, "UV Stretch",	10,0,100,19,  &G.sima->flag, 0, 0, 0, 0, "Difference between UV's and the 3D coords (blue for low distortion, red is high)");
+		if (G.sima->flag & SI_DRAW_STRETCH) {
+			uiBlockBeginAlign(block);
+			uiDefButC(block,  ROW, B_REDR, "Area",			120,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_AREA, 0, 0, "Area distortion between UV's and 3D coords");
+			uiDefButC(block,  ROW, B_REDR, "Angle",		180,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_ANGLE, 0, 0, "Angle distortion between UV's and 3D coords");
+			uiBlockEndAlign(block);
+		}
 		
-		uiBlockBeginAlign(block);
-		uiDefButC(block,  ROW, B_REDR, "Area",			120,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_AREA, 0, 0, "Area distortion between UV's and 3D coords");
-		uiDefButC(block,  ROW, B_REDR, "Angle",		180,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_ANGLE, 0, 0, "Angle distortion between UV's and 3D coords");
-		uiBlockEndAlign(block);
-		
 	}
 	image_editcursor_buts(block);
 }
@@ -1767,10 +1788,6 @@
 		case IMAGE_HANDLER_GAME_PROPERTIES:
 			image_panel_game_properties(sima->blockhandler[a+1]);
 			break;
-//		case IMAGE_HANDLER_TRANSFORM_PROPERTIES:
-//			if (EM_texFaceCheck())
-//				image_panel_transform_properties(sima->blockhandler[a+1]);
-//			break;
 		case IMAGE_HANDLER_VIEW_PROPERTIES:
 			image_panel_view_properties(sima->blockhandler[a+1]);
 			break;
@@ -2321,7 +2338,6 @@
 
 	if(G.rendering==0) {
 		draw_image_view_tool();
-		draw_image_view_icon();
 	}
 	draw_area_emboss(sa);
 


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list