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>2015-02-13 03:01:47 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-13 03:06:16 +0300
commit29e19cecd845516bc63ab5dba094447a9d87b7aa (patch)
tree2469c67b60e208a21ebc06b397e4be22f8966d4b
parent1af042d9ed6b15463385c04665410ad54cf73f60 (diff)
BMesh: avoid ugly macro for loop interpolation
Compiler optimizes to practically the same output
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 45da3ce85bc..a88f38caf78 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -961,31 +961,27 @@ static void bm_loop_walk_add(struct LoopWalkCtx *lwc, BMLoop *l)
*/
static void bm_loop_walk_data(struct LoopWalkCtx *lwc, BMLoop *l_walk)
{
+ int i;
+
BLI_assert(CustomData_data_equals(lwc->type, lwc->data_ref, BM_ELEM_CD_GET_VOID_P(l_walk, lwc->cd_layer_offset)));
BLI_assert(BM_elem_flag_test(l_walk, BM_ELEM_INTERNAL_TAG) == false);
bm_loop_walk_add(lwc, l_walk);
-#define WALK_LOOP(l_test) \
-{ \
- BMLoop *l_other = l_test; \
- if (l_other->v != l_walk->v) { \
- l_other = l_other->next; \
- } \
- BLI_assert(l_other->v == l_walk->v); \
- if (!BM_elem_flag_test(l_other, BM_ELEM_INTERNAL_TAG)) { \
- if (CustomData_data_equals(lwc->type, lwc->data_ref, BM_ELEM_CD_GET_VOID_P(l_other, lwc->cd_layer_offset))) { \
- bm_loop_walk_data(lwc, l_other); \
- } \
- } \
-} (void)0
-
- if (l_walk->radial_next != l_walk) {
- WALK_LOOP(l_walk->radial_next);
- }
-
- if (l_walk->prev->radial_next != l_walk->prev) {
- WALK_LOOP(l_walk->prev->radial_next);
+ /* recurse around this loop-fan (in both directions) */
+ for (i = 0; i < 2; i++) {
+ BMLoop *l_other = ((i == 0) ? l_walk : l_walk->prev)->radial_next;
+ if (l_other->radial_next != l_other) {
+ if (l_other->v != l_walk->v) {
+ l_other = l_other->next;
+ }
+ BLI_assert(l_other->v == l_walk->v);
+ if (!BM_elem_flag_test(l_other, BM_ELEM_INTERNAL_TAG)) {
+ if (CustomData_data_equals(lwc->type, lwc->data_ref, BM_ELEM_CD_GET_VOID_P(l_other, lwc->cd_layer_offset))) {
+ bm_loop_walk_data(lwc, l_other);
+ }
+ }
+ }
}
}