Script for correcting Z-Axis

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
Noisefever
Posts: 45
Joined: Fri Jan 09, 2015 9:50 am
Location: Stuttgart / Germany
Contact:

Script for correcting Z-Axis

Post by Noisefever »

Hi!

It happens that I draw and animate a scene to the end before I animate the camera. And then I realise there are layers that are on another Z-axis as they should.
Now I have to correct EVERY keyframe. Thats very frustrating and kills much of the fun with animating.

Has someone a script that is able to correct the Z-Axis to zero or a given value without destroying the size and position of the objects in the selected layers?

Thank you!
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Script for correcting Z-Axis

Post by Greenlaw »

I don't if this is what you're looking for but if you enable Relative Keyframe, you can move all the keys for a layer at once. I've only used it for X- and Y-axis but think this should work with the Z-axis too.

To use it, make sure Relative Keyframing is enabled. Then select all the keys (i.e., click on the layer channel name,). Now, when you move the artwork, all the keyframes will follow it relatively.

FYI, if you've never done this before, it might look confusing because the keys don't move immediately--it's only after you release the mouse button that you will see the other keys will snap to their new relative location. Also, you may want to be on an existing keyframe when you move the artwork.

Edit 1: I just now tried this with Z position on a layer with multiple keyframes and it seems to work fine--all z-keys moved the same distance together.

Edit 2: I'm not sure this works for the camera though. Edit 2a: Did a quick check and, unless I'm missing something, it doesn't appear to.
Last edited by Greenlaw on Tue Apr 19, 2016 8:11 pm, edited 1 time in total.
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Script for correcting Z-Axis

Post by Greenlaw »

Here's the official video that shows how Relative Keyframing works:



Scrub to around 3:30 or so. You'll still have to do this one layer at a time but it should be a lot less work than editing all keyframes for every layer individually.

G.
Noisefever
Posts: 45
Joined: Fri Jan 09, 2015 9:50 am
Location: Stuttgart / Germany
Contact:

Re: Script for correcting Z-Axis

Post by Noisefever »

That sounds very promising, I will try that. Thank you VERY much! I have overseen this relative keyframing completely. So, thank you even for that alone!
Noisefever
Posts: 45
Joined: Fri Jan 09, 2015 9:50 am
Location: Stuttgart / Germany
Contact:

Re: Script for correcting Z-Axis

Post by Noisefever »

It worked! Again: thank you very very much! :)
User avatar
Greenlaw
Posts: 9191
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Script for correcting Z-Axis

Post by Greenlaw »

Great! I'm glad the worked out for you.
Post Reply