LK_SwitchMarkers (Show switch sub-layer names on timeline)

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

Here's a layerscript you can embed on a switchlayer. It will show markers on that layer so you can read the names and don't have to rely on only the color labels. It also shows the interpolation so you can easily tell the difference between holds and tweens if you enable 'Interpolate sub-layers' on the switch and choose to use step keys for holds.

Image

Scripted in response to teotoon's question in the 'How Do I...?' section:
teotoon wrote: Sun Jul 18, 2021 8:13 pmIs it possible to make appear the individual switch layers' names on the timeline?
Let me know if it's useful for you and if you encounter any bugs or problems.
Last edited by Lukas on Sun Aug 22, 2021 10:23 am, edited 9 times in total.
User avatar
DK
Posts: 2854
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by DK »

Hi Lukas. What a brilliant idea for a script! Unfortunately I only got lua Console errors.
Image
EDIT: Now working beautifully :)
Cheers
D.K
Last edited by DK on Mon Jul 19, 2021 9:48 am, edited 3 times in total.
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

DK wrote: Mon Jul 19, 2021 9:29 amHi Lukas. What a brilliant idea for a script! Unfortunately I only got lua Console errors.
Oops... Thank you! Not the first time I forgot to include the table.contains function. Fixed it and re-uploaded.
User avatar
DK
Posts: 2854
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by DK »

Updated the previous Lua Error image. Your script works great Lukas!
Thank you so much. Any display timeline display info is very handy for
work flow.
Cheers
D.K
User avatar
DK
Posts: 2854
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by DK »

EDIT: Oh wait...it's all working fine. Thanks Lucas very handy!
Cheers
D.K
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

DK wrote: Mon Jul 19, 2021 9:51 amEDIT: Oh wait...it's all working fine.
Great! 😎
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

Updated the script, it now handles cycles better.
User avatar
synthsin75
Posts: 9972
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by synthsin75 »

Exactly what I thought of doing when teotoon asked for it. You beat me to it.
teotoon
Posts: 135
Joined: Wed Aug 04, 2004 7:19 am
Location: Turkey

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by teotoon »

What a wonderful solution Lukas ! Thanks a million. It will be very helpful in lip-syncing.

What a great software and what a great community!

Cheers
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

teotoon wrote: Mon Jul 19, 2021 6:22 pm What a wonderful solution Lukas ! Thanks a million. It will be very helpful in lip-syncing.

What a great software and what a great community!

Cheers
You're welcome. I find it very useful myself too, so thanks for sparking the idea.

- I've updated the script to work with ASP v11.
- It also now considers switchkeys that are smooth/linear but tween to the same layer as holds and represents them as holds.
- It also colors plain uncolored layers and cycles red, because plain marker labels can't stretch all the way to the next key. (Red is chosen to play nice with some of my other scripts) you can change these values at the top of the script if you prefer.

Download link is the same.
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by SimplSam »

Looks like there may be an issue when there is no 'active child' and the Switch defaults to the topmost child-layer.

i.e. This defaulting can happen when you create a new Switch Layer from existing group of layers - and it does not set an active child layer. Or if you delete a used child-layer and the Switch still refers to it.

At the moment it will show errors for this: Line 46 - Attempt to index a nil value.

--

p.s. It errors at Line 61 in the latest version of the script.

I also used your Embedded Layer Script tool to manage this, and it is working quite well.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

SimplSam wrote: Thu Jul 22, 2021 6:20 pmLooks like there may be an issue when there is no 'active child' and the Switch defaults to the topmost child-layer.

i.e. This defaulting can happen when you create a new Switch Layer from existing group of layers - and it does not set an active child layer. Or if you delete a used child-layer and the Switch still refers to it.
I updated the script. I think it catches all those invalid keys now, but please let me know if it works.
SimplSam wrote: Thu Jul 22, 2021 6:20 pmI also used your Embedded Layer Script tool to manage this, and it is working quite well.
Nice 🙂
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

Image

The script would get stuck in an endless loop when a switch key would try to cycle backwards to an absolute frame value in the future. Fixed it and re-uploaded.
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by gilcartunista »

Hi Lukas...Thank you! For your enormous generosity! Now the names appear wonderfully in my version 11!!! Grateful.
Just a suggestion... this is very useful for the bones, it would be nice to have it there too...Thank you.
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: LK_SwitchMarkers (Show switch sub-layer names on timeline)

Post by Lukas »

gilcartunista wrote: Fri Jul 23, 2021 1:31 pm Hi Lukas...Thank you! For your enormous generosity! Now the names appear wonderfully in my version 11!!! Grateful.
No problem :)
gilcartunista wrote: Fri Jul 23, 2021 1:31 pmJust a suggestion... this is very useful for the bones, it would be nice to have it there too...Thank you.
Could you elaborate how you would want to use this on a bone layer? I see some possibilities, but I'm not sure how it would be useful, because a single bone layer can contain many bones that all are keyed in a different way. It has many more dimension than a simple switch, so I'm not sure if its worth getting into.
Post Reply