further fixes for modifiers, and edge loop select works now.
This commit is contained in:
@@ -40,24 +40,25 @@ for (; f; f=BMW_Step(&walker)) {
|
||||
BMW_End(&walker);
|
||||
*/
|
||||
|
||||
/*walk over connected geometry. can restrict to a search flag,
|
||||
or not, it's optional.*/
|
||||
#define BMW_SHELL 0
|
||||
|
||||
/*walk over an edge loop. search flag doesn't do anything.*/
|
||||
#define BMW_LOOP 1
|
||||
/*#define BMW_RING 2
|
||||
#define BMW_UVISLANDS 3*/
|
||||
/*walk over an island of flagged faces. note, that this doesn't work on
|
||||
non-manifold geometry. it might be better to rewrite this to extract
|
||||
boundary info from the island walker, rather then directly walking
|
||||
over the boundary. raises an error if it encouters nonmanifold
|
||||
geometry.*/
|
||||
#define BMW_ISLANDBOUND 2
|
||||
|
||||
/*walk over all faces in an island of tool flagged faces.*/
|
||||
#define BMW_ISLAND 3
|
||||
|
||||
#define BMW_MAXWALKERS 4
|
||||
enum {
|
||||
/*walk over connected geometry. can restrict to a search flag,
|
||||
or not, it's optional.*/
|
||||
BMW_SHELL,
|
||||
/*walk over an edge loop. search flag doesn't do anything.*/
|
||||
BMW_LOOP,
|
||||
BMW_FACELOOP,
|
||||
BMW_EDGERING,
|
||||
/*#define BMW_RING 2
|
||||
#define BMW_UVISLANDS 3*/
|
||||
/*walk over an island of flagged faces. note, that this doesn't work on
|
||||
non-manifold geometry. it might be better to rewrite this to extract
|
||||
boundary info from the island walker, rather then directly walking
|
||||
over the boundary. raises an error if it encouters nonmanifold
|
||||
geometry.*/
|
||||
BMW_ISLANDBOUND,
|
||||
/*walk over all faces in an island of tool flagged faces.*/
|
||||
BMW_ISLAND,
|
||||
BMW_MAXWALKERS,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -48,12 +48,17 @@ typedef struct islandWalker {
|
||||
} islandWalker;
|
||||
|
||||
typedef struct loopWalker {
|
||||
struct islandWalker * prev;
|
||||
struct loopWalker * prev;
|
||||
BMEdge *cur, *start;
|
||||
BMVert *lastv, *startv;
|
||||
int startrad, stage2;
|
||||
} loopWalker;
|
||||
|
||||
typedef struct faceloopWalker {
|
||||
struct faceloopWalker * prev;
|
||||
BMFace *f;
|
||||
} faceloopWalker;
|
||||
|
||||
/* NOTE: this comment is out of date, update it - joeedh
|
||||
* BMWalker - change this to use the filters functions.
|
||||
*
|
||||
@@ -98,6 +103,10 @@ static void loopWalker_begin(BMWalker *walker, void *data);
|
||||
static void *loopWalker_yield(BMWalker *walker);
|
||||
static void *loopWalker_step(BMWalker *walker);
|
||||
|
||||
static void faceloopWalker_begin(BMWalker *walker, void *data);
|
||||
static void *faceloopWalker_yield(BMWalker *walker);
|
||||
static void *faceloopWalker_step(BMWalker *walker);
|
||||
|
||||
/* Pointer hiding*/
|
||||
typedef struct bmesh_walkerGeneric{
|
||||
struct bmesh_walkerGeneric *prev;
|
||||
@@ -153,12 +162,12 @@ void BMW_Init(BMWalker *walker, BMesh *bm, int type, int searchmask)
|
||||
walker->yield = loopWalker_yield;
|
||||
size = sizeof(loopWalker);
|
||||
break;
|
||||
//case BMW_RING:
|
||||
// walker->begin = ringwalker_Begin;
|
||||
// walker->step = ringwalker_Step;
|
||||
// walker->yield = ringwalker_Yield;
|
||||
// size = sizeof(ringWalker);
|
||||
// break;
|
||||
case BMW_FACELOOP:
|
||||
walker->begin = faceloopWalker_begin;
|
||||
walker->step = faceloopWalker_step;
|
||||
walker->yield = faceloopWalker_yield;
|
||||
size = sizeof(faceloopWalker);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -594,3 +603,48 @@ static void *loopWalker_step(BMWalker *walker)
|
||||
|
||||
return owalk.cur;
|
||||
}
|
||||
|
||||
static void faceloopWalker_begin(BMWalker *walker, void *data)
|
||||
{
|
||||
faceloopWalker *lwalk;
|
||||
BMEdge *e = data;
|
||||
|
||||
BMW_pushstate(walker);
|
||||
|
||||
if (!e->loop) return;
|
||||
|
||||
lwalk = walker->currentstate;
|
||||
lwalk->l = e->loop;
|
||||
|
||||
BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL);
|
||||
}
|
||||
|
||||
static void *faceloopWalker_yield(BMWalker *walker)
|
||||
{
|
||||
faceloopWalker *lwalk = walker->currentstate;
|
||||
|
||||
if (!lwalk) return NULL;
|
||||
|
||||
return lwalk->l->f;
|
||||
}
|
||||
|
||||
static void *faceloopWalker_step(BMWalker *walker)
|
||||
{
|
||||
faceloopWalker *lwalk = walker->currentstate;
|
||||
BMFace *f = lwalk->l->f;
|
||||
BMLoop *l = lwalk->l;
|
||||
|
||||
l = l->head.next->next;
|
||||
l = l->radial.next->data;
|
||||
|
||||
BMW_popstate(walker);
|
||||
|
||||
if (!BLI_ghash_haskey(walker->visithash, l->f)) {
|
||||
BMW_pushstate(walker);
|
||||
lwalk = walker->currentstate;
|
||||
lwalk->l = l;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -805,14 +805,27 @@ static int similar_face_select__internal(Scene *scene, BMEditMesh *em, int mode)
|
||||
/* ***************************************************** */
|
||||
|
||||
/* **************** LOOP SELECTS *************** */
|
||||
static void walker_select(BMEditMesh *em, int walker, void *start, int select)
|
||||
{
|
||||
BMesh *bm = em->bm;
|
||||
BMHeader *h;
|
||||
BMWalker walker;
|
||||
|
||||
BMW_Init(&walker, bm, walker, 0);
|
||||
h = BMW_Begin(&walker, start);
|
||||
for (; h; h=BMW_Step(&walker)) {
|
||||
BM_Select(bm, h, select);
|
||||
}
|
||||
BMW_End(&walker);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* selects quads in loop direction of indicated edge */
|
||||
/* only flush over edges with valence <= 2 */
|
||||
void faceloop_select(BMEditMesh *em, BMEdge *startedge, int select)
|
||||
void faceloop_select(EditMesh *em, EditEdge *startedge, int select)
|
||||
{
|
||||
#if 0 //BMESH_TODO
|
||||
BMEdge *eed;
|
||||
BMFace *efa;
|
||||
EditEdge *eed;
|
||||
EditFace *efa;
|
||||
int looking= 1;
|
||||
|
||||
/* in eed->f1 we put the valence (amount of faces in edge) */
|
||||
@@ -875,8 +888,8 @@ void faceloop_select(BMEditMesh *em, BMEdge *startedge, int select)
|
||||
if(efa->f1) EM_select_face(efa, select);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* selects or deselects edges that:
|
||||
@@ -890,19 +903,6 @@ void faceloop_select(BMEditMesh *em, BMEdge *startedge, int select)
|
||||
- if edge no face:
|
||||
- has vertices with valence 2
|
||||
*/
|
||||
static void edgeloop_select(BMEditMesh *em, BMEdge *starteed, int select)
|
||||
{
|
||||
BMesh *bm = em->bm;
|
||||
BMEdge *e;
|
||||
BMWalker walker;
|
||||
|
||||
BMW_Init(&walker, bm, BMW_LOOP, 0);
|
||||
e = BMW_Begin(&walker, starteed);
|
||||
for (; e; e=BMW_Step(&walker)) {
|
||||
BM_Select(bm, e, 1);
|
||||
}
|
||||
BMW_End(&walker);
|
||||
}
|
||||
|
||||
/*
|
||||
Almostly exactly the same code as faceloop select
|
||||
@@ -1067,19 +1067,19 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
|
||||
else if(extend) select=0;
|
||||
|
||||
if(em->selectmode & SCE_SELECT_FACE) {
|
||||
faceloop_select(em, eed, select);
|
||||
walker_select(em, BMW_FACELOOP, starteed, select);
|
||||
}
|
||||
else if(em->selectmode & SCE_SELECT_EDGE) {
|
||||
if(ring)
|
||||
edgering_select(em, eed, select);
|
||||
else
|
||||
edgeloop_select(em, eed, select);
|
||||
walker_select(em, BMW_LOOP, starteed, select);
|
||||
}
|
||||
else if(em->selectmode & SCE_SELECT_VERTEX) {
|
||||
if(ring)
|
||||
edgering_select(em, eed, select);
|
||||
else
|
||||
edgeloop_select(em, eed, select);
|
||||
walker_select(em, BMW_LOOP, starteed, select);
|
||||
}
|
||||
|
||||
EDBM_selectmode_flush(em);
|
||||
|
||||
Reference in New Issue
Block a user