code cleanup:

style and remove BM_face_find_longest/shortest_edge functions,
... instead use BM_face_find_longest/shortest_loop()->e
This commit is contained in:
Campbell Barton 2012-05-27 11:10:27 +00:00
parent 5b483932c7
commit 405f6a7c77
4 changed files with 30 additions and 26 deletions

@ -952,7 +952,7 @@ float BM_vert_calc_mean_tagged_edge_length(BMVert *v)
/**
* Returns the shortest edge in f.
* Returns the loop of the shortest edge in f.
*/
BMLoop *BM_face_find_shortest_loop(BMFace *f)
{
@ -976,7 +976,7 @@ BMLoop *BM_face_find_shortest_loop(BMFace *f)
}
/**
* Returns the longest edge in f.
* Returns the loop of the longest edge in f.
*/
BMLoop *BM_face_find_longest_loop(BMFace *f)
{
@ -999,16 +999,6 @@ BMLoop *BM_face_find_longest_loop(BMFace *f)
return longest_loop;
}
BMEdge *BM_face_find_shortest_edge(BMFace *f)
{
return BM_face_find_shortest_loop(f)->e;
}
BMEdge *BM_face_find_longest_edge(BMFace *f)
{
return BM_face_find_longest_loop(f)->e;
}
/**
* Returns the edge existing between v1 and v2, or NULL if there isn't one.
*

@ -67,9 +67,6 @@ float BM_vert_calc_edge_angle(BMVert *v);
float BM_vert_calc_shell_factor(BMVert *v);
float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
BMEdge *BM_face_find_shortest_edge(BMFace *f);
BMEdge *BM_face_find_longest_edge(BMFace *f);
BMLoop *BM_face_find_shortest_loop(BMFace *f);
BMLoop *BM_face_find_longest_loop(BMFace *f);

@ -304,13 +304,15 @@ int ED_operator_object_active_editable(bContext *C)
int ED_operator_object_active_editable_mesh(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH && !(((ID *)ob->data)->lib));
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
(ob->type == OB_MESH) && !(((ID *)ob->data)->lib));
}
int ED_operator_object_active_editable_font(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_FONT);
return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
(ob->type == OB_FONT));
}
int ED_operator_editmesh(bContext *C)
@ -1601,10 +1603,16 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
/* case of regions in regions, like operator properties panel */
/* these can sit on top of other regions such as headers, so account for this */
else if (edge == AE_BOTTOM_TO_TOPLEFT && scalear->alignment & RGN_ALIGN_TOP && ar->alignment == RGN_ALIGN_TOP && ar->regiontype == RGN_TYPE_HEADER)
else if (edge == AE_BOTTOM_TO_TOPLEFT && scalear->alignment & RGN_ALIGN_TOP &&
ar->alignment == RGN_ALIGN_TOP && ar->regiontype == RGN_TYPE_HEADER)
{
dist -= ar->winy;
else if (edge == AE_TOP_TO_BOTTOMRIGHT && scalear->alignment & RGN_ALIGN_BOTTOM && ar->alignment == RGN_ALIGN_BOTTOM && ar->regiontype == RGN_TYPE_HEADER)
}
else if (edge == AE_TOP_TO_BOTTOMRIGHT && scalear->alignment & RGN_ALIGN_BOTTOM &&
ar->alignment == RGN_ALIGN_BOTTOM && ar->regiontype == RGN_TYPE_HEADER)
{
dist -= ar->winy;
}
}
return dist;
@ -2571,6 +2579,15 @@ static void SCREEN_OT_redo_last(wmOperatorType *ot)
/* ************** region four-split operator ***************************** */
static void view3d_localview_update_rv3d(struct RegionView3D *rv3d)
{
if (rv3d->localvd) {
rv3d->localvd->view = rv3d->view;
rv3d->localvd->persp = rv3d->persp;
copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);
}
}
/* insert a region in the area region list */
static int region_quadview_exec(bContext *C, wmOperator *op)
{
@ -2627,29 +2644,29 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
* We could avoid manipulating rv3d->localvd here if exiting
* localview with a 4-split would assign these view locks */
RegionView3D *rv3d;
rv3d = ar->regiondata;
rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_FRONT; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
view3d_localview_update_rv3d(rv3d);
ar = ar->next;
rv3d = ar->regiondata;
rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_TOP; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
view3d_localview_update_rv3d(rv3d);
ar = ar->next;
rv3d = ar->regiondata;
rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_RIGHT; rv3d->persp = RV3D_ORTHO;
ED_view3d_lock(rv3d);
if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
view3d_localview_update_rv3d(rv3d);
ar = ar->next;
rv3d = ar->regiondata;
rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB;
ED_view3d_lock(rv3d);
if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat); }
view3d_localview_update_rv3d(rv3d);
}
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);

@ -1034,7 +1034,7 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
BMIter iter;
int i;
shortest_edge = BM_face_find_shortest_edge(f);
shortest_edge = BM_face_find_shortest_loop(f)->e;
BMO_op_initf(bm, &op, "weldverts");
/* Note: could probably calculate merges in one go to be
@ -1193,7 +1193,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
/* Need at least four ring edges, so subdivide longest edge if
* face is a triangle */
longest_edge = BM_face_find_longest_edge(split_face);
longest_edge = BM_face_find_longest_loop(split_face)->e;
BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, FALSE);
BM_elem_flag_enable(longest_edge, BM_ELEM_TAG);