0
$\begingroup$

I'm working on a Python script that generates a rigged model. The model itself is fairly complex and is composed of many individual mesh objects, all of which I want deformed by the armature when posed. I have set each individual object as a child of the armature, added the armature modifier with automatic weights, and everything works just as expected in pose mode.

Initially, my script selected all of the mesh objects and then used

bpy.ops.object.parent_set(type='ARMATURE_AUTO')

to setup the armature modifier with automatic weights. This worked great until the model included more individual mesh objects, now the script crashes Blender when I run it.

Of course, failure is not an option so I'm exploring alternate ways to complete my task.

I think what I need to do is to manually add vertex groups to each individual mesh object as they are being generated, and each of these vertex groups should be named after a bone that is nearest the mesh object in question - this is what will tie the mesh object to that particular section of the armature when deforming in pose mode. I will give all of these verts a weight of 1 when making the association.

I have a few questions:

  1. Am I understanding what needs to be done correctly, i.e. the process of rigging?
  2. Will the process outlined above result in the same behavior as using automatic weights?
  3. Do I need to add vertex groups for bones that should NOT affect the verts in question, with a weight of 0? Or is only adding vertex groups for bones that the verts should deform with the proper way to do it?
$\endgroup$

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.