diff --git a/nodes/modifier_make/clip_verts.py b/nodes/modifier_make/clip_verts.py index 7d99e11bc2..5575a329ba 100644 --- a/nodes/modifier_make/clip_verts.py +++ b/nodes/modifier_make/clip_verts.py @@ -55,7 +55,7 @@ def process(self): edges_out = [] faces_out = [] for verts, edges, faces in zip_long_repeat(verts_s, edges_s, faces_s): - bm = bmesh_from_pydata(verts, edges, faces, normal_update=True) + bm = bmesh_from_pydata(verts, edges, faces, normal_update=True, index_edges=True) new_bm = truncate_vertices(bm) bm.free() new_verts, new_edges, new_faces = pydata_from_bmesh(new_bm) diff --git a/utils/decorators.py b/utils/decorators.py index 603caa3bfc..24fc09c38c 100644 --- a/utils/decorators.py +++ b/utils/decorators.py @@ -118,6 +118,10 @@ def wrapped(*args, **kwargs): duration = str_color(f"{duration:.5g} ms", 32) msg = f"\n{func_name}: {duration}" # + display_args + display_kwargs - info(msg) + try: + info(msg) + except: + print(msg) + return result return wrapped diff --git a/utils/sv_bmesh_utils.py b/utils/sv_bmesh_utils.py index fa30f667ec..1450d05867 100644 --- a/utils/sv_bmesh_utils.py +++ b/utils/sv_bmesh_utils.py @@ -63,12 +63,18 @@ def bmesh_from_edit_mesh(mesh) -> ContextManager[bmesh.types.BMesh]: finally: bmesh.update_edit_mesh(mesh) +def bmesh_from_pydata( + verts=None, edges=[], faces=[], + markup_face_data=False, markup_edge_data=False, markup_vert_data=False, + normal_update=False, index_edges=False): -def bmesh_from_pydata(verts=None, edges=[], faces=[], markup_face_data=False, markup_edge_data=False, - markup_vert_data=False, normal_update=False): - ''' verts is necessary, edges/faces are optional - normal_update, will update verts/edges/faces normals at the end - ''' + """ + verts : necessary + edges / faces : optional + normal_update : optional - will update verts/edges/faces normals at the end + index_edges (bool) : optional - will make it possible for users of the bmesh to manually + iterate over any edges or do index lookups + """ bm = bmesh.new() bm_verts = bm.verts @@ -105,7 +111,8 @@ def bmesh_from_pydata(verts=None, edges=[], faces=[], markup_face_data=False, ma if markup_edge_data: bm_edge[initial_index_layer] = idx - bm.edges.index_update() + if has_element(edges) or index_edges: + bm.edges.index_update() if markup_vert_data: bm_verts.ensure_lookup_table()