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>2019-03-05 06:40:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-05 06:40:33 +0300
commit21e379b7335efe340218ebfe6b576f826c990948 (patch)
treebc50888809693b30720adbb22fe4db49981612d9 /source/blender/editors/mesh/editmesh_polybuild.c
parent51e743c7fa0f0bddac45066bc162b5ca99586031 (diff)
3D View: move pre-select mesh element access into gizmo API
Diffstat (limited to 'source/blender/editors/mesh/editmesh_polybuild.c')
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index 7012629ec95..e7e69703237 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -89,48 +89,15 @@ static bool edbm_preselect_or_active(
Base **r_base,
BMElem **r_ele)
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
wmGizmoMap *gzmap = ar->gizmo_map;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") : NULL;
if (gzgroup != NULL) {
wmGizmo *gz = gzgroup->gizmos.first;
- const int object_index = RNA_int_get(gz->ptr, "object_index");
-
- /* weak, allocate an array just to access the index. */
- Base *base = NULL;
- Object *obedit = NULL;
- {
- uint bases_len;
- Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(view_layer, CTX_wm_view3d(C), &bases_len);
- if (object_index < bases_len) {
- base = bases[object_index];
- obedit = base->object;
- }
- MEM_freeN(bases);
- }
-
- *r_base = base;
- *r_ele = NULL;
-
- if (obedit) {
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMesh *bm = em->bm;
- const int vert_index = RNA_int_get(gz->ptr, "vert_index");
- const int edge_index = RNA_int_get(gz->ptr, "edge_index");
- const int face_index = RNA_int_get(gz->ptr, "face_index");
- if (vert_index != -1) {
- *r_ele = (BMElem *)BM_vert_at_index_find(bm, vert_index);
- }
- else if (edge_index != -1) {
- *r_ele = (BMElem *)BM_edge_at_index_find(bm, edge_index);
- }
- else if (face_index != -1) {
- *r_ele = (BMElem *)BM_face_at_index_find(bm, face_index);
- }
- }
+ ED_view3d_gizmo_mesh_preselect_get_active(C, gz, r_base, r_ele);
}
else {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = view_layer->basact;
Object *obedit = base->object;
BMEditMesh *em = BKE_editmesh_from_object(obedit);