Is someone interested in helping me to write a Cal3D exporter for Blender 2.5x? I managed to export static meshes but there’s still a lot of open questions. Right now I’m dealing with these two issues:
- In Cal3D, every vertex has an array of bone influences which in turn contain a bone id and a weight value. This is how I try to get these… does that make sense?
armatures = [modifier for modifier in object.modifiers if modifier.type == "ARMATURE"]
armature = armatures[0].object
poseBones = armature.pose.bones
tempVertices = []
for i, face in enumerate(mesh.faces):
for j, vertexIndex in enumerate(face.vertices) :
vertex = mesh.vertices[vertexIndex]
# [...]
# first i fetch vertex position, normal and texture coordinates, etc.
# then i attempt to collect all bone influences for this vertex:
boneInfluences = []
for vertexGroup in vertex.groups :
groupIndex = vertexGroup.group
boneName = object.vertex_groups[groupIndex].name
if boneName in poseBones :
bone = poseBones[boneName]
boneInfluences.append( BoneInfluence(bone.name, vertexGroup.weight) )
tempVertices.append( Vertex(position, Vector.normalized(normal), textureCoords, boneInfluences) )
for vertex in tempVertices :
for influence in vertex.boneInfluences :
influence.weight /= len(vertex.boneInfluences)
- Bones require a rotation and translation both in absolute coordinates and in bone space. How can I access this information in Python?
Thank you!