I'm currently trying to create an importer, and i'm trying to create the meshes completely via the BMesh module. Adding vertices and faces works perfectly fine so far, but for some reason, after adding and assigning the shape keys and their offsets, they dont make it into the mesh on "to_mesh()"

mesh = bpy.data.meshes.new(meName)
bm = bmesh.new()

if len(skNames) > 0:
    for i, s in enumerate(skNames):
        skNames[i] = bm.verts.layers.shape.new(s)


for v in vertexData:
    bmv = bm.verts.new(v.position)
    for i, s in enumerate(skNames):
        bmv[s] = map(sum, zip(v.position, v.shapes[i]))

for p in faceData:
    verts = [None] * len(p.loops)
    for i, l in enumerate(p.loops):
        verts[i] = l.vertex.vertex

    except ValueError:
        debug("   Some face appeared already")


when checking whether the vertices contain shape data on respective layer, they do hold the offsets, but none of it gets transported over to the actual mesh. the problem is that i am creating the mesh before assigning it to an object (multiple objects can have the same mesh in the format, thus the meshes are being created before the objects themselves)

any idea what to do to solve the issue? thanks!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.