PDA

View Full Version : problem with a mirror animation script


Geuse
12-22-2009, 10:58 AM
Hey, I've been writing an animation script which will let you copy or swap animation from one side to the other.
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! =)

uiron
12-22-2009, 01:26 PM
if you had two glasses of different wine, and you wanted to swap the wine in them, i guess you'd start looking for a third glass!

Geuse
12-22-2009, 08:19 PM
Hm...an enigma wrapped in a riddle! =)
No, I get your point, but due to the nature of the copyKey command, you obviously can't evaluate two and use the pasteKey command to evaluate twice. So yeah, I've come to that conclusion aswell. So the third wineglass would be that I copy the control object with keyframes to have something to copy from once the first copyKey command has been pasted and replaced the original control object's keyframes. This ought to work fine, but if you have a different opinion or take on the problem, I'd be glad to hear it.
Thanks!

CGTalk Moderation
12-22-2009, 08:19 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.