Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/drawimage.c1
-rw-r--r--source/blender/src/drawmesh.c6
-rw-r--r--source/blender/src/editface.c43
-rw-r--r--source/blender/src/editmesh.c13
-rw-r--r--source/blender/src/editmesh_lib.c11
-rw-r--r--source/blender/src/editmesh_mods.c2
-rw-r--r--source/blender/src/editsima.c15
7 files changed, 53 insertions, 38 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index d69ec6d1b05..7fb6604b2fc 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -490,6 +490,7 @@ void draw_uvs_sima(void)
cageDM = editmesh_get_derived_cage_and_final(&finalDM, CD_MASK_BAREMESH | CD_MASK_MTFACE);
if (finalDM->drawUVEdges &&
+ DM_get_face_data_layer(finalDM, CD_MTFACE) &&
/* When sync selection is enabled, all faces are drawn (except for hidden)
* so if cage is the same as the final, theres no point in drawing the shadowmesh. */
!((G.sima->flag & SI_SYNC_UVSEL && cageDM==finalDM))
diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c
index f974e85293a..0c8132b3469 100644
--- a/source/blender/src/drawmesh.c
+++ b/source/blender/src/drawmesh.c
@@ -634,7 +634,7 @@ EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
if (!(mf->flag&ME_HIDE)) {
unsigned int flags = eEdge_Visible;
if (mf->flag&ME_FACE_SEL) flags |= eEdge_Select;
- if (tf && tf->flag&TF_ACTIVE) {
+ if (i==me->act_face) {
flags |= eEdge_Active;
if (mf->flag&ME_FACE_SEL) flags |= eEdge_SelectAndActive;
}
@@ -647,8 +647,8 @@ EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
} else {
get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags);
}
-
- if (tf && tf->flag&TF_ACTIVE) {
+
+ if (i==me->act_face) {
get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, eEdge_ActiveFirst);
get_marked_edge_info__orFlags(eh, mf->v1, mf->v4?mf->v4:mf->v3, eEdge_ActiveLast);
}
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index 65e335ea6ab..516928af14e 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -569,13 +569,18 @@ MTFace *get_active_mtface(EditFace **act_efa, MCol **mcol, short partsel)
if(!EM_texFaceCheck())
return NULL;
-
- for (ese = em->selected.last; ese; ese=ese->prev){
- if(ese->type == EDITFACE) {
- efa = (EditFace *)ese->data;
-
- if (efa->h) efa= NULL;
- else break;
+
+ /* first check the active face */
+ if (em->act_face) {
+ efa = em->act_face;
+ } else {
+ for (ese = em->selected.last; ese; ese=ese->prev){
+ if(ese->type == EDITFACE) {
+ efa = (EditFace *)ese->data;
+
+ if (efa->h) efa= NULL;
+ else break;
+ }
}
}
@@ -1107,7 +1112,6 @@ void face_select()
{
Object *ob;
Mesh *me;
- MTFace *tface, *tsel;
MFace *mface, *msel;
short mval[2];
unsigned int a, index;
@@ -1127,33 +1131,20 @@ void face_select()
if (!facesel_face_pick(me, mval, &index, 1)) return;
- tsel= (((MTFace*)me->mtface)+index); /* check me->mtface before using */
msel= (((MFace*)me->mface)+index);
-
if (msel->flag & ME_HIDE) return;
/* clear flags */
- tface = me->mtface;
mface = me->mface;
a = me->totface;
- while (a--) {
- if (G.qual & LR_SHIFTKEY) {
- if (me->mtface) {
- tface->flag &= ~TF_ACTIVE;
- }
- } else {
- if (me->mtface) {
- tface->flag &= ~TF_ACTIVE;
- }
+ if ((G.qual & LR_SHIFTKEY)==0) {
+ while (a--) {
mface->flag &= ~ME_FACE_SEL;
+ mface++;
}
- if (me->mtface) {
- tface++;
- }
- mface++;
}
- if (me->mtface)
- tsel->flag |= TF_ACTIVE;
+
+ me->act_face = (int)index;
if (G.qual & LR_SHIFTKEY) {
if (msel->flag & ME_FACE_SEL)
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index fcfb1a5c40f..678178e6e5b 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -333,6 +333,10 @@ void free_editface(EditFace *efa)
}
#endif
EM_remove_selection(efa, EDITFACE);
+
+ if (G.editMesh->act_face==efa)
+ EM_set_actFace(NULL);
+
CustomData_em_free_block(&G.editMesh->fdata, &efa->data);
if(efa->fast==0)
free(efa);
@@ -809,10 +813,11 @@ void make_editMesh()
/* because of reload */
free_editMesh(em);
+ em->act_face = NULL;
G.totvert= tot= me->totvert;
G.totedge= me->totedge;
G.totface= me->totface;
-
+
if(tot==0) {
countall();
return;
@@ -906,6 +911,9 @@ void make_editMesh()
if((FACESEL_PAINT_TEST) && (efa->f & SELECT))
EM_select_face(efa, 1); /* flush down */
+
+ if (a==me->act_face)
+ em->act_face = efa;
}
}
}
@@ -1140,6 +1148,9 @@ void load_editMesh(void)
/* no index '0' at location 3 or 4 */
test_index_face(mface, &me->fdata, i, efa->v4?4:3);
+
+ if (a==me->act_face)
+ EM_set_actFace(efa);
#ifdef WITH_VERSE
if(efa->vface) {
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c
index d6781c8e430..c85efa609b1 100644
--- a/source/blender/src/editmesh_lib.c
+++ b/source/blender/src/editmesh_lib.c
@@ -72,6 +72,17 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "editmesh.h"
+/* this replaces the active flag used in uv/face mode */
+void EM_set_actFace(EditFace *efa)
+{
+ G.editMesh->act_face = efa;
+}
+
+EditFace * EM_get_actFace(void)
+{
+ return G.editMesh->act_face;
+}
+
/* ********* Selection History ************ */
static int EM_check_selection(void *data)
{
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
index 2af77f6e2dc..2a86c674f66 100644
--- a/source/blender/src/editmesh_mods.c
+++ b/source/blender/src/editmesh_mods.c
@@ -2067,6 +2067,8 @@ void mouse_mesh(void)
if((G.qual & LR_SHIFTKEY)==0) EM_clear_flag_all(SELECT);
if(efa) {
+ /* set the last selected face */
+ EM_set_actFace(efa);
if( (efa->f & SELECT)==0 ) {
EM_store_selection(efa, EDITFACE);
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index f809409b9f0..0daf468c253 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -575,8 +575,8 @@ void mouse_select_sima(void) /* TODO - SYNCSEL */
find_nearest_tface(&nearesttf, &nearestefa);
if(nearesttf==NULL)
return;
-
- nearesttf->flag |= TF_ACTIVE;
+
+ EM_set_actFace(nearestefa);
for (i=0; i<4; i++)
hituv[i]= nearesttf->uv[i];
@@ -660,10 +660,7 @@ void mouse_select_sima(void) /* TODO - SYNCSEL */
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (SIMA_FACEDRAW_CHECK(efa, tf)) {
- if(nearesttf && tf!=nearesttf)
- tf->flag &=~ TF_ACTIVE;
if (!sticky) continue;
-
if(msel_hit(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
SIMA_UVSEL_SET(efa, tf, 0);
if(msel_hit(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
@@ -675,6 +672,7 @@ void mouse_select_sima(void) /* TODO - SYNCSEL */
SIMA_UVSEL_SET(efa, tf, 3);
}
}
+ EM_set_actFace(nearestefa);
flush = 1;
}
}
@@ -685,11 +683,12 @@ void mouse_select_sima(void) /* TODO - SYNCSEL */
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
SIMA_FACESEL_UNSET(efa, tf);
- //if(nearesttf && tf!=nearesttf) /* TODO - deal with editmesh active face */
- // tf->flag &= ~TF_ACTIVE;
}
- if(nearesttf)
+ if(nearesttf) {
SIMA_FACESEL_SET(nearestefa, nearesttf);
+ EM_set_actFace(nearestefa);
+ }
+
}
/* deselect uvs, and select sticky uvs */