[Bf-blender-cvs] [0529766] master: Use api function for flipping button list & rename to BLI_listbase_reverse

Campbell Barton noreply at git.blender.org
Wed Jun 25 11:35:15 CEST 2014


Commit: 0529766f32b70f38d4089297c8b5e86b964de289
Author: Campbell Barton
Date:   Wed Jun 25 19:33:35 2014 +1000
https://developer.blender.org/rB0529766f32b70f38d4089297c8b5e86b964de289

Use api function for flipping button list & rename to BLI_listbase_reverse

===================================================================

M	source/blender/blenlib/BLI_listbase.h
M	source/blender/blenlib/intern/listbase.c
M	source/blender/bmesh/intern/bmesh_edgeloop.c
M	source/blender/editors/interface/interface.c

===================================================================

diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index 028892e..b900b5f 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -75,7 +75,7 @@ void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1);
 
 void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1, 2);
 void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1, 2);
-void BLI_reverselist(struct ListBase *lb) ATTR_NONNULL(1);
+void BLI_listbase_reverse(struct ListBase *lb) ATTR_NONNULL(1);
 void BLI_rotatelist_first(struct ListBase *lb, void *vlink) ATTR_NONNULL(1, 2);
 void BLI_rotatelist_last(struct ListBase *lb, void *vlink) ATTR_NONNULL(1, 2);
 
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 76ad687..b0c2489 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -577,7 +577,7 @@ void BLI_duplicatelist(ListBase *dst, const ListBase *src)
 	}
 }
 
-void BLI_reverselist(ListBase *lb)
+void BLI_listbase_reverse(ListBase *lb)
 {
 	struct Link *curr = lb->first;
 	struct Link *prev = NULL;
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index c8a954a..f01e119 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -657,7 +657,7 @@ bool BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_stor
 void BM_edgeloop_flip(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
 {
 	negate_v3(el_store->no);
-	BLI_reverselist(&el_store->verts);
+	BLI_listbase_reverse(&el_store->verts);
 }
 
 void BM_edgeloop_expand(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store, int el_store_len)
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 0f4bba8..98e4fa2 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3791,8 +3791,7 @@ void uiBlockSetDirection(uiBlock *block, char direction)
 /* this call escapes if there's alignment flags */
 void uiBlockFlipOrder(uiBlock *block)
 {
-	ListBase lb;
-	uiBut *but, *next;
+	uiBut *but;
 	float centy, miny = 10000, maxy = -10000;
 
 	if (U.uiflag & USER_MENUFIXEDORDER)
@@ -3814,15 +3813,7 @@ void uiBlockFlipOrder(uiBlock *block)
 	}
 	
 	/* also flip order in block itself, for example for arrowkey */
-	BLI_listbase_clear(&lb);
-	but = block->buttons.first;
-	while (but) {
-		next = but->next;
-		BLI_remlink(&block->buttons, but);
-		BLI_addtail(&lb, but);
-		but = next;
-	}
-	block->buttons = lb;
+	BLI_listbase_reverse(&block->buttons);
 }




More information about the Bf-blender-cvs mailing list