- # set vertex attributes(normal, bone weights)
- bl.mesh.useVertexUV(mesh)
- for i, (v, mvert) in enumerate(zip(model.vertices, mesh.vertices)):
- bl.vertex.setNormal(mvert, convert_coord(v.normal))
- if isinstance(v.deform, pmx.Bdef1):
- bl.object.assignVertexGroup(mesh_object,
- model.bones[v.deform.index0].name, i, 1.0)
- elif isinstance(v.deform, pmx.Bdef2):
- bl.object.assignVertexGroup(mesh_object,
- model.bones[v.deform.index0].name, i, v.deform.weight0)
- bl.object.assignVertexGroup(mesh_object,
- model.bones[v.deform.index1].name, i, 1.0-v.deform.weight0)
- else:
- raise Exception("unknown deform: %s" % v.deform)