As Cg toolkit's already done a script like this I've pretty much got it under control. What I want to add though among some minor fixes is the ability to also swap animation from one side to the other. I say swap instead of mirror, cause I want to copy the animation for both sides and paste them back to the opposite side. This is where I'm stuck. How can i evaluate 2 copyKey commands and then paste them to the opposite sides? Once i copy and paste for one side, the other side which is to be swapped aswell now is identical to the first side, so if you now copy and paste it to the first side you really just get the same animation pasted back.
This is only a idea for a workaround, for you to see where my thoughts go and to comment.
So from left control to right control the procedure could look like this:
I select the range in the timeline which i want to copy keys from, say frames 1-12
I select the right control, shift select the left control.
I execute the swapAnim command.
It copies the keys from the right control and paste them to the left control beginning with frame 13.
Then it copies the keys from the left side in the frame range 1-12 and pastes them back to the right side in the frame range 1-12.
Finally it takes the frame range 13-24 for the left control and cut it and paste it to frame 1, replacing the keys completely.
There are some problems with this approach other than it being very weird =/
What if I have some animation after frame 12 on the left control which I want to keep?
I thought of copying the original controls with keyframes and all and using them to paste from, then just deleting them at the end of the script. In that way I never really lose any of the sides animation. I guess this is simpler approach and perhaps better, but I'm unsure of the hierarchy structure if it will mess something up.
I do think there has to be an easier way and I think you know! =)