Changing Bone Indices?

Hi, everyone. Does anyone know of a way to change the indices of bones in side an armature? I have two hierarchies in my armature, and I would like one to be ordered above the other. I thought it was ordered alphabetically, but that doesn’t seem to be the case.

In case you want the back story…

The reason for the specific order is I’m trying a workaround in my exporter. I’m exporting to THREE.js format and there is a hard bone limit which, with my IK controllers, I’ve exceeded. So I have two separate hierarchies–one for the IK controllers and one for the FK bones that are deforming the mesh and are driven by the IK. The workaround I’m attempting is to export the bones, then remove the IK bones from the exported file. Unfortunately, the IK hierarchy is written to the bone array first, so if I remove those the indices the rest of the bones are looking for are wrong–each bone is looking for its parent based on the array index. So if I remove elements from the beginning of an array, the indices for later items will be incorrect.

However, if the IK rig is appended to the end of the array, I can remove it with (presumably) little trouble.

Any ideas?

Bit confused here, but I’m thinking you have 2 armature objects, one is the ik rig and one is the fk rig, right? You only want to export the fk rig? Think the easiest way to do this would be for your ik rig to have all the bones the fk rig has, then have your separate fk rig object copy to rotations of the bones in the ik rig. Then animate the ik rig, once done, on every key frame for the ik rig, insert visual loc/rot/scale key frames for the fk rig. Yes, it would be tedious, but a python script could do the work for you. Then just export out the fk rig, or delete the ik rig and the fk rig will still function and export it out.

just my thoughts…


I actually have only one Armature object. The THREE.js exporter only supports one Armature, so I had to keep all the IK objects in the same Armature as the FK rig. Actually, I realized I phrased that wrong. I have only one rig, an IK driven rig. All the IK controllers are in their own hierarchy parallel to the controlled bones. I really only want to export the bones that are deforming the mesh (I mistakenly called those the FK bones). The IK controllers are bones that take me over the hard limit so just want to export the transforms on the bones that are deforming the mesh. Hope that makes more sense…

Anyway, that’s not a bad bad workaround, although a bit tedious as you said. I had considered something like that, but I didn’t think about having a completely separate rig. I could probably copy the rig, then run a script to copy the transforms over, delete the IK rig (to adhere to the one Armature limit) and then export. Then undo until I get my working state back.

I have a limited time to finish this project so I don’t know if I will be able to write a script with all the other tasks I need to complete. I’ve never written a Blender script before, but I have a lot of experience in scripting and Python in general. So it’s just a matter of figuring out the workflow.

Thanks for the thoughtful reply, Randy.