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.
This commit is contained in:
2008-03-26 11:56:41 +00:00
parent 2a47d02975
commit 6184c07474
5 changed files with 31 additions and 15 deletions

View File

@@ -243,11 +243,10 @@ void calc_image_view(SpaceImage *sima, char mode)
/* check for facelesect, and set active image */ /* check for facelesect, and set active image */
void what_image(SpaceImage *sima) void what_image(SpaceImage *sima)
{ {
MTFace *activetf;
if( (sima->mode!=SI_TEXTURE) || if( (sima->mode!=SI_TEXTURE) ||
(sima->image && sima->image->source==IMA_SRC_VIEWER) || (sima->image && sima->image->source==IMA_SRC_VIEWER) ||
(G.obedit != OBACT) || (G.obedit != OBACT) ||
(G.editMesh==NULL) ||
(sima->pin) (sima->pin)
) { ) {
return; return;
@@ -255,13 +254,16 @@ void what_image(SpaceImage *sima)
/* viewer overrides uv editmode */ /* viewer overrides uv editmode */
if (EM_texFaceCheck()) { if (EM_texFaceCheck()) {
MTFace *activetf;
sima->image= NULL; sima->image= NULL;
activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */ activetf = get_active_mtface(NULL, NULL, 1); /* partially selected face is ok */
if(activetf && activetf->mode & TF_TEX) { if(activetf && activetf->mode & TF_TEX) {
if (!sima->pin) /* done need to check for pin here, see above */
sima->image= activetf->tpage; /*if (!sima->pin)*/
sima->image= activetf->tpage;
if(sima->flag & SI_EDITTILE); if(sima->flag & SI_EDITTILE);
else sima->curtile= activetf->tile; else sima->curtile= activetf->tile;
@@ -2141,6 +2143,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
if(sima->image->type==IMA_TYPE_R_RESULT) if(sima->image->type==IMA_TYPE_R_RESULT)
show_render= 1; show_render= 1;
} }
what_image(sima); what_image(sima);
aspect_sima(sima, &xuser_asp, &yuser_asp); aspect_sima(sima, &xuser_asp, &yuser_asp);

View File

@@ -363,6 +363,9 @@ void calculate_uv_map(unsigned short mapmode)
if (em && em->faces.first) if (em && em->faces.first)
EM_add_data_layer(&em->fdata, CD_MTFACE); 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()) if (!EM_texFaceCheck())
return; return;
@@ -571,10 +574,11 @@ MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol, short sloppy)
if(!EM_texFaceCheck()) if(!EM_texFaceCheck())
return NULL; return NULL;
if (sloppy)
efa = EM_get_actFace();
/* first check the active face */ /* first check the active face */
if (sloppy && em->act_face) { if ((sloppy && efa)==0) {
efa = em->act_face;
} else {
ese = em->selected.last; ese = em->selected.last;
for (; ese; ese=ese->prev){ for (; ese; ese=ese->prev){
if(ese->type == EDITFACE) { if(ese->type == EDITFACE) {

View File

@@ -957,16 +957,22 @@ void make_editMesh()
efa->flag= mface->flag & ~ME_HIDE; efa->flag= mface->flag & ~ME_HIDE;
/* select and hide face flag */ /* 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; 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;
} }
} }
} }

View File

@@ -80,7 +80,7 @@ void EM_set_actFace(EditFace *efa)
EditFace * EM_get_actFace(void) 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 ************ */ /* ********* Selection History ************ */

View File

@@ -298,6 +298,9 @@ void unwrap_lscm(short seamcut)
if (!EM_texFaceCheck()) if (!EM_texFaceCheck())
return; 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 */ /* select new UV's */
if ((G.sima==0 || G.sima->flag & SI_SYNC_UVSEL)==0) { if ((G.sima==0 || G.sima->flag & SI_SYNC_UVSEL)==0) {
EditFace *efa; EditFace *efa;