function for flushing polygon -> vert,edge selection (in object mode), currently unused.

This commit is contained in:
Campbell Barton
2012-12-22 08:13:44 +00:00
parent 84966c3d0a
commit 2abb727ced
2 changed files with 44 additions and 0 deletions

View File

@@ -123,6 +123,11 @@ void BKE_mesh_flush_hidden_from_verts(const struct MVert *mvert,
struct MEdge *medge, int totedge,
struct MPoly *mpoly, int totpoly);
void BKE_mesh_flush_select_from_polys(struct MVert *mvert, const int totvert,
struct MLoop *mloop,
struct MEdge *medge, const int totedge,
const struct MPoly *mpoly, const int totpoly);
void BKE_mesh_unlink(struct Mesh *me);
void BKE_mesh_free(struct Mesh *me, int unlink);
struct Mesh *BKE_mesh_add(const char *name);

View File

@@ -3107,6 +3107,45 @@ void BKE_mesh_flush_hidden_from_verts(const MVert *mvert,
}
}
/**
* simple poly -> vert/edge selection.
*/
void BKE_mesh_flush_select_from_polys(MVert *mvert, const int totvert,
MLoop *mloop,
MEdge *medge, const int totedge,
const MPoly *mpoly, const int totpoly)
{
MVert *mv;
MEdge *med;
const MPoly *mp;
int i;
i = totvert;
for (mv = mvert; i--; mv++) {
mv->flag &= ~SELECT;
}
i = totedge;
for (med = medge; i--; med++) {
med->flag &= ~SELECT;
}
i = totpoly;
for (mp = mpoly; i--; mp++) {
/* assume if its selected its not hidden and none of its verts/edges are hidden
* (a common assumption)*/
if (mp->flag & ME_FACE_SEL) {
MLoop *ml;
int j;
j = mp->totloop;
for (ml = &mloop[mp->loopstart]; j--; ml++) {
mvert[ml->v].flag |= SELECT;
medge[ml->e].flag |= SELECT;
}
}
}
}
/* basic vertex data functions */
int BKE_mesh_minmax(Mesh *me, float r_min[3], float r_max[3])
{