We have pretty complex character rigs with lots of switch- and sublayers. We therefore spend a lot of time alternating between the parent (bone) layer and the sub/switchlayers.
I was wondering if it's possible to edit the manipulate bone tool script to autoselect the parent bone layer when pressing Z. Is this possible? (When in a sub-layer, the manipulate bone tool is greyed out).
Any hints appreciated!
help: Autoselect parent layer when pressing Z
Moderators: Víctor Paredes, Belgarath, slowtiger
help: Autoselect parent layer when pressing Z
Halvseint, animated talkshow on NRK
www.nrk.no/halvseint
www.nrk.no/halvseint
Perhaps my "Select Parent Layer"-script may be of any help?
viewtopic.php?t=3720&highlight=parent+layer
viewtopic.php?t=3720&highlight=parent+layer
Thanks Rylleman, this is helpful.
Now I need to find out how I can integrate your script with the LM_ManipulateBones script. The problem is that the manipulate bones tool is greyed out when a non-bone layer is selected, therefore the script doesn't seem to run.
Now I need to find out how I can integrate your script with the LM_ManipulateBones script. The problem is that the manipulate bones tool is greyed out when a non-bone layer is selected, therefore the script doesn't seem to run.
Halvseint, animated talkshow on NRK
www.nrk.no/halvseint
www.nrk.no/halvseint
I think the only reason that tool is "grayed out" is because its script tells it so.
What you might be able to do is to modify that tool script so it is available on any layer, then when it is selected you would check the type of layer that is active and THEN run the "select parent layer" script.
-vern
What you might be able to do is to modify that tool script so it is available on any layer, then when it is selected you would check the type of layer that is active and THEN run the "select parent layer" script.
-vern
Thanks heyvern,
I'm getting slightly closer
Right now I'm trying to mod the script to move down in the layer window. I think this is more valuable for us, adding shortcuts to move up and down in the layer window, selecting next/previous layer. But I'm having trouble with
moho:SetSelLayer()
Is there an (easy) way of setting the next layer active?
How do you know what the next layer object is? moho.layer is the current layer object, and moho.layer:Parent() is the parent. What about the child?
I'm getting slightly closer
Right now I'm trying to mod the script to move down in the layer window. I think this is more valuable for us, adding shortcuts to move up and down in the layer window, selecting next/previous layer. But I'm having trouble with
moho:SetSelLayer()
Is there an (easy) way of setting the next layer active?
How do you know what the next layer object is? moho.layer is the current layer object, and moho.layer:Parent() is the parent. What about the child?
Halvseint, animated talkshow on NRK
www.nrk.no/halvseint
www.nrk.no/halvseint
Yikes... it's kind of complicated I think. I haven't really put much thought into how to do this so take this with a grain of salt. I will point you in the right direction in the reference but you will need to do the hard stuff on your own.
The reason I think it is complicated is because... each type of layer is handled differently. When you select a layer inside a group layer than you have to change the way you pick the layers in the script.
You need to look in the reference under a couple of different spots. GroupLayer
MohoDoc
MohoLayer
ScriptInterface
All of these entries in the reference have info about layers.
What you need for setting the setSelLayer is referenced under the MohoDoc. You need to get a layer object first:
"MohoLayer" is what you "get" when you use this. It is the MohoLayer that is the object you need to use setSelLayer().
You need this object in order to change the selected layer. You need to get the layer ID of the next or previous layers in that group.
So you would need to do something like this:
Then go to the first layer in that group layer. 0 is the lowest layer. So you could get the "first" layer by using:
layerCount -1 would be the first layer of the group (at the top in the layers palette). The layer count is the total but the ID starts at 0... so... -1 gives the correct layer object ID.
You could do this:
Once you get to that layer then everything changes because now you aren't on the "group" layer, you are on a layer inside it. Your script would need to account for being on a child layer. You would need to count the layers of the parent group and figure out which one is next.
I think some of this is close, but I haven't really done a lot of tool scripts. I work more with layer scripts which are a bit different. I hope I don't steer you in the wrong direction.
-vern
The reason I think it is complicated is because... each type of layer is handled differently. When you select a layer inside a group layer than you have to change the way you pick the layers in the script.
You need to look in the reference under a couple of different spots. GroupLayer
MohoDoc
MohoLayer
ScriptInterface
All of these entries in the reference have info about layers.
What you need for setting the setSelLayer is referenced under the MohoDoc. You need to get a layer object first:
Code: Select all
MohoLayer Layer(id)
You need this object in order to change the selected layer. You need to get the layer ID of the next or previous layers in that group.
So you would need to do something like this:
Code: Select all
local group = moho:LayerAsGroup(layer)
Code: Select all
local layer = moho.layer
local layerCount = group:CountLayers()
You could do this:
Code: Select all
moho:SetSelLayer(group:Layer(layerCount-1))
I think some of this is close, but I haven't really done a lot of tool scripts. I work more with layer scripts which are a bit different. I hope I don't steer you in the wrong direction.
-vern