diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-09 20:08:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-10 18:25:48 +0300 |
commit | 227fafdfcf4fb441ba1b8477331d543d2cf087af (patch) | |
tree | 26a0ac762d8985007286884992194c690696cb46 /modules | |
parent | adb4f822ca2383ec269c529d62419f3e6998bd48 (diff) |
Update for removal of tessfaces.
This ports the already working addons. The disabled x3d, psk, lwo, 3ds,
raw, dxf addons still need to be converted.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/snap_context/mesh_drawing.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/modules/snap_context/mesh_drawing.py b/modules/snap_context/mesh_drawing.py index bdfca4d3..95660622 100644 --- a/modules/snap_context/mesh_drawing.py +++ b/modules/snap_context/mesh_drawing.py @@ -52,26 +52,15 @@ def get_bmesh_vert_co_array(bm): def get_mesh_tri_verts_array(me): - me.calc_tessface() - len_tessfaces = len(me.tessfaces) - if len_tessfaces: - tessfaces = np.empty(len_tessfaces * 4, 'i4') - me.tessfaces.foreach_get("vertices_raw", tessfaces) - tessfaces.shape = (-1, 4) - - quad_indices = tessfaces[:, 3].nonzero()[0] - tris = np.empty(((len_tessfaces + len(quad_indices)), 3), 'i4') - - tris[:len_tessfaces] = tessfaces[:, :3] - tris[len_tessfaces:] = tessfaces[quad_indices][:, (0, 2, 3)] - - del tessfaces - return tris + me.calc_loop_triangles() + tris = [tri.vertices[:] for tri in me.loop_triangles] + if tris: + return np.array(tris, 'i4') return None def get_bmesh_tri_verts_array(bm): - ltris = bm.calc_tessface() + ltris = bm.calc_loop_triangles() tris = [[ltri[0].vert.index, ltri[1].vert.index, ltri[2].vert.index] for ltri in ltris if not ltri[0].face.hide] if tris: return np.array(tris, 'i4') |