In blender, I wanted to add multiple armature bones to a set of empties in my scene. In order to do this, I found this script:
for empt in bpy.data.objects:
if empt.type=='EMPTY':
bpy.context.view_layer.objects.active=empt
bpy.ops.object.armature_add(enter_editmode=False, align='WORLD',
location=empt.matrix_world.translation, scale=(1, 1, 1))
With this, separate armatures are being added , which I can join to a single one later, that is not the problem.
Now, While adding these armatures, I would like to give a name of my choice to the bones(of the armature). How do I do that through the python API, while I add armature. The bpy.ops.object.armature_add function doesn't have a "bone name", attribute, nor does it return the instance of armature that got created, so that i could then access its bone and rename?
Please advise. Any help would be appreciated. Thanks