code cleanup: no functional change - had both EDBM_editselection_* and BM_editselection_* funcs, replace EDBM_ funcs.
This commit is contained in:
@@ -803,6 +803,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
|
|||||||
BMesh *bm_new;
|
BMesh *bm_new;
|
||||||
BMVert *v, *v2, **vtable = NULL;
|
BMVert *v, *v2, **vtable = NULL;
|
||||||
BMEdge *e, *e2, **edges = NULL, **etable = NULL;
|
BMEdge *e, *e2, **edges = NULL, **etable = NULL;
|
||||||
|
BMElem **eletable;
|
||||||
BLI_array_declare(edges);
|
BLI_array_declare(edges);
|
||||||
BMLoop *l, /* *l2, */ **loops = NULL;
|
BMLoop *l, /* *l2, */ **loops = NULL;
|
||||||
BLI_array_declare(loops);
|
BLI_array_declare(loops);
|
||||||
@@ -913,21 +914,29 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
|
|||||||
|
|
||||||
/* copy over edit selection history */
|
/* copy over edit selection history */
|
||||||
for (ese = bm_old->selected.first; ese; ese = ese->next) {
|
for (ese = bm_old->selected.first; ese; ese = ese->next) {
|
||||||
void *ele = NULL;
|
BMElem *ele = NULL;
|
||||||
|
|
||||||
if (ese->htype == BM_VERT)
|
switch (ese->htype) {
|
||||||
ele = vtable[BM_elem_index_get(ese->ele)];
|
case BM_VERT:
|
||||||
else if (ese->htype == BM_EDGE)
|
eletable = (BMElem **)vtable;
|
||||||
ele = etable[BM_elem_index_get(ese->ele)];
|
break;
|
||||||
else if (ese->htype == BM_FACE) {
|
case BM_EDGE:
|
||||||
ele = ftable[BM_elem_index_get(ese->ele)];
|
eletable = (BMElem **)etable;
|
||||||
|
break;
|
||||||
|
case BM_FACE:
|
||||||
|
eletable = (BMElem **)ftable;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
eletable = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
BLI_assert(0);
|
if (eletable) {
|
||||||
|
ele = eletable[BM_elem_index_get(ese->ele)];
|
||||||
|
if (ele) {
|
||||||
|
BM_select_history_store(bm_new, ele);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ele)
|
|
||||||
BM_select_history_store(bm_new, ele);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(etable);
|
MEM_freeN(etable);
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ static void bm_kill_only_vert(BMesh *bm, BMVert *v)
|
|||||||
bm->totvert--;
|
bm->totvert--;
|
||||||
bm->elem_index_dirty |= BM_VERT;
|
bm->elem_index_dirty |= BM_VERT;
|
||||||
|
|
||||||
BM_select_history_remove(bm, (BMElem *)v);
|
BM_select_history_remove(bm, v);
|
||||||
if (v->head.data)
|
if (v->head.data)
|
||||||
CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
|
CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy)
|
|||||||
* - #EM_editselection_normal
|
* - #EM_editselection_normal
|
||||||
* - #EM_editselection_plane
|
* - #EM_editselection_plane
|
||||||
*/
|
*/
|
||||||
void BM_editselection_center(float r_center[3], BMEditSelection *ese)
|
void BM_editselection_center(BMEditSelection *ese, float r_center[3])
|
||||||
{
|
{
|
||||||
if (ese->htype == BM_VERT) {
|
if (ese->htype == BM_VERT) {
|
||||||
BMVert *eve = (BMVert *)ese->ele;
|
BMVert *eve = (BMVert *)ese->ele;
|
||||||
@@ -583,7 +583,7 @@ void BM_editselection_center(float r_center[3], BMEditSelection *ese)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BM_editselection_normal(float r_normal[3], BMEditSelection *ese)
|
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
|
||||||
{
|
{
|
||||||
if (ese->htype == BM_VERT) {
|
if (ese->htype == BM_VERT) {
|
||||||
BMVert *eve = (BMVert *)ese->ele;
|
BMVert *eve = (BMVert *)ese->ele;
|
||||||
@@ -617,14 +617,14 @@ void BM_editselection_normal(float r_normal[3], BMEditSelection *ese)
|
|||||||
/* Calculate a plane that is rightangles to the edge/vert/faces normal
|
/* Calculate a plane that is rightangles to the edge/vert/faces normal
|
||||||
* also make the plane run along an axis that is related to the geometry,
|
* also make the plane run along an axis that is related to the geometry,
|
||||||
* because this is used for the manipulators Y axis. */
|
* because this is used for the manipulators Y axis. */
|
||||||
void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
|
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
|
||||||
{
|
{
|
||||||
if (ese->htype == BM_VERT) {
|
if (ese->htype == BM_VERT) {
|
||||||
BMVert *eve = (BMVert *)ese->ele;
|
BMVert *eve = (BMVert *)ese->ele;
|
||||||
float vec[3] = {0.0f, 0.0f, 0.0f};
|
float vec[3] = {0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
if (ese->prev) { /* use previously selected data to make a useful vertex plane */
|
if (ese->prev) { /* use previously selected data to make a useful vertex plane */
|
||||||
BM_editselection_center(vec, ese->prev);
|
BM_editselection_center(ese->prev, vec);
|
||||||
sub_v3_v3v3(r_plane, vec, eve->co);
|
sub_v3_v3v3(r_plane, vec, eve->co);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -674,7 +674,7 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
|
|||||||
else {
|
else {
|
||||||
BMVert *verts[4] = {NULL};
|
BMVert *verts[4] = {NULL};
|
||||||
|
|
||||||
BM_iter_as_array(bm, BM_VERTS_OF_FACE, efa, (void **)verts, 4);
|
BM_iter_as_array(NULL, BM_VERTS_OF_FACE, efa, (void **)verts, 4);
|
||||||
|
|
||||||
if (efa->len == 4) {
|
if (efa->len == 4) {
|
||||||
float vecA[3], vecB[3];
|
float vecA[3], vecB[3];
|
||||||
@@ -713,12 +713,14 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
|
|||||||
normalize_v3(r_plane);
|
normalize_v3(r_plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BM_select_history_check(BMesh *bm, const BMElem *ele)
|
|
||||||
|
/* --- macro wrapped funcs --- */
|
||||||
|
int _bm_select_history_check(BMesh *bm, const BMHeader *ele)
|
||||||
{
|
{
|
||||||
BMEditSelection *ese;
|
BMEditSelection *ese;
|
||||||
|
|
||||||
for (ese = bm->selected.first; ese; ese = ese->next) {
|
for (ese = bm->selected.first; ese; ese = ese->next) {
|
||||||
if (ese->ele == ele) {
|
if (ese->ele == (BMElem *)ele) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,11 +728,11 @@ int BM_select_history_check(BMesh *bm, const BMElem *ele)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BM_select_history_remove(BMesh *bm, BMElem *ele)
|
int _bm_select_history_remove(BMesh *bm, BMHeader *ele)
|
||||||
{
|
{
|
||||||
BMEditSelection *ese;
|
BMEditSelection *ese;
|
||||||
for (ese = bm->selected.first; ese; ese = ese->next) {
|
for (ese = bm->selected.first; ese; ese = ese->next) {
|
||||||
if (ese->ele == ele) {
|
if (ese->ele == (BMElem *)ele) {
|
||||||
BLI_freelinkN(&(bm->selected), ese);
|
BLI_freelinkN(&(bm->selected), ese);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -739,26 +741,29 @@ int BM_select_history_remove(BMesh *bm, BMElem *ele)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
|
||||||
|
{
|
||||||
|
BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
|
||||||
|
ese->htype = ele->htype;
|
||||||
|
ese->ele = (BMElem *)ele;
|
||||||
|
BLI_addtail(&(bm->selected), ese);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bm_select_history_store(BMesh *bm, BMHeader *ele)
|
||||||
|
{
|
||||||
|
if (!BM_select_history_check(bm, (BMElem *)ele)) {
|
||||||
|
BM_select_history_store_notest(bm, (BMElem *)ele);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* --- end macro wrapped funcs --- */
|
||||||
|
|
||||||
|
|
||||||
void BM_select_history_clear(BMesh *bm)
|
void BM_select_history_clear(BMesh *bm)
|
||||||
{
|
{
|
||||||
BLI_freelistN(&bm->selected);
|
BLI_freelistN(&bm->selected);
|
||||||
bm->selected.first = bm->selected.last = NULL;
|
bm->selected.first = bm->selected.last = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BM_select_history_store_notest(BMesh *bm, BMElem *ele)
|
|
||||||
{
|
|
||||||
BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
|
|
||||||
ese->htype = ((BMHeader *)ele)->htype;
|
|
||||||
ese->ele = ele;
|
|
||||||
BLI_addtail(&(bm->selected), ese);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BM_select_history_store(BMesh *bm, BMElem *ele)
|
|
||||||
{
|
|
||||||
if (!BM_select_history_check(bm, ele)) {
|
|
||||||
BM_select_history_store_notest(bm, ele);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BM_select_history_validate(BMesh *bm)
|
void BM_select_history_validate(BMesh *bm)
|
||||||
{
|
{
|
||||||
@@ -775,6 +780,41 @@ void BM_select_history_validate(BMesh *bm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* utility function */
|
||||||
|
int BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
|
||||||
|
{
|
||||||
|
BMEditSelection *ese_last = bm->selected.last;
|
||||||
|
BMFace *efa = BM_active_face_get(bm, FALSE);
|
||||||
|
|
||||||
|
ese->next = ese->prev = NULL;
|
||||||
|
|
||||||
|
if (ese_last) {
|
||||||
|
if (ese_last->htype == BM_FACE) { /* if there is an active face, use it over the last selected face */
|
||||||
|
if (efa) {
|
||||||
|
ese->ele = (BMElem *)efa;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ese->ele = ese_last->ele;
|
||||||
|
}
|
||||||
|
ese->htype = BM_FACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ese->ele = ese_last->ele;
|
||||||
|
ese->htype = ese_last->htype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (efa) { /* no */
|
||||||
|
ese->ele = (BMElem *)efa;
|
||||||
|
ese->htype = BM_FACE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ese->ele = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
|
void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
|
||||||
int respecthide, const char hflag_test)
|
int respecthide, const char hflag_test)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,15 +73,23 @@ int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hf
|
|||||||
/* edit selection stuff */
|
/* edit selection stuff */
|
||||||
void BM_active_face_set(BMesh *bm, BMFace *f);
|
void BM_active_face_set(BMesh *bm, BMFace *f);
|
||||||
BMFace *BM_active_face_get(BMesh *bm, int sloppy);
|
BMFace *BM_active_face_get(BMesh *bm, int sloppy);
|
||||||
void BM_editselection_center(float r_center[3], BMEditSelection *ese);
|
|
||||||
void BM_editselection_normal(float r_normal[3], BMEditSelection *ese);
|
|
||||||
void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese);
|
|
||||||
|
|
||||||
int BM_select_history_check(BMesh *bm, const BMElem *ele);
|
void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
|
||||||
int BM_select_history_remove(BMesh *bm, BMElem *ele);
|
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
|
||||||
void BM_select_history_store_notest(BMesh *bm, BMElem *ele);
|
void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]);
|
||||||
void BM_select_history_store(BMesh *bm, BMElem *ele);
|
|
||||||
|
#define BM_select_history_check(bm, ele) _bm_select_history_check(bm, &(ele)->head)
|
||||||
|
#define BM_select_history_remove(bm, ele) _bm_select_history_remove(bm, &(ele)->head)
|
||||||
|
#define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
|
||||||
|
#define BM_select_history_store(bm, ele) _bm_select_history_store(bm, &(ele)->head)
|
||||||
|
|
||||||
|
int _bm_select_history_check(BMesh *bm, const BMHeader *ele);
|
||||||
|
int _bm_select_history_remove(BMesh *bm, BMHeader *ele);
|
||||||
|
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
|
||||||
|
void _bm_select_history_store(BMesh *bm, BMHeader *ele);
|
||||||
|
|
||||||
void BM_select_history_validate(BMesh *bm);
|
void BM_select_history_validate(BMesh *bm);
|
||||||
void BM_select_history_clear(BMesh *em);
|
void BM_select_history_clear(BMesh *em);
|
||||||
|
int BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
|
||||||
|
|
||||||
#endif /* __BMESH_MARKING_H__ */
|
#endif /* __BMESH_MARKING_H__ */
|
||||||
|
|||||||
@@ -114,12 +114,8 @@ void EDBM_selectmode_set(struct BMEditMesh *em);
|
|||||||
void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectmode);
|
void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectmode);
|
||||||
void undo_push_mesh(struct bContext *C, const char *name);
|
void undo_push_mesh(struct bContext *C, const char *name);
|
||||||
|
|
||||||
int EDBM_editselection_active_get(struct BMEditMesh *em, struct BMEditSelection *ese);
|
|
||||||
void EDBM_editselection_center(float *center, struct BMEditSelection *ese);
|
|
||||||
void EDBM_editselection_plane(struct BMEditMesh *em, float *plane, struct BMEditSelection *ese);
|
|
||||||
void EDBM_editselection_normal(float *normal, struct BMEditSelection *ese);
|
|
||||||
int EDBM_vert_color_check(struct BMEditMesh *em);
|
int EDBM_vert_color_check(struct BMEditMesh *em);
|
||||||
void EDBM_editselection_validate(struct BMEditMesh *em);
|
|
||||||
|
|
||||||
void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
|
void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
|
||||||
void EDBM_mesh_reveal(struct BMEditMesh *em);
|
void EDBM_mesh_reveal(struct BMEditMesh *em);
|
||||||
|
|||||||
@@ -337,9 +337,9 @@ static void ringsel_finish(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
/* sets as active, useful for other tools */
|
/* sets as active, useful for other tools */
|
||||||
if (em->selectmode & SCE_SELECT_VERTEX)
|
if (em->selectmode & SCE_SELECT_VERTEX)
|
||||||
EDBM_editselection_store(em, &lcd->eed->v1->head); /* low priority TODO, get vertrex close to mouse */
|
BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
|
||||||
if (em->selectmode & SCE_SELECT_EDGE)
|
if (em->selectmode & SCE_SELECT_EDGE)
|
||||||
EDBM_editselection_store(em, &lcd->eed->head);
|
BM_select_history_store(em->bm, lcd->eed);
|
||||||
|
|
||||||
EDBM_selectmode_flush(lcd->em);
|
EDBM_selectmode_flush(lcd->em);
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data);
|
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data);
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
|
ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
|
||||||
|
|
||||||
/* find selected vert - same some time and check history first */
|
/* find selected vert - same some time and check history first */
|
||||||
if (EDBM_editselection_active_get(em, &ese) && ese.htype == BM_VERT) {
|
if (BM_select_history_active_get(em->bm, &ese) && ese.htype == BM_VERT) {
|
||||||
v = (BMVert *)ese.ele;
|
v = (BMVert *)ese.ele;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -450,7 +450,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
int vi_best = 0;
|
int vi_best = 0;
|
||||||
|
|
||||||
if (ese.ele) {
|
if (ese.ele) {
|
||||||
EDBM_editselection_remove(em, &ese.ele->head);
|
BM_select_history_remove(em->bm, ese.ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
dist = FLT_MAX;
|
dist = FLT_MAX;
|
||||||
@@ -480,7 +480,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
BM_vert_select_set(bm, v, TRUE);
|
BM_vert_select_set(bm, v, TRUE);
|
||||||
|
|
||||||
if (ese.ele) {
|
if (ese.ele) {
|
||||||
EDBM_editselection_store(em, &v->head);
|
BM_select_history_store(em->bm, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* splice all others back together */
|
/* splice all others back together */
|
||||||
@@ -573,7 +573,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
if (v_best) {
|
if (v_best) {
|
||||||
BM_vert_select_set(bm, v_best, TRUE);
|
BM_vert_select_set(bm, v_best, TRUE);
|
||||||
if (ese.ele) {
|
if (ese.ele) {
|
||||||
EDBM_editselection_store(em, &v_best->head);
|
BM_select_history_store(em->bm, v_best);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1049,10 +1049,10 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
|
|||||||
/* TODO: would be nice if the edge vertex chosen here
|
/* TODO: would be nice if the edge vertex chosen here
|
||||||
* was the one closer to the selection pointer, instead
|
* was the one closer to the selection pointer, instead
|
||||||
* of arbitrarily selecting the first one */
|
* of arbitrarily selecting the first one */
|
||||||
EDBM_editselection_store(em, &eed->v1->head);
|
BM_select_history_store(em->bm, eed->v1);
|
||||||
}
|
}
|
||||||
else if (em->selectmode & SCE_SELECT_EDGE) {
|
else if (em->selectmode & SCE_SELECT_EDGE) {
|
||||||
EDBM_editselection_store(em, &eed->head);
|
BM_select_history_store(em->bm, eed);
|
||||||
}
|
}
|
||||||
/* TODO: would be nice if the nearest face that
|
/* TODO: would be nice if the nearest face that
|
||||||
* belongs to the selected edge could be set to
|
* belongs to the selected edge could be set to
|
||||||
@@ -1364,7 +1364,7 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2])
|
|||||||
e_act = (BMEdge *)ese->ele;
|
e_act = (BMEdge *)ese->ele;
|
||||||
if (e_act != e) {
|
if (e_act != e) {
|
||||||
if (edgetag_shortest_path(vc.scene, em, e_act, e)) {
|
if (edgetag_shortest_path(vc.scene, em, e_act, e)) {
|
||||||
EDBM_editselection_remove(em, &e_act->head);
|
BM_select_history_remove(em->bm, e_act);
|
||||||
path = 1;
|
path = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1379,9 +1379,9 @@ static int mouse_mesh_shortest_path(bContext *C, int mval[2])
|
|||||||
|
|
||||||
/* even if this is selected it may not be in the selection list */
|
/* even if this is selected it may not be in the selection list */
|
||||||
if (edgetag_context_check(vc.scene, em, e) == 0)
|
if (edgetag_context_check(vc.scene, em, e) == 0)
|
||||||
EDBM_editselection_remove(em, &e->head);
|
BM_select_history_remove(em->bm, e);
|
||||||
else
|
else
|
||||||
EDBM_editselection_store(em, &e->head);
|
BM_select_history_store(em->bm, e);
|
||||||
|
|
||||||
/* force drawmode for mesh */
|
/* force drawmode for mesh */
|
||||||
switch (CTX_data_tool_settings(C)->edge_mode) {
|
switch (CTX_data_tool_settings(C)->edge_mode) {
|
||||||
@@ -1476,31 +1476,31 @@ int mouse_mesh(bContext *C, const int mval[2], short extend)
|
|||||||
BM_active_face_set(vc.em->bm, efa);
|
BM_active_face_set(vc.em->bm, efa);
|
||||||
|
|
||||||
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
|
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
|
||||||
EDBM_editselection_store(vc.em, &efa->head);
|
BM_select_history_store(vc.em->bm, efa);
|
||||||
BM_face_select_set(vc.em->bm, efa, TRUE);
|
BM_face_select_set(vc.em->bm, efa, TRUE);
|
||||||
}
|
}
|
||||||
else if (extend) {
|
else if (extend) {
|
||||||
EDBM_editselection_remove(vc.em, &efa->head);
|
BM_select_history_remove(vc.em->bm, efa);
|
||||||
BM_face_select_set(vc.em->bm, efa, FALSE);
|
BM_face_select_set(vc.em->bm, efa, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eed) {
|
else if (eed) {
|
||||||
if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
||||||
EDBM_editselection_store(vc.em, &eed->head);
|
BM_select_history_store(vc.em->bm, eed);
|
||||||
BM_edge_select_set(vc.em->bm, eed, TRUE);
|
BM_edge_select_set(vc.em->bm, eed, TRUE);
|
||||||
}
|
}
|
||||||
else if (extend) {
|
else if (extend) {
|
||||||
EDBM_editselection_remove(vc.em, &eed->head);
|
BM_select_history_remove(vc.em->bm, eed);
|
||||||
BM_edge_select_set(vc.em->bm, eed, FALSE);
|
BM_edge_select_set(vc.em->bm, eed, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eve) {
|
else if (eve) {
|
||||||
if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||||
EDBM_editselection_store(vc.em, &eve->head);
|
BM_select_history_store(vc.em->bm, eve);
|
||||||
BM_vert_select_set(vc.em->bm, eve, TRUE);
|
BM_vert_select_set(vc.em->bm, eve, TRUE);
|
||||||
}
|
}
|
||||||
else if (extend) {
|
else if (extend) {
|
||||||
EDBM_editselection_remove(vc.em, &eve->head);
|
BM_select_history_remove(vc.em->bm, eve);
|
||||||
BM_vert_select_set(vc.em->bm, eve, FALSE);
|
BM_vert_select_set(vc.em->bm, eve, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,13 +216,13 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Store in historty if not merging */
|
/* Store in historty if not merging */
|
||||||
EDBM_editselection_store(em, &vso->start_vtx->head);
|
BM_select_history_store(em->bm, vso->start_vtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Store edit selection of the active vertex, allows other
|
/* Store edit selection of the active vertex, allows other
|
||||||
* ops to run without reselecting */
|
* ops to run without reselecting */
|
||||||
EDBM_editselection_store(em, &vso->start_vtx->head);
|
BM_select_history_store(em->bm, vso->start_vtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
EDBM_selectmode_flush(em);
|
EDBM_selectmode_flush(em);
|
||||||
@@ -664,8 +664,8 @@ static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
|
|||||||
BM_edge_select_set(bm, vso->sel_edge, TRUE);
|
BM_edge_select_set(bm, vso->sel_edge, TRUE);
|
||||||
BM_vert_select_set(bm, vso->start_vtx, TRUE);
|
BM_vert_select_set(bm, vso->start_vtx, TRUE);
|
||||||
|
|
||||||
EDBM_editselection_store(em, &vso->sel_edge->head);
|
BM_select_history_store(em->bm, vso->sel_edge);
|
||||||
EDBM_editselection_store(em, &vso->start_vtx->head);
|
BM_select_history_store(em->bm, vso->start_vtx);
|
||||||
ese = (BMEditSelection *)em->bm->selected.last;
|
ese = (BMEditSelection *)em->bm->selected.last;
|
||||||
}
|
}
|
||||||
distance_t = vso->distance;
|
distance_t = vso->distance;
|
||||||
|
|||||||
@@ -465,39 +465,6 @@ void EDBM_select_less(BMEditMesh *em)
|
|||||||
EDBM_selectmode_flush(em);
|
EDBM_selectmode_flush(em);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EDBM_editselection_active_get(BMEditMesh *em, BMEditSelection *ese)
|
|
||||||
{
|
|
||||||
BMEditSelection *ese_last = em->bm->selected.last;
|
|
||||||
BMFace *efa = BM_active_face_get(em->bm, FALSE);
|
|
||||||
|
|
||||||
ese->next = ese->prev = NULL;
|
|
||||||
|
|
||||||
if (ese_last) {
|
|
||||||
if (ese_last->htype == BM_FACE) { /* if there is an active face, use it over the last selected face */
|
|
||||||
if (efa) {
|
|
||||||
ese->ele = (BMElem *)efa;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ese->ele = ese_last->ele;
|
|
||||||
}
|
|
||||||
ese->htype = BM_FACE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ese->ele = ese_last->ele;
|
|
||||||
ese->htype = ese_last->htype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (efa) { /* no */
|
|
||||||
ese->ele = (BMElem *)efa;
|
|
||||||
ese->htype = BM_FACE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ese->ele = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDBM_flag_disable_all(BMEditMesh *em, const char hflag)
|
void EDBM_flag_disable_all(BMEditMesh *em, const char hflag)
|
||||||
{
|
{
|
||||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, FALSE);
|
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, FALSE);
|
||||||
@@ -1272,43 +1239,3 @@ void EDBM_update_generic(bContext *C, BMEditMesh *em, const short do_tessface)
|
|||||||
BMEdit_RecalcTessellation(em);
|
BMEdit_RecalcTessellation(em);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* * Selection History ***************************************************** */
|
|
||||||
/* these wrap equivalent bmesh functions. I'm in two minds of it we should
|
|
||||||
* just use the bm functions directly; on the one hand, there's no real
|
|
||||||
* need (at the moment) to wrap them, but on the other hand having these
|
|
||||||
* wrapped avoids a confusing mess of mixing BM_ and EDBM_ namespaces. */
|
|
||||||
|
|
||||||
void EDBM_editselection_center(float *center, BMEditSelection *ese)
|
|
||||||
{
|
|
||||||
BM_editselection_center(center, ese);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDBM_editselection_normal(float *normal, BMEditSelection *ese)
|
|
||||||
{
|
|
||||||
BM_editselection_normal(normal, ese);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate a plane that is rightangles to the edge/vert/faces normal
|
|
||||||
* also make the plane run along an axis that is related to the geometry,
|
|
||||||
* because this is used for the manipulators Y axis. */
|
|
||||||
void EDBM_editselection_plane(BMEditMesh *em, float *plane, BMEditSelection *ese)
|
|
||||||
{
|
|
||||||
BM_editselection_plane(em->bm, plane, ese);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDBM_editselection_remove(BMEditMesh *em, BMHeader *ele)
|
|
||||||
{
|
|
||||||
BM_select_history_remove(em->bm, (BMElem *)ele);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDBM_editselection_store(BMEditMesh *em, BMHeader *ele)
|
|
||||||
{
|
|
||||||
BM_select_history_store(em->bm, (BMElem *)ele);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EDBM_editselection_validate(BMEditMesh *em)
|
|
||||||
{
|
|
||||||
BM_select_history_validate(em->bm);
|
|
||||||
}
|
|
||||||
/* end select history */
|
|
||||||
|
|||||||
@@ -78,9 +78,6 @@ int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
|
|||||||
struct wmOperator *op, const int report);
|
struct wmOperator *op, const int report);
|
||||||
|
|
||||||
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
|
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
|
||||||
void EDBM_editselection_store(struct BMEditMesh *em, struct BMHeader *ele);
|
|
||||||
void EDBM_editselection_validate(struct BMEditMesh *em);
|
|
||||||
void EDBM_editselection_remove(struct BMEditMesh *em, struct BMHeader *ele);
|
|
||||||
void EDBM_stats_update(struct BMEditMesh *em);
|
void EDBM_stats_update(struct BMEditMesh *em);
|
||||||
|
|
||||||
/* TODO, move to math_geometry.c */
|
/* TODO, move to math_geometry.c */
|
||||||
|
|||||||
@@ -993,8 +993,8 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
|
|||||||
Mesh *me = obedit->data;
|
Mesh *me = obedit->data;
|
||||||
BMEditSelection ese;
|
BMEditSelection ese;
|
||||||
|
|
||||||
if (EDBM_editselection_active_get(me->edit_btmesh, &ese)) {
|
if (BM_select_history_active_get(me->edit_btmesh->bm, &ese)) {
|
||||||
EDBM_editselection_center(curs, &ese);
|
BM_editselection_center(&ese, curs);
|
||||||
}
|
}
|
||||||
|
|
||||||
mul_m4_v3(obedit->obmat, curs);
|
mul_m4_v3(obedit->obmat, curs);
|
||||||
|
|||||||
@@ -1523,8 +1523,8 @@ void calculateCenter(TransInfo *t)
|
|||||||
BMEditSelection ese;
|
BMEditSelection ese;
|
||||||
BMEditMesh *em = BMEdit_FromObject(t->obedit);
|
BMEditMesh *em = BMEdit_FromObject(t->obedit);
|
||||||
|
|
||||||
if (EDBM_editselection_active_get(em, &ese)) {
|
if (BM_select_history_active_get(em->bm, &ese)) {
|
||||||
EDBM_editselection_center(t->center, &ese);
|
BM_editselection_center(&ese, t->center);
|
||||||
calculateCenter2D(t);
|
calculateCenter2D(t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ int calc_manipulator_stats(const bContext *C)
|
|||||||
float vec[3]= {0,0,0};
|
float vec[3]= {0,0,0};
|
||||||
|
|
||||||
/* USE LAST SELECTE WITH ACTIVE */
|
/* USE LAST SELECTE WITH ACTIVE */
|
||||||
if (v3d->around==V3D_ACTIVE && EDBM_editselection_active_get(em, &ese)) {
|
if ((v3d->around == V3D_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
|
||||||
EDBM_editselection_center(vec, &ese);
|
BM_editselection_center(&ese, vec);
|
||||||
calc_tw_center(scene, vec);
|
calc_tw_center(scene, vec);
|
||||||
totsel= 1;
|
totsel= 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -577,9 +577,9 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
|
|||||||
float vec[3]= {0,0,0};
|
float vec[3]= {0,0,0};
|
||||||
|
|
||||||
/* USE LAST SELECTED WITH ACTIVE */
|
/* USE LAST SELECTED WITH ACTIVE */
|
||||||
if (activeOnly && EDBM_editselection_active_get(em, &ese)) {
|
if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
|
||||||
EDBM_editselection_normal(normal, &ese);
|
BM_editselection_normal(&ese, normal);
|
||||||
EDBM_editselection_plane(em, plane, &ese);
|
BM_editselection_plane(&ese, plane);
|
||||||
|
|
||||||
switch (ese.htype)
|
switch (ese.htype)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3105,7 +3105,7 @@ static int hide_exec(bContext *C, wmOperator *op)
|
|||||||
if (em->selectmode != SCE_SELECT_FACE)
|
if (em->selectmode != SCE_SELECT_FACE)
|
||||||
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
|
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
|
||||||
|
|
||||||
EDBM_editselection_validate(em);
|
BM_select_history_validate(em->bm);
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
|||||||
Reference in New Issue
Block a user