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:
authorCampbell Barton <ideasman42@gmail.com>2013-06-24 08:51:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-24 08:51:56 +0400
commit781184562b47846113a83549fe0ef5d36a957579 (patch)
tree5d052fdea8a750b3f716bc95d6eac83a519cc9c3 /source/blender/bmesh
parentbc79e226eee4fd218b3d047007a5609a8f7c39b2 (diff)
add api calls for BM_mesh_active_vert/edge_get.
inspecting the edit-selection inline was cumbersome.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c45
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.h7
2 files changed, 47 insertions, 5 deletions
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index 313d76721fa..dc7c13b3fe0 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -555,12 +555,12 @@ void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
}
/* this replaces the active flag used in uv/face mode */
-void BM_active_face_set(BMesh *bm, BMFace *efa)
+void BM_mesh_active_face_set(BMesh *bm, BMFace *efa)
{
bm->act_face = efa;
}
-BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
+BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected)
{
if (bm->act_face && (!is_selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) {
return bm->act_face;
@@ -600,6 +600,45 @@ BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_select
return NULL;
}
+BMEdge *BM_mesh_active_edge_get(BMesh *bm)
+{
+ if (bm->selected.last) {
+ BMEditSelection *ese = bm->selected.last;
+
+ if (ese && ese->htype == BM_EDGE) {
+ return (BMEdge *)ese->ele;
+ }
+ }
+
+ return NULL;
+}
+
+BMVert *BM_mesh_active_vert_get(BMesh *bm)
+{
+ if (bm->selected.last) {
+ BMEditSelection *ese = bm->selected.last;
+
+ if (ese && ese->htype == BM_VERT) {
+ return (BMVert *)ese->ele;
+ }
+ }
+
+ return NULL;
+}
+
+BMElem *BM_mesh_active_elem_get(BMesh *bm)
+{
+ if (bm->selected.last) {
+ BMEditSelection *ese = bm->selected.last;
+
+ if (ese) {
+ return ese->ele;
+ }
+ }
+
+ return NULL;
+}
+
/**
* Generic way to get data from an EditSelection type
* These functions were written to be used by the Modifier widget
@@ -763,7 +802,7 @@ void BM_select_history_validate(BMesh *bm)
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
{
BMEditSelection *ese_last = bm->selected.last;
- BMFace *efa = BM_active_face_get(bm, false, false);
+ BMFace *efa = BM_mesh_active_face_get(bm, false, false);
ese->next = ese->prev = NULL;
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
index a3d2d4a6985..b7040e63458 100644
--- a/source/blender/bmesh/intern/bmesh_marking.h
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -70,8 +70,11 @@ int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hfl
int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, const bool respecthide);
/* edit selection stuff */
-void BM_active_face_set(BMesh *bm, BMFace *f);
-BMFace *BM_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected);
+void BM_mesh_active_face_set(BMesh *bm, BMFace *f);
+BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected);
+BMEdge *BM_mesh_active_edge_get(BMesh *bm);
+BMVert *BM_mesh_active_vert_get(BMesh *bm);
+BMElem *BM_mesh_active_elem_get(BMesh *bm);
void BM_editselection_center(BMEditSelection *ese, float r_center[3]);
void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);