new tool: Set Parent Switch value

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
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

new tool: Set Parent Switch value

Post by rylleman »

Here's another one of my small but useful (I hope) scripts.

http://www.rylanderanimation.se/moho/DR ... switch.zip

This one works as a button that when pressed sets a switch-keyframe corresponding to the current layer in the current layers parent switch layer.
(A lot of layers in that description but there's really just two, parent and child.)

It's a bit faster than browsing the switches and when you've found what you're looking for, remembering the name of that layer, go to the parent and select that layer name from the drop-down list. Now just press the button and you automatically has the switch keyframe set to the layer you want.

Installation: Download and unzip in your >scripts>tool folder.

Then open _tool_list.txt located in the tool folder.

I suggest installing this script into the "Layer" section of the tool-palette. To do this add the following line under that section in the _tool_list.txt;

Code: Select all

button   DR_set_parentswitch   K
(K is the hotkey, you can set this to whatever key you want, J, K, O and Y is by default not mapped to any tool).
Save _tool_list.txt and refresh Moho (ctrl+F5).
(If you don't want this tool in the layers section just add the line to the end of the file _tool_list.txt and it will be displayed in the bottom of the "Other" section.)

You can find this and my other scripts at http://www.rylanderanimation.se/moho.htm.
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Jag tackar för den! det gör det lite smidigare
muuvist
Posts: 54
Joined: Tue Dec 05, 2006 9:24 pm
Location: Australia

Post by muuvist »

Thanks rylleman.
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Post by mkelley »

I'm not trying to look a gift horse here, but I really don't understand the point of this (probably just too early in the morning for me).

Let's say I have 30 or so hand layers in my switch parent right hand (as I do) -- in order to get the one I want I right-click the parent and choose it from the list. I need to do this because I have to see the one I want (out of 30 it's impossible for me to remember which is which). Just the act of choosing will set the key on the timeline -- why is it I need some additional tool to do this?

Indeed, you can't select a child layer in a switch without setting a key automatically -- but, like I say, I must be missing something this morning. Can you walk me through, using my example of hand layers, exactly how your tool will help?
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

mkelley wrote:... Can you walk me through, using my example of hand layers, exactly how your tool will help?
Yep, absolutely.
In your example you have to click the switch layer, get the list, select a child. If that was not right you have to open the list again, find the next one and click that to see it.

With my script you can have your switch-structure open in the layers-menu and browse through it by clicking the layers and when you find the one you want you can just hit the button and the parent-switch gets a key.

I myself use to have quite complex setups with switch-layers nested inside switch-layers where I browse through my work-layers via the layers-palette. Having to find and select the parent and then changing to the switch I want through that and then going back to working with the layers is to me time consuming and a bit frustrating.

This script is just one a few ones I've written that I find ease the work with switch-layers a bit. The others are "select parent layer" (viewtopic.php?t=3720&highlight=) and "select active child-layer" (viewtopic.php?t=11718).

edit -addeed link.
Last edited by rylleman on Tue Jul 29, 2008 8:49 pm, edited 1 time in total.
User avatar
mkelley
Posts: 1647
Joined: Fri Nov 02, 2007 5:29 pm
Location: Sunny Florida
Contact:

Post by mkelley »

Ah, I see -- sorry for my dullness (like I said, just too early this morning).

It won't work for me, because the layers I would need to use it on are insanely dense (like I said, 30 layers of hands for each hand) and keeping that many layers open and trying to scroll down to see them... just ain't gonna happen. The scrolling back and forth alone would kill me. Just as easy for me to right-click and select and, if not right, try again (luckily my names are pretty descriptive, but I have thought of using a visual "cheat sheet" alongside the monitor -- might be the time to get off my butt and do this).

For my other layers (like Brows, where I have 10 or 12) the names alone are simple enough to remind me what I want. But I'm sure this helps others and it's very nice of you to share.

For me the most useful script I've written is so esoteric I doubt whether it would be worth putting out there -- I use the Shuttle Pro to animate in AS (absolutely amazing productivity) and with one keypress I can set a key on any type layer in all categories (so, in bones it sets all rotation, position and translation keys). When I use it with the shuttle I *never* take my right hand off the mouse and am lightning fast in animation.
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

mkelley wrote:Ah, I see -- sorry for my dullness (like I said, just too early this morning).
No problemo.
mkelley wrote: I use the Shuttle Pro to animate in AS (absolutely amazing productivity)...
Oh!, I have been drooling for one of these for ages now, I have to get one! Just wondering how well they work under linux.
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

It could be cool the script can search recursively to all the parents and set a switch keyframe if needed, to all the switch like parent layers. This would save you more work even...
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

Genete wrote:It could be cool the script can search recursively to all the parents and set a switch keyframe if needed, to all the switch like parent layers. This would save you more work even...
Not sure I follow you here.
Do you mean that if you set a keyframe in Switch-layer C which is nested under switch-layer B, layer B gets a key for switch C, and layer A in which layer B is nested gets a key for layer B?
Could be done I think, but perhaps it will get confusing for the user if you suddenly has gotten keys higher up in the hierarchy that you didn't expect or think of.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Holy cow!

Can I look at your code for use with my "bone" switcher? This might be a cool option. No need to keep the layers open. Just have a set of bones in the same hierarchy as the switch layers that key the switches when nudged or rotated a certain distance.

Would only be useful for use with bones but I assume having hands, and heads etc in switches would mean the user is using a bone layer.

-vern
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

heyvern wrote:Holy cow!

Can I look at your code for use with my "bone" switcher?...
Thank you and of course you can!
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

rylleman wrote:
Genete wrote:It could be cool the script can search recursively to all the parents and set a switch keyframe if needed, to all the switch like parent layers. This would save you more work even...
Not sure I follow you here.
Do you mean that if you set a keyframe in Switch-layer C which is nested under switch-layer B, layer B gets a key for switch C, and layer A in which layer B is nested gets a key for layer B?
Could be done I think, but perhaps it will get confusing for the user if you suddenly has gotten keys higher up in the hierarchy that you didn't expect or think of.
Yes that's what I though. But also a user can be confused if he uses your script under a non active switch layer that is child of another switch layer. It would produce a keyframe but it would be never shown: The switch layer itself is not active.

SL1
SLa
VLa1 (want to switch to)
VLa2
SSb (active)
VLb1
VLb2 (active)

In some situations VL1 and VL2 can have same names (lip syncing) or the number of layers is so large and you want to change from a vector layer in a switch layer to another vector layer in other switch layer. To do that without the script you need to create as many keyframes as needed by the amount of nesting. Also a keyframe in a switch layer selecting the same child one wouldn't produce any negative effect.

-G
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

Genete wrote:...
In some situations VL1 and VL2 can have same names (lip syncing) or the number of layers is so large and you want to change from a vector layer in a switch layer to another vector layer in other switch layer. To do that without the script you need to create as many keyframes as needed by the amount of nesting. Also a keyframe in a switch layer selecting the same child one wouldn't produce any negative effect.

-G
I guess you're right, I'll see if I can modify the script. It might be useful to have it that way.
Post Reply