transform manipulator didnt follow the active face in some cases, also rotate about...
[blender.git] / source / blender / src / editmesh_lib.c
index 24727308fb35908f5dd46aa7446c9e3df5fd50f6..6251ba1a6500009cff9771e2c0935a141f30eada 100644 (file)
@@ -103,6 +103,35 @@ EditFace * EM_get_actFace(int sloppy)
        return NULL;
 }
 
+int EM_get_actSelection(EditSelection *ese)
+{
+       EditSelection *ese_last = G.editMesh->selected.last;
+       EditFace *efa = EM_get_actFace(0);
+
+       ese->next = ese->prev = NULL;
+       
+       if (ese_last) {
+               if (ese_last->type == EDITFACE) { /* if there is an active face, use it over the last selected face */
+                       if (efa) {
+                               ese->data = (void *)efa;
+                       } else {
+                               ese->data = ese_last->data;
+                       }
+                       ese->type = EDITFACE;
+               } else {
+                       ese->data = ese_last->data;
+                       ese->type = ese_last->type;
+               }
+       } else if (efa) { /* no */
+               ese->data = (void *)efa;
+               ese->type = EDITFACE;
+       } else {
+               ese->data = NULL;
+               return 0;
+       }
+       return 1;
+}
+
 /* ********* Selection History ************ */
 static int EM_check_selection(void *data)
 {