diff options
-rw-r--r-- | source/blender/blenlib/BLI_listbase.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 27 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_bridge.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide_edgering.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 2 |
6 files changed, 29 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 0648c0ed06d..0927620a2c6 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -74,7 +74,8 @@ void BLI_freelinkN(struct ListBase *listbase, void *vlink); void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src); void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src); void BLI_reverselist(struct ListBase *lb); -void BLI_rotatelist(struct ListBase *lb, void *vlink); +void BLI_rotatelist_first(struct ListBase *lb, void *vlink); +void BLI_rotatelist_last(struct ListBase *lb, void *vlink); /* create a generic list node containing link to provided data */ struct LinkData *BLI_genericNodeN(void *data); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index c4644ff6309..2c59b940f8c 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -581,19 +581,34 @@ void BLI_reverselist(ListBase *lb) /** * \param vlink Link to make first. */ -void BLI_rotatelist(ListBase *lb, void *vlink) +void BLI_rotatelist_first(ListBase *lb, void *vlink) { /* make circular */ - ((LinkData *)lb->first)->prev = lb->last; - ((LinkData *)lb->last)->next = lb->first; + ((Link *)lb->first)->prev = lb->last; + ((Link *)lb->last)->next = lb->first; lb->first = vlink; - lb->last = ((LinkData *)vlink)->prev; + lb->last = ((Link *)vlink)->prev; - ((LinkData *)lb->first)->prev = NULL; - ((LinkData *)lb->last)->next = NULL; + ((Link *)lb->first)->prev = NULL; + ((Link *)lb->last)->next = NULL; } +/** + * \param vlink Link to make last. + */ +void BLI_rotatelist_last(ListBase *lb, void *vlink) +{ + /* make circular */ + ((Link *)lb->first)->prev = lb->last; + ((Link *)lb->last)->next = lb->first; + + lb->first = ((Link *)vlink)->next; + lb->last = vlink; + + ((Link *)lb->first)->prev = NULL; + ((Link *)lb->last)->next = NULL; +} /* create a generic list node containing link to provided data */ LinkData *BLI_genericNodeN(void *data) diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index fa46e353b48..22a1a87b71c 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -121,7 +121,7 @@ static void bm_bridge_best_rotation(struct BMEdgeLoopStore *el_store_a, struct B } if (el_b_best) { - BLI_rotatelist(lb_b, el_b_best); + BLI_rotatelist_first(lb_b, el_b_best); } } @@ -274,7 +274,7 @@ static void bridge_loop_pair(BMesh *bm, const int len_b = BM_edgeloop_length_get(el_store_b); ListBase *lb_b = BM_edgeloop_verts_get(el_store_b); LinkData *el_b = BLI_rfindlink(lb_b, positive_mod(twist_offset, len_b)); - BLI_rotatelist(lb_b, el_b); + BLI_rotatelist_first(lb_b, el_b); } } diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index d9d87d0db78..13a7aa09335 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -919,13 +919,13 @@ static void bm_edgering_pair_order(BMesh *bm, } BLI_assert(node != NULL); - BLI_rotatelist(lb_b, node); + BLI_rotatelist_first(lb_b, node); /* now check we are winding the same way */ if (bm_edgering_pair_order_is_flipped(bm, el_store_a, el_store_b)) { BM_edgeloop_flip(bm, el_store_b); /* re-ensure the first node */ - BLI_rotatelist(lb_b, node); + BLI_rotatelist_first(lb_b, node); } /* sanity checks that we are aligned & winding now */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index fe9da4b4f1d..6d47f1e1a98 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2913,7 +2913,7 @@ static void edbm_fill_grid_prepare(BMesh *bm, int span, int offset) } /* set this vertex first */ - BLI_rotatelist(verts, v_act_link); + BLI_rotatelist_first(verts, v_act_link); BM_edgeloop_edges_get(el_store, edges); /* un-flag 'rails' */ diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 910f50d568d..36ce72f1cab 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -785,7 +785,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } if (ctx_ob_act) { - BLI_rotatelist(&ctx_data_list, (LinkData *)ctx_ob_act); + BLI_rotatelist_first(&ctx_data_list, (LinkData *)ctx_ob_act); } for (tob = bmain->object.first; tob; tob = tob->id.next) { |