3
$\begingroup$

I have a mesh whose seams have been detected (and saved as a file) using some algorithm (not Blender). The edges which represent seams are stored in the file.

Essentially all the face edges (represented using the vertex indices) which are seams have been stored together in a n*2 Numpy matrix .

[[0, 1],
 [1, 3],
 [3, 6],
...]

Then I need to feed the these edges (representing seams) to blender to then unwrap the mesh.

my question is: How do I feed edges (from a file) into Blender for unwrapping a mesh?

$\endgroup$
0

1 Answer 1

3
$\begingroup$

Given your format it can be done this way (Edit Mode):

import bmesh
from bpy import context as C
seams = [
 [0, 1],
 [0, 4],
 [4, 5],
 [1, 3],
 [5, 7],
]

me = C.object.data
bm = bmesh.from_edit_mesh(me)
for v1i, v2i in seams:
    v1 = bm.verts[v1i]
    v2 = bm.verts[v2i]
    for edge in v1.link_edges:
        if edge.other_vert(v1) == v2:
            edge.seam = True
            break
bmesh.update_edit_mesh(me)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .