New Script to reorder FBF layers

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
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

New Script to reorder FBF layers

Post by strider2000 »

In the Frame By Frame discussion
viewtopic.php?f=5&t=27514#p155715
there was discussion on FBF layer naming/numbering, in particular with the fact that in betweens don't have a number "in between" the initial key frames.

I was wanting to learn more about AS scripts and agreed with the thoughts, so I've just added a script, msFBFReorder, that will reorder layers based on the order of their appearance in the timeline. The script is at
http://www.mediafire.com/download/9qef3 ... eorder.lua

It's also at in github at
https://github.com/Strider22/AnimeStudi ... %20Effects
for the programmer types.

- Ordering - The ordering follows the order of initial appearance in the timeline. In other words, if multiple keys reference the same layer the name/number is based on the order first reference in the timeline (I know FBF doesn't typically do this, but standard Switch layers do, and I've used it some in FBF).
- Ordering Direction - The ordering is from bottom to top, because that's the way that FBF naturally adds layers.
- Starts at 0 - The ordering starts at 0, because FBF always puts a key at 0. If you're on 0 and you create a FBF layer, it actually creates a layer, even though their seems to be no key. Then when you press + it will create a layer at whatever your frame spacing is, so you'll already have 2 layers. Since FBF seems to be following the idea of drawing on frame 0, it seemed more in agreement with the frame 0 issue to start layer numbering/naming at 0 rather than 1. It's also helpful to me to know that you can't really move that key (you'll always see a key starting at frame 0). I thought about adding a dialog to allow the user to choose 0 or 1, but thought it was cleaner to allow the renumbering without a dialog popping up.
- Testing - I've tried to test it pretty well. I've used the standard FBF approach (add, delete, duplicate, move), but also deleted, copied, and created keys based on typical switch layer approach. So I think things are working well, but I'd still advise people to save before applying just in case :wink:

Hope you enjoy :D
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: New Script to reorder FBF layers

Post by chucky »

Hey that is just brilliant Strider, I actually have requested this, thinking it was simple for a real programmer but impossible for a dunce like myself.
It works perfectly, though I think it should be called 'OCD alleviation script' :wink:
User avatar
cableon
Posts: 155
Joined: Thu Jan 17, 2008 6:44 pm
Contact:

Re: New Script to reorder FBF layers

Post by cableon »

It does work indeed! :D Awesome work, thanks a lot Strider2000!!
User avatar
strider2000
Posts: 506
Joined: Sat Mar 07, 2015 5:14 pm
Contact:

Re: New Script to reorder FBF layers

Post by strider2000 »

chucky wrote:... I think it should be called 'OCD alleviation script' :wink:
:lol:
I'm glad it's helpful. I love the fact that AS is making strides at better integration of drawing and bones (FBF of course, but drawing in general too). I also love the help that everyone on the forum gives, so I hope this is helpful to others.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: New Script to reorder FBF layers

Post by Víctor Paredes »

Thank you!
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
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Re: New Script to reorder FBF layers

Post by ulrik »

Thanks for sharing! :)
Post Reply