diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-01 18:54:21 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-01 18:54:21 +0300 |
commit | 1178518a689eba1b53b455a07612fcc77bde45df (patch) | |
tree | 491fe7a1b90c0e9a5f755740bac03847406bcf96 /source/blender/blenkernel/intern/mesh.c | |
parent | 7377d411b47d50cd943cd33e3e55c0409bb79f91 (diff) |
Refactor: Merge non-functional-change part of 'edit normals' 2017 GSoC.
This merges changes in internals, runtime-only of existing custom
normals code, which make sense as of themselves, and will make diff of
soc branch easier/lighter to review.
In the details, it mostly changes two things:
* Now, smooth fans (aka MLoopNorSpaceArray) can store either loop
indices, or pointers to BMLoop themselves. This makes sense since in
BMesh, it's relatively easy to get index from a BMElement, but nearly
impracticable to go the other way around.
* First change enforces another, now we cannot rely anymore on `loops`
being NULL in MLoopNorSpace to detect single-loop fans, so we instead
store that info in a new flag.
Again, these are expected to be totally non-functional changes.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 81a06ff17cc..16017d8c250 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2165,6 +2165,8 @@ static int split_faces_prepare_new_verts( MLoop *ml = mloop; MLoopNorSpace **lnor_space = lnors_spacearr->lspacearr; + BLI_assert(lnors_spacearr->data_type == MLNOR_SPACEARR_LOOP_INDEX); + for (int loop_idx = 0; loop_idx < num_loops; loop_idx++, ml++, lnor_space++) { if (!BLI_BITMAP_TEST(done_loops, loop_idx)) { const int vert_idx = ml->v; @@ -2174,7 +2176,15 @@ static int split_faces_prepare_new_verts( BLI_assert(*lnor_space); - if ((*lnor_space)->loops) { + if ((*lnor_space)->flags & MLNOR_SPACE_IS_SINGLE) { + /* Single loop in this fan... */ + BLI_assert(GET_INT_FROM_POINTER((*lnor_space)->loops) == loop_idx); + BLI_BITMAP_ENABLE(done_loops, loop_idx); + if (vert_used) { + ml->v = new_vert_idx; + } + } + else { for (LinkNode *lnode = (*lnor_space)->loops; lnode; lnode = lnode->next) { const int ml_fan_idx = GET_INT_FROM_POINTER(lnode->link); BLI_BITMAP_ENABLE(done_loops, ml_fan_idx); @@ -2183,13 +2193,6 @@ static int split_faces_prepare_new_verts( } } } - else { - /* Single loop in this fan... */ - BLI_BITMAP_ENABLE(done_loops, loop_idx); - if (vert_used) { - ml->v = new_vert_idx; - } - } if (!vert_used) { BLI_BITMAP_ENABLE(verts_used, vert_idx); |