script for calling a layer based on its name

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
User avatar
malcooning
Posts: 2114
Joined: 29 Mar 2006, 12:43
Location: Tel Aviv
Contact:

script for calling a layer based on its name

Post 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)
User avatar
Paul Fierlinger
Posts: 8100
Joined: 03 May 2008, 12:05
Location: Pennsylvania USA
Contact:

Re: script for calling a layer based on its name

Post 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.
Paul
http://www.slocumfilm.com
Desktop PC Win10-Pro -64 bit OS; 32.0 GB RAM
Processor: i7-2600 CPU@3.40GHz
AMD FirePro V7900; Intuos4 Wacom tablet
User avatar
malcooning
Posts: 2114
Joined: 29 Mar 2006, 12:43
Location: Tel Aviv
Contact:

Re: script for calling a layer based on its name

Post 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.
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18
Location: Viborg,Denmark
Contact:

Re: script for calling a layer based on its name

Post 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
Attachments
getLayerWithName.tvpx
(6 KiB) Downloaded 787 times
Mads Juul
Storyboard Artist
blog: http://mjstoryboard.blogspot.dk/
Mail: mjstoryboard@gmail .com

Windows 10, 64 bit i7-4790 CPU 4.00 Hz,32 GB RAM, With TVP Animation 11 Pro (11.0.2-64bits)
2 Monitors 1920X1080 pixels + 1 Wacom Cintiq 21UX 2
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: script for calling a layer based on its name

Post 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:
Attachments
curLayerByNamePanel.png
curLayerByNamePanel.png (2.51 KiB) Viewed 15880 times
curLayerByName.tvpx
(98 KiB) Downloaded 747 times
User avatar
malcooning
Posts: 2114
Joined: 29 Mar 2006, 12:43
Location: Tel Aviv
Contact:

Re: script for calling a layer based on its name

Post 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?
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18
Location: Viborg,Denmark
Contact:

Re: script for calling a layer based on its name

Post 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
Mads Juul
Storyboard Artist
blog: http://mjstoryboard.blogspot.dk/
Mail: mjstoryboard@gmail .com

Windows 10, 64 bit i7-4790 CPU 4.00 Hz,32 GB RAM, With TVP Animation 11 Pro (11.0.2-64bits)
2 Monitors 1920X1080 pixels + 1 Wacom Cintiq 21UX 2
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: script for calling a layer based on its name

Post 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 :
Attachments
George.rar
(591 Bytes) Downloaded 775 times
User avatar
malcooning
Posts: 2114
Joined: 29 Mar 2006, 12:43
Location: Tel Aviv
Contact:

Re: script for calling a layer based on its name

Post 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.
User avatar
Mads Juul
Posts: 3992
Joined: 02 May 2007, 19:18
Location: Viborg,Denmark
Contact:

Re: script for calling a layer based on its name

Post 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
Mads Juul
Storyboard Artist
blog: http://mjstoryboard.blogspot.dk/
Mail: mjstoryboard@gmail .com

Windows 10, 64 bit i7-4790 CPU 4.00 Hz,32 GB RAM, With TVP Animation 11 Pro (11.0.2-64bits)
2 Monitors 1920X1080 pixels + 1 Wacom Cintiq 21UX 2
User avatar
ZigOtto
Posts: 4102
Joined: 17 Feb 2006, 22:50
Location: south-Petazonia

Re: script for calling a layer based on its name

Post 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.
User avatar
malcooning
Posts: 2114
Joined: 29 Mar 2006, 12:43
Location: Tel Aviv
Contact:

Re: script for calling a layer based on its name

Post 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.
Attachments
Character sheet.jpg
Post Reply