Page 1 of 1

script for calling a layer based on its name

Posted: 07 Sep 2008, 13:30
by malcooning
I'm currently working on a certain project that uses many layers. As well, I have a toolbar with preset tools that I constantly access. Every time I select a tool, I select a different layer that is associated with that tool (because I need to keep the elements on separate layers). As I go between the different layers and their associated tools, I find myself spending alot of time and energy in searching for the particular needed layer in the tower of layers.

is there a script line that can call a particular layer based on the layer name? (in this way, I could just add the line to each of my tools in the toolbar, which will select the corresponding layer whenever I select the tool)

Re: script for calling a layer based on its name

Posted: 07 Sep 2008, 13:44
by Paul Fierlinger
Mark, aka lemec, (and I, come to think of it) once started a mini layers tree script. This was way back at the beginning of Mirage. It almost worked but wasn't quite bug free. Maybe Mark could post it here again and see if it would be worth further development (I think it would and should be considered as a new feature even). With this little gadget you could hide the entire layer panel and do all the navigating through this mini version which really took up very little space.

Re: script for calling a layer based on its name

Posted: 07 Sep 2008, 14:09
by malcooning
I remember that mini layers tree. Functioned like a pop-up, if I recall well.
But if I get your description right, it doesn't solve my need. I'm worried less about space, and more about running up and down the layers column and clicking many times. what I need is something to select a particular layer when I click a custom button.
only one click > to select the tool + the corresponding layer.

Re: script for calling a layer based on its name

Posted: 12 Sep 2008, 05:03
by Mads Juul
Helps this action?

its 2 line you alter the first one to input the name of the layer(default its outline)
and then it should select the first layr with that name

-mads

Re: script for calling a layer based on its name

Posted: 12 Sep 2008, 14:22
by ZigOtto
script tested, and it works like a charm...
thanks Mads ! :)

to avoid to have to edit the custom button when we want to set a new Layer name,
I've added a basic "Set Layer Name" button (using a tv_ReqString command),
here's the tvpx file.

a pity the layers window doesn't auto-scroll (Up/Down) to the new current layer
when this one is outside of the visibility area in the timeline panel .

:wink:

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 12:43
by malcooning
Mads, thanks a lot. it's a good short script. It will save me quite a lot of time.

Zig, your tvpx file doesn't install any of your george files. The only one I can see is the one from Mads. can you upload the grg files only please?

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 12:48
by Mads Juul
malcooning wrote:Mads, thanks a lot. it's a good short script. It will save me quite a lot of time.
Cool :D mads

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 13:13
by ZigOtto
malcooning wrote:Zig, your tvpx file doesn't install any of your george files. The only one I can see is the one from Mads. can you upload the grg files only please?
weird ... again some troubles with sharing tvpx between different computers ...
anyway, here's the 2 george files :

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 13:29
by malcooning
ZigOtto wrote:weird ... again some troubles with sharing tvpx between different computers
yes, it seems this interface needs to be improved promptly.

thanks for the files.
now, I seem to make it work for one button, but when I try to use it on a few different button (each calls a different layer) I fail to understand how to make it work. do you mind writing a short step-by-step please?

cheers.

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 14:05
by Mads Juul
its the problem with zigotto approach that it only works with one button,
and because one cant detect through scripting witch action button is pressed you have to use my approach.
Isnt that true Zig?

-mads

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 16:37
by ZigOtto
exactly,
if you want to store several buttons, each one dedicated to one specific layer name,
the original Mads button (with 2 commands embeded) is the way to go.
My approach was a bit different, you can use the same button to call the same layer at any times,
and you change the target (setlayername button) to point a different (new) layer.

guessing your own need, I think you should stay stuck with Mads approach,
duplicate the button, edit the first command, and save it with a new name (the new layer's name),
make as many buttons as needed.

Re: script for calling a layer based on its name

Posted: 15 Sep 2008, 18:57
by malcooning
i'm glad to see my understanding of the scripts was not falling far from their logics :)
i've added Mads's script + layer calling line to my existing button, and it sure is an improvement in workflow.
just for reference, what I'm doing is I'm illustrating a children books of +40 pages. almost in each double-page spread the main 2 characters are showing. I'm drawing the characters on separate dedicated project (see attachment), and then I place them in the main illustration. This allows me to have each part of a character on a dedicated layer, which saves me having all the layers of the character included into the main illustration, which itself has many layers. so I have a custom panel with different tools to draw the different parts of the character (a panel for each character), and the script allows me to select the corresponding layer when I select the tool.