SwitchSlave
Moderators: Víctor Paredes, Belgarath, slowtiger
SwitchSlave
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.
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.
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
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

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 -
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 -
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:
Then you get to both use just one script, and have that script control multiple slave layers. We'll see.
Code: Select all
if (string.sub(name, -5) == ".sslv") then
Code: Select all
if (string.sub(name, -10) == "_HeadSlave") then
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
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?
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?






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.
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.
...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...
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...)

Code: Select all
if (moho.layer:CurrentAction() ~= "") then
return false
return true
end

EDIT: ...DONE!

Not downloadable
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
- jackthegiantkiller
- Posts: 9
- Joined: Mon Mar 13, 2006 7:58 pm
Site still down...
Anywhere else this can be downloaded? Site is still down.
- jackthegiantkiller
- Posts: 9
- Joined: Mon Mar 13, 2006 7:58 pm
Got it!
Got it! Site came back up!