Splitting vertices at seams

Hi all. I have an export script that I’ve been working on, but I need some help. The format calls for vertices to be split at seams. I’m trying to do this in code only(without changing the actual mesh). I need an efficient way to do this, the ways I’ve tried are really “roundabout” and don’t really work :(. The mesh is all triangles btw. TIA

some exporters create their own data structures, which hold the geometry information. They can then process the data and add extra “geometry” without affecting the mesh object.

But this seems to me like the easier solution:

Create a copy of the mesh, select all edges marked as seams, edge split, export, remove copied mesh.

With old blender api it would work like this:

import bpy

if bpy.context.object and bpy.context.object.type == 'MESH':

    me = bpy.context.object.data.copy()
    bpy.ops.object.mode_set(mode='EDIT', toggle=False)

    for edge in me.edges:
        if edge.use_seam:
            edge.select = True

    # export me


with bmesh module you could avoid the mode switching…

Thanks for you answer, but the problem with this approach is the vertex normals get recalculated after the split. So I guess I’m willing to try the hard way as long as it works. Have you seen this done in any particular exporter?

hm ok…

here’s an example:

Great, I’ll study it and see what I can come up with. Thanks a lot! :slight_smile: