Page 1 of 2
SwitchSlave
Posted: Sat Oct 15, 2005 5:56 pm
by 7feet
Okay, I'm rolling today. There was adiscussion in one of the other sections about controlling one switch layer with another. Sounded like a fine idea, so...
SwitchSlave
Tiny litttle embedded script, that makes one switch layer mimic the switch changes of another.
--Both Switch layers need to be at the same level, i.e. they are both root layers, or both within the same group.
--The sub-layers in both switch layers must have the same names. This is important.
--The Switch layer you want to control must have ".sslv" at the end of the name (make sure it's in lowercase). Thats how the script finds the layer you want to control
--Assign the SwitchSlave script to the master layer (the "Embedded script file" checkbox in the Layer Properties). It'll find the layer you want to be controlled and do it's thing.
--Any old keyframes in the slave layer will be lost. It copy the switches on the master layer exactly, in realtime. Pretty neat, huh?
Have fun.
Posted: Sat Oct 15, 2005 10:13 pm
by ulrik
This little script works like a charm!!!
I even tried and made 5 copies of it, added 1, 2 etc. at the end of the "SwitchSlave"name, opened the scripts in textwrangler and changed the .sslv to ssl1, ssl2 and so on and it made me have several different switch information to slave several different switch layers...nice work 7feet!, and thanks a lot

Posted: Sat Oct 15, 2005 10:44 pm
by 7feet
Glad you dig it. I was actually going to point out that you could change that, but I spaced. For the rest of y'all, open up the script in any old text editor and look for this line -
Code: Select all
if (string.sub(name, -5) == ".sslv") then
It's in there twice, but it's not hard to find, it's really a pretty tiny script. You can change the letters of the extension to any old thing you want. If you wanted to change the extension, say, to "_HeadSlave", the line would be -
Code: Select all
if (string.sub(name, -10) == "_HeadSlave") then
The change to "-10" is because the extension has 10 characters in it. Then save the file and everything is happy.
Now, that might also be a temporary solution. One thing I thought to do is to put the master and slave layer names into a separate file. As an example, you set up something like this:
Code: Select all
master head
slave hair front
slave hair back
slave hair shadow
master bald head
slave cueball reflection
Then you get to both use just one script, and have that script control multiple slave layers. We'll see.
Posted: Tue Oct 18, 2005 9:15 am
by rylleman
Great script Brian!, thank you!
Now, would it be possible to have the script work in sub-levels of the rig hierarchy?
as:
head (master group)
_eyes control (switch layer, the layer to attach the script to)
_HEAD (switch layer)
__*head_1 (bone layer)
____-eyes_head_1 (switch layer)
__*head_2 (bone layer)
____-eyes_head_2 (switch layer)
__*head_2 (bone layer)
____-eyes_head_2 (switch layer)
... (every switch should of course be named properly)
In this example, to have the control script be the master over the eyes swithes inside the different head bone groups?
Posted: Tue Oct 18, 2005 7:27 pm
by Rai López

It seems like another GREAT script by 7feet!!! And it's Embedded!!! YOo-HoOOo!
THANKS! I think I could love it if I'd decide use again Switch Layers in my proyects, althought now that I can do my LipSync works with Actions

I think it's not probable for now... (Jijiji

, I feel SO free now... Ahhh...

) Anyway, thank you very much

, I'm very happy to see how someone
produce and take benefits of this
magic feature called Embedded Scripts!

Posted: Wed Oct 19, 2005 9:29 am
by rylleman
I've come up with a great usage of this script that I have to share. I actually had a similar thing on my list of "scripts that I'm going to write when I get the time and knowledge", but I found out that I can do pretty much the same thing with this script.
The usage I have in mind is to keep track of your switches which, when having a lot of them, can be quite confusing at times.
Create a slave switch-layer in which you create note layers with the same names and note text as the switch you are going to keep track of and assign this script to the master switch.
Now you got a notelayer in view that tells you exactly which switch you got at any given frame!
This has been a great help for me the last couple of days.
Posted: Wed Oct 19, 2005 9:52 am
by jahnocli
I'm intrigued, but I don't quite get it. Could you post a screen shot of the layers palette to show what you mean?
Posted: Wed Oct 19, 2005 10:55 am
by 7feet
rylleman - Well that's not a use I had thought of. Good one. I'll look into your other extension request as soon as I can.
Posted: Wed Oct 19, 2005 8:37 pm
by rylleman
A little bug report for you;
Sometimes I get an error message in the lua console, unable to index local "layer". At line 9.
Nothing happens and everything works as normal after I close the console but it might be something to look into.
Posted: Thu Oct 20, 2005 5:22 pm
by xian
Thank you 7.
This is a great addition to the MOHO toolset.
I appreciate that you saw enough value in the concept to act.
Good Day, Sir.
Posted: Tue Feb 07, 2006 8:23 pm
by Rai López
...Ey! 7feet, How are you?

I'm very interested now in this script cause maybe with some modifications could resolve a lot of problems in my actual line of work... The fist thing that I've tried to change is can turn the script "inactive" when you are inside an Action, you know, to avoid "Action Destruction" (you will remember a similar problem in the first steps of the Bone Control/Master Scripts...) Well, I think there must be a way to make it possible, but I've been basically adding all possible variations of this lines of code with no more than error messages or no changes...
Code: Select all
if (moho.layer:CurrentAction() ~= "") then
return false
return true
end
Do you think this could be possible? A simple instruction to make script be stopped if (moho.layer:CurrentAction() ~= "") is active? I think yes cause is the way all other scripts work and it seems logical to me, but well, this is not a "normal" script and really (in general) I have not idea

...Well, anyway THANK YOU! Starting for have wrote this useful script and for/if any help, CIAO!
EDIT: ...DONE!

(Well, this little part at least...)
Not downloadable
Posted: Sun Mar 12, 2006 6:27 pm
by slowtiger
I tried to download this script, but the host is not connected. Is this temporarily? Is there another place where I could get this? Would someone be so nice and mail it to me? TIA, slowtiger
Posted: Sun Mar 12, 2006 8:23 pm
by 7feet
slowtiger - the place my scripts are is kind of a test site for a web file server, so sometimes it disappears when they do upgrades. Ususally back up shortly, if not I'll track a copy down and shoot it to you.
Site still down...
Posted: Mon Mar 13, 2006 8:01 pm
by jackthegiantkiller
Anywhere else this can be downloaded? Site is still down.
Got it!
Posted: Tue Mar 14, 2006 12:28 am
by jackthegiantkiller
Got it! Site came back up!