[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14242] trunk/blender/source/blender/src: fix for [#8732] Unwrap Project from View not matching View

Campbell Barton ideasman42 at gmail.com
Wed Mar 26 12:56:43 CET 2008


Revision: 14242
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14242
Author:   campbellbarton
Date:     2008-03-26 12:56:41 +0100 (Wed, 26 Mar 2008)

Log Message:
-----------
fix for [#8732] Unwrap Project from View not matching View
the active face could be unselected. now unwrapping with no UV layer will assign the current image to the selected faces.

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawimage.c
    trunk/blender/source/blender/src/editface.c
    trunk/blender/source/blender/src/editmesh.c
    trunk/blender/source/blender/src/editmesh_lib.c
    trunk/blender/source/blender/src/unwrapper.c

Modified: trunk/blender/source/blender/src/drawimage.c
===================================================================
--- trunk/blender/source/blender/src/drawimage.c	2008-03-26 11:27:52 UTC (rev 14241)
+++ trunk/blender/source/blender/src/drawimage.c	2008-03-26 11:56:41 UTC (rev 14242)
@@ -243,11 +243,10 @@
 /* check for facelesect, and set active image */
 void what_image(SpaceImage *sima)
 {
-	MTFace *activetf;
-	
 	if(		(sima->mode!=SI_TEXTURE) ||
 			(sima->image && sima->image->source==IMA_SRC_VIEWER) ||
 			(G.obedit != OBACT) ||
+			(G.editMesh==NULL) ||
 			(sima->pin)
 	) {
 		return;
@@ -255,13 +254,16 @@
 	
 	/* viewer overrides uv editmode */
 	if (EM_texFaceCheck()) {
+		MTFace *activetf;
+		
 		sima->image= NULL;
 		
 		activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
 		
 		if(activetf && activetf->mode & TF_TEX) {
-			if (!sima->pin)
-				sima->image= activetf->tpage;
+			/* done need to check for pin here, see above */
+			/*if (!sima->pin)*/
+			sima->image= activetf->tpage;
 			
 			if(sima->flag & SI_EDITTILE);
 			else sima->curtile= activetf->tile;
@@ -2141,6 +2143,7 @@
 		if(sima->image->type==IMA_TYPE_R_RESULT)
 			show_render= 1;
 	}
+	
 	what_image(sima);
 	
 	aspect_sima(sima, &xuser_asp, &yuser_asp);

Modified: trunk/blender/source/blender/src/editface.c
===================================================================
--- trunk/blender/source/blender/src/editface.c	2008-03-26 11:27:52 UTC (rev 14241)
+++ trunk/blender/source/blender/src/editface.c	2008-03-26 11:56:41 UTC (rev 14242)
@@ -363,6 +363,9 @@
 		if (em && em->faces.first)
 			EM_add_data_layer(&em->fdata, CD_MTFACE);
 		
+		if (G.sima && G.sima->image) /* this is a bit of a kludge, but assume they want the image on their mesh when UVs are added */
+			image_changed(G.sima, G.sima->image);
+		
 		if (!EM_texFaceCheck())
 			return;
 		
@@ -571,10 +574,11 @@
 	if(!EM_texFaceCheck())
 		return NULL;
 	
+	if (sloppy)
+		efa = EM_get_actFace();
+	
 	/* first check the active face */
-	if (sloppy && em->act_face) {
-		efa = em->act_face;
-	} else {
+	if ((sloppy && efa)==0) {
 		ese = em->selected.last;
 		for (; ese; ese=ese->prev){
 			if(ese->type == EDITFACE) {

Modified: trunk/blender/source/blender/src/editmesh.c
===================================================================
--- trunk/blender/source/blender/src/editmesh.c	2008-03-26 11:27:52 UTC (rev 14241)
+++ trunk/blender/source/blender/src/editmesh.c	2008-03-26 11:56:41 UTC (rev 14242)
@@ -957,16 +957,22 @@
 				efa->flag= mface->flag & ~ME_HIDE;
 				
 				/* select and hide face flag */
-				if(mface->flag & ME_FACE_SEL) {
+				if(mface->flag & ME_HIDE) {
+					efa->h= 1;
+				/* dont allow hidden and selected */
+				} else if(mface->flag & ME_FACE_SEL) {
 					efa->f |= SELECT;
+					
+					/* only allow selected face to be active */
+					if (a==me->act_face) {
+						EM_set_actFace(efa);
+					}
+					
+					if(FACESEL_PAINT_TEST) {
+						EM_select_face(efa, 1); /* flush down */
+					}
 				}
-				if(mface->flag & ME_HIDE) efa->h= 1;
-
-				if((FACESEL_PAINT_TEST) && (efa->f & SELECT))
-					EM_select_face(efa, 1); /* flush down */
 				
-				if (a==me->act_face)
-					em->act_face = efa;
 			}
 		}
 	}

Modified: trunk/blender/source/blender/src/editmesh_lib.c
===================================================================
--- trunk/blender/source/blender/src/editmesh_lib.c	2008-03-26 11:27:52 UTC (rev 14241)
+++ trunk/blender/source/blender/src/editmesh_lib.c	2008-03-26 11:56:41 UTC (rev 14242)
@@ -80,7 +80,7 @@
 
 EditFace * EM_get_actFace(void)
 {
-	return G.editMesh->act_face;
+	return (G.editMesh->act_face && G.editMesh->act_face->f & SELECT) ? G.editMesh->act_face : NULL ;
 }
 
 /* ********* Selection History ************ */

Modified: trunk/blender/source/blender/src/unwrapper.c
===================================================================
--- trunk/blender/source/blender/src/unwrapper.c	2008-03-26 11:27:52 UTC (rev 14241)
+++ trunk/blender/source/blender/src/unwrapper.c	2008-03-26 11:56:41 UTC (rev 14242)
@@ -298,6 +298,9 @@
 		if (!EM_texFaceCheck())
 			return;
 		
+		if (G.sima && G.sima->image) /* this is a bit of a kludge, but assume they want the image on their mesh when UVs are added */
+			image_changed(G.sima, G.sima->image);
+		
 		/* select new UV's */
 		if ((G.sima==0 || G.sima->flag & SI_SYNC_UVSEL)==0) {
 			EditFace *efa;





More information about the Bf-blender-cvs mailing list