How to correct wrong bone-roll without troubles?

while writing the export plugin for my engine and the implementation i noticed that in my model i have a little inconsistency which now bites me in the arse. for the armature i’ve got the rule that each bone should be well-pointing, meaning that if i attach a camera to it that it looks the right way. this means for example that the up vector (z in this case) has to look up and not down.

now some bones in the armature unfortunatly have z pointing down instead of up. giving them all a ‘roll’ of 180 instead of 0 corrects this in the armature-edit view but as i have already animation data around it horribly breaks them if i do so.

now the question is: is there an easy way to give a bone in an armature ‘roll’ 180 instead of 0 and to adjust all animation data to still look the same as before the modification?

or is there a script around that can do this for me?

Select all the IPO’s for that Bone and use the arrows in the IPO window header to “Copy to Buffer”. Delete the curves, Ctrl-A on the bone, click the curve lables in the right-hand column to activate them and paste them back from the buffer.
Probably easier to do it by hitting X (unlink) and then link them again after Ctrl-A but I havn’t tested it.

%<