Page 1 of 1

How to create a tool that selects a specific layer?

Posted: 21 Jul 2015, 15:01
by Farrow
Hi, I was hoping there may be a way to create a tool that automatically selects a specific layer. For example if I have a black pen size 1.60 in a custom panel, is it possible that whenever I select that tool it could automatically take me to a specific layer, for example named "sketch"?

Something like Layer: Select "Sketch" Layer, if you know what I mean? :|

Re: How to create a tool that selects a specific layer?

Posted: 27 Jul 2015, 14:04
by Thierry
Hello Farrow,

Yes it is possible :)
Here is a custom panel that does it. It contains a custom panel, with a black Pen Brush, with size 1.60, and it select a layer named "Sketch". If no layer named "Sketch" is found, then it display a warning.
Select-Sketch-Layer.tvpx
(56 KiB) Downloaded 908 times
And the George code :

Code: Select all

loop=1
i=0
found=0
tv_layerCurrentID
current=RESULT

WHILE (loop)
	tv_LayerGetID i
	curLID = result
	IF (CMP(curLID,"none")==0)
		tv_layerSet curLID
	
        tv_LayerInfo
        PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection

        IF (CMP(layerName,"sketch")==1)
        	found=1
        	loop=0
        END
	ELSE
		loop=0
	END
	i=i+1
END

IF (found==0)
	tv_layerSet current
	tv_warn "Layer sketch not found !"
END

Re: How to create a tool that selects a specific layer?

Posted: 28 Jul 2015, 09:04
by ZigOtto
thanks Thierry, cool script and button freely configurable,
for the layer's name, as for the tool's type and settings 8)
(just to mention it, a little mis-typing in your panel's name :
"select-sketcg", a "h" in place of the "g" would suit better)

Re: How to create a tool that selects a specific layer?

Posted: 28 Jul 2015, 09:06
by Thierry
ZigOtto wrote:(just to mention it, a little mis-typing in your panel's name : "select-sketcg", a "h" in place of the "g" would suit better)
Woops, fixed 8)

Re: How to create a tool that selects a specific layer?

Posted: 28 Jul 2015, 09:24
by ZigOtto
ultra-fast service ! 8)

a last note about this handy tool :
if you have several layers with the same "sketch" name,
the script will select always the upper one.