I want to make an automatic animation program using python scripts. Now I have some problem when I use the automatic weights function:
bpy.ops.object.parent_set(type = 'ARMATURE_AUTO')
I have a mesh like as the following picture shows (I can make sure there is no problem with the armature)
After executing the Automatic weights function, I pose the armature in pose mode. And some wired distortion happens as following pictures (After careful check, the mesh topology is correct including some sharp bump between the shanks)
I wonder why the distortion happens and how to fix that using python instead of using weight paint by myself.