fixed edge slide to an extent, though it still needs work (finding correct transform direction vector, uvs/vcols, etc). also got delete and vert connect (ykey) to work again.

This commit is contained in:
Joseph Eagar 2010-03-10 11:16:26 +00:00
parent 71003b9bcc
commit b8b6fad640
6 changed files with 52 additions and 11 deletions

View File

@ -118,6 +118,9 @@ void BM_SelectMode_Flush(BMesh *bm)
void BM_Select_Vert(BMesh *bm, BMVert *v, int select)
{
BMIter iter;
BMEdge *e;
if(select) {
if (!BM_TestHFlag(v, BM_SELECT)) bm->totvertsel += 1;
BM_SetHFlag(v, BM_SELECT);
@ -125,6 +128,23 @@ void BM_Select_Vert(BMesh *bm, BMVert *v, int select)
if (BM_TestHFlag(v, BM_SELECT)) bm->totvertsel -= 1;
BM_ClearHFlag(v, BM_SELECT);
}
/*BMESH_TODO hrm, not sure if flushing here is such a good idea. . .
but probably easier then calling a EDBM_Normalize_Selection after
each tool?*/
#if 0
BM_ITER(e, &iter, bm, BM_EDGES_OF_VERT, v) {
if (!BM_TestHFlag(e, BM_SELECT) && BM_TestHFlag(e->v1, BM_SELECT)
&& BM_TestHFlag(e->v2, BM_SELECT)) {
BM_SetHFlag(e, BM_SELECT);
bm->totedgesel += 1;
} else if (BM_TestHFlag(e, BM_SELECT) && (!BM_TestHFlag(e->v1, BM_SELECT)
|| !BM_TestHFlag(e->v2, BM_SELECT))) {
BM_ClearHFlag(e, BM_SELECT);
bm->totedgesel -= 1;
}
}
#endif
}
/*

View File

@ -1006,6 +1006,23 @@ void BM_esubdivideflag(Object *obedit, BMesh *bm, int flag, float smooth,
ele = BMO_IterNew(&iter, bm, &op, "outinner", BM_EDGE|BM_VERT);
for (; ele; ele=BMO_IterStep(&iter)) {
BM_Select(bm, ele, 1);
if (ele->type == BM_VERT) {
BMEdge *e;
BMIter eiter;
BM_ITER(e, &eiter, bm, BM_EDGES_OF_VERT, ele) {
if (!BM_TestHFlag(e, BM_SELECT) && BM_TestHFlag(e->v1, BM_SELECT)
&& BM_TestHFlag(e->v2, BM_SELECT)) {
BM_SetHFlag(e, BM_SELECT);
bm->totedgesel += 1;
} else if (BM_TestHFlag(e, BM_SELECT) && (!BM_TestHFlag(e->v1, BM_SELECT)
|| !BM_TestHFlag(e->v2, BM_SELECT))) {
BM_ClearHFlag(e, BM_SELECT);
bm->totedgesel -= 1;
}
}
}
}
}

View File

@ -1158,7 +1158,7 @@ void MESH_OT_delete(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/*props */
RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 10, "Type", "Method used for deleting mesh data");
ot->prop = RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 10, "Type", "Method used for deleting mesh data");
}

View File

@ -281,16 +281,17 @@ static void ringsel_find_edge(tringselOpData *lcd, const bContext *C, ARegion *a
static void ringsel_finish(bContext *C, wmOperator *op)
{
tringselOpData *lcd= op->customdata;
int cuts= RNA_int_get(op->ptr,"number_cuts");
int cuts= RNA_int_get(op->ptr, "number_cuts");
if (lcd->eed) {
edgering_sel(lcd, cuts, 1);
if (lcd->do_cut) {
BMEditMesh *em = lcd->em;
BM_esubdivideflag(lcd->ob, em->bm, BM_SELECT, 0.0f,
0.0f, 0, cuts, SUBDIV_SELECT_LOOPCUT,
SUBD_PATH, 0, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT|ND_DATA, lcd->ob->data);
DAG_id_flush_update(lcd->ob->data, OB_RECALC_DATA);
}

View File

@ -154,6 +154,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_solidify);
WM_operatortype_append(MESH_OT_select_nth);
WM_operatortype_append(MESH_OT_vert_connect);
}
int ED_operator_editmesh_face_select(bContext *C)
@ -290,7 +291,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_vert_connect", YKEY, KM_PRESS, 0, 0);
/* use KM_CLICK because same key is used for tweaks */
WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);

View File

@ -4139,7 +4139,7 @@ static BMLoop *get_next_loop(BMesh *bm, BMVert *v, BMLoop *l,
VECCOPY(vec, a);
return l;
} else {
sub_v3_v3v3(n, BM_OtherEdgeVert(l->e, l->v)->co, l->v->co);
sub_v3_v3v3(n, BM_OtherEdgeVert(l->e, v)->co, v->co);
add_v3_v3v3(a, a, n);
i += 1;
}
@ -4243,8 +4243,6 @@ static int createSlideVerts(TransInfo *t)
if (!v)
break;
BMINDEX_SET(v, 0);
if (!v->edge)
continue;
@ -4256,8 +4254,6 @@ static int createSlideVerts(TransInfo *t)
/*first, rewind*/
numsel = 0;
do {
BMINDEX_SET(v, 0);
e = get_other_edge(bm, v, e);
if (!e) {
e = v->edge;
@ -4272,6 +4268,8 @@ static int createSlideVerts(TransInfo *t)
v = BM_OtherEdgeVert(e, v);
} while (e != first->edge);
BMINDEX_SET(v, 0);
l1 = l2 = l = NULL;
l1 = e->loop;
l2 = e->loop->radial.next->data;
@ -4311,21 +4309,25 @@ static int createSlideVerts(TransInfo *t)
e1 = e;
e = get_other_edge(bm, v, e);
if (!e) {
//v2=v, v = BM_OtherEdgeVert(l1->e, v);
sv = tempsv + j + 1;
sv->v = v;
sv->origvert = *v;
l = BM_OtherFaceLoop(l1->e, l1->f, v);
sv->up = BM_OtherEdgeVert(l->e, v);
sub_v3_v3v3(sv->upvec, BM_OtherEdgeVert(l->e, v)->co, v->co);
if (l2) {
l = BM_OtherFaceLoop(l2->e, l2->f, v);
sv->down = BM_OtherEdgeVert(l->e, v);
sub_v3_v3v3(sv->downvec, BM_OtherEdgeVert(l->e, v)->co, v->co);
}
BMINDEX_SET(v, 0);
BMINDEX_SET(v2, 0);
j += 2;
break;
}
@ -4902,7 +4904,7 @@ int doEdgeSlide(TransInfo *t, float perc)
add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
} else {
VECCOPY(vec, sv->downvec);
mul_v3_fl(vec, perc);
mul_v3_fl(vec, -perc);
add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
}
}