Sign in to follow this  

A cry for help! Blender API

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get a list of bones then I run through the vertices and get the influences for each vertex. I then create a list limited to 4 weights and 4 indices, when I get the bone name for an influence I check to see if the name of that bone matches one in my list and thats where I get the index. Now this is where my problem happens, for some reason the bone data makes no sense... For instance when I have one bone for the mesh I would figure that the bone indices would look like this [ 0,0,0,0 ] and the bone weights would look like this [ 1,0,0,0 ] but I get kinda random weights and indices like the weights would be something like this [ 0.71, 0.39, 0, 0 ] even though there is only one bone connected to the mesh. Here is the code I use to get the bone index and weight lists:
	for vert in mesh.verts:
		influences = mesh.getVertexInfluences(vert.index)
		weights = []
		indices = []
		for influence in influences:
			if len(weights) < 4:
			if len(indices) < 4:
				for n in range(len(bones)):
					if bones[n].name == influence[0]:
		for n in range(4-len(weights)):
		for n in range(4-len(indices)):
		bone_weights.append( weights )
		bone_indices.append( indices )

So I believe there is something I'm doing wrong whether its in the way I create the mesh or the way I export the data, I'm not sure. To do the skinning in blender I just created a armature, set it as the parent of my mesh and clicked Create From Bone Heat which seems to work correctly in blender but the data I get from my script makes no sense at all. [Edited by - CodaKiller on January 11, 2009 10:43:10 AM]

Share this post

Link to post
Share on other sites
When I create a basic cube with a armature it export the data as expected but when I export my human model it exports random values that make no sense. Could there be some type of data left over from something I did while modeling it?

Share this post

Link to post
Share on other sites
Why are some of the weights over 1 and how can I fix it? Should I normalize the 4 weights?

Also it seems to work on the default models such as cube and sphere but any of the models that I made seem to have random weights.

Share this post

Link to post
Share on other sites
Sign in to follow this