EDIT New script! Hide layers with no animation

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

EDIT New script! Hide layers with no animation

Post by Víctor Paredes »

Hi, I'm working in a character which has lots of point animation in many of its layers, so I'm constantly navigating between the layers to edit them. The issue is having the layers with no animation also visible in the Layers window makes that navigation much harder.

I love the idea of using filters in the layers palette (and use them a lot), but I'm missing a "show animated layers only" filter. So I thought that maybe it would be possible to create a script that automatically put an "animated" tag into all the layers with any key in the mainline, so then I can quickly filter the layers using that tag.
Do you think that is possible?

Thank you very much.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by synthsin75 »

Here you go, Victor.
https://drive.google.com/uc?export=down ... YvpSxvcjsy

It's a menu script. It will add the "animated" tag to any layer with animation and remove the tag if animation has been deleted.
Last edited by synthsin75 on Fri Aug 20, 2021 5:55 pm, edited 1 time in total.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by Víctor Paredes »

Thank you very much, Wes! You are very generous.
This is fantastic and will save me a lot of time in this and future projects. And, of course, I recommend everyone to use it, it really simplifies the layer navigation and correction process.

To install it:
- Go to File -> Open Custom Content Folder
- In the folder, navigate to Moho Pro\scripts\menu\
- Drag the syn_tag_animated.lua into any of that folders, or create a new one (in my case, I put it in a new folder called "Animation")
- Go back to Moho and press Ctrl+Alt+Shift+L (or Cmd+Alt+Shift+L if you are using a Mac) to refresh the scripts

To use it:
- Simply go to the go to the menu Scripts/Animation and select the script. The script will add the "animated" tag to every layer which has animation
- To show only the layers with animation, go to the Layers window and select "Tags Contain..." in the Filter section and write "animated"

Now, if you want to see the whole project keyframes in the Timeline, simply select all that filtered layers.
Maybe this sounds small, but at least for me is a huge help :)

Thanks again!
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by Víctor Paredes »

Oh, Wes, I'm sorry to bother, but noticed the script also adds the tag to the containers (groups, bones, switches, etc), even if they don't have keyframes themselves. Is there any way to avoid that behavior?

Thanks and sorry again.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by synthsin75 »

I've updated the above link. It should only tag keyframed layers now.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by Víctor Paredes »

synthsin75 wrote:I've updated the above link. It should only tag keyframed layers now.
Thank you very much, Wes. It is working perfectly!
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: EDIT New script! Hide layers with no animation

Post by synthsin75 »

Glad I could help, Victor. You're always real good at describing what you need a script to do.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Script request: Tag all layers with keyframes in Mainlin

Post by GaryC »

synthsin75 wrote:I've updated the above link. It should only tag keyframed layers now.
Ah, thanks Wes! I has just made a similar script last week but to get around the problem of tagging non animated layers I had a loop running that checks all the animation channels of a layer. Just using this ClearLayerKeyCount function seems a lot faster, do you know how it works/what exactly it does? I'm guessing it clears the keys and forces a recalculation of the key count, but do you know if there's any side effects that I should be aware of?
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Script request: Tag all layers with keyframes in Mainlin

Post by synthsin75 »

GaryC wrote:
synthsin75 wrote:I've updated the above link. It should only tag keyframed layers now.
Ah, thanks Wes! I has just made a similar script last week but to get around the problem of tagging non animated layers I had a loop running that checks all the animation channels of a layer. Just using this ClearLayerKeyCount function seems a lot faster, do you know how it works/what exactly it does? I'm guessing it clears the keys and forces a recalculation of the key count, but do you know if there's any side effects that I should be aware of?
I wasn't sure what all it did at first, but from my tests, the key count seems to remain the last highest count (even when some are deleted) until cleared...and it recounts them. I didn't find any side effects.
GaryC
Posts: 53
Joined: Tue Feb 03, 2015 1:02 pm

Re: Script request: Tag all layers with keyframes in Mainlin

Post by GaryC »

synthsin75 wrote:I wasn't sure what all it did at first, but from my tests, the key count seems to remain the last highest count (even when some are deleted) until cleared...and it recounts them. I didn't find any side effects.
Sounds good, I implemented it now and seems to be working great. Thanks!
Post Reply