Bone roll alignment

Hi guys
I have a rather usual problem:
I have split an array that was bent along a curve into its parts (separate by lose parts). So I got 28 arms that don’t share the same orientation but by the nature of the apply modifier, they all have the same global rotation That I want to rotate towards the same target. I created an armature as a bone parent (several reasons why I do it this way), which works fine in theory, but the bone roll of the armature is only somewhat pointing towards the target, and it would make my life a … of a lot easier if they pointed exactly along the normals of one of the faces. This way, I’d only have to animate only one axis, which would be great, because much less fumbling and no worries about gimbal stuff. I’m not afraid of scripting, so if a solution you’ve got is cumbersome, please post it anyways.

In short: I want to find out the angle a certain face / faces are pointing (world) and then create a bone roll that would align the bone 90° (orthogonal) to that direction

So set the bone’s roll angle…

Couple of ways to do that, all in edit mode for the armature: 1st way would be with a bone selected, ctrl-n to calculate bone roll angles. Pop up menu gives you options as to what axis to use for auto calculate. 2nd way would be via the transforms panel, under loc/rot/scale is a bone roll angle field, enter an angle there. 3rd way would be via ctrl-R (I think, been a bit since I used this), to adjust the roll angle with the mouse just like you would rotate anything else in blender.

If you have several bones (like it sounds) that you want to adjust, just adjust 1 bone to be correct. With that bone selected, do a ctrl-i to select the inverse, in this case it would be all bones not selected. Then select the only bone not selected, which would be the one with the correct roll angle, ctrl-n -> selected to active option will rotate all bones to match the correct one.

Hope this helps, and I’ll have to remember you’re not afraid of scripting the next time I get stuck…

I’m sorry, if I didn’t express myself correctly, but the roll axis is not global, it is also not dependent on the Armature, or Child’s rotation, I need to align it with the normal of a face, which will be different in each object, since they are in a half circle and all pointing towards the center.

I just found out: C.active_bone.align_roll(vector)
so actually all I need to get is the normal of that face (global, I guess) and pass it on to that function