Select A layer with george

A forum dedicated to George scripting questions
Post Reply
User avatar
NathanOtano
Posts: 1202
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Select A layer with george

Post by NathanOtano »

Hey!

Seems stupid but I can't find a command to select a layer with george. Is it possible?

Nathan
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1557
Joined: 28 Dec 2006, 10:08

Re: Select A layer with george

Post by Svengali »

I don't think a Select layer command exists because selecting multiple layers is a manual, interactive operation (Control+Click)... but if you have manually selected multiple layers, when you move up or down from the current layer to a different layer, all selected layers become unselected.

So, why do you want to select a layer with George? For transforms applied to selected layers???

Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
NathanOtano
Posts: 1202
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Select A layer with george

Post by NathanOtano »

Yes here specifically i want to be able to use the "selected layers" option of the transform tool on the current layer if nothing is selected. :) But i would also need it for managing layer selection with george (for exemple selecting all the layers of the same group, or all layers with only one instance). Can have multiple use cases (the same as selecting frames in fact).
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1557
Joined: 28 Dec 2006, 10:08

Re: Select A layer with george

Post by Svengali »

Perhaps you should request a GEORGE command (or the addition of a Select/Unselect parameter to an existing George command) in some form that would permit you to modify the select/unselect state of the current layer, via scripting.

This would permit a number of different scripted solutions to manage selection of layers, for any number of other operations that can be applied to ALL layers or only SELECTED layers, via scripting.

Another possibility might be to modify those operations so they could, optionally, be applied only to VISIBLE layers, since SCRIPTED setting of visibility of layers is already possible.

Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
NathanOtano
Posts: 1202
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Select A layer with george

Post by NathanOtano »

Svengali wrote:Perhaps you should request a GEORGE command (or the addition of a Select/Unselect parameter to an existing George command) in some form that would permit you to modify the select/unselect state of the current layer, via scripting.

This would permit a number of different scripted solutions to manage selection of layers, for any number of other operations that can be applied to ALL layers or only SELECTED layers, via scripting.

Another possibility might be to modify those operations so they could, optionally, be applied only to VISIBLE layers, since SCRIPTED setting of visibility of layers is already possible.

Sven
I'll definitely do that, thanks!
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
User avatar
Mike
Posts: 1050
Joined: 16 Feb 2006, 08:58

Re: Select A layer with george

Post by Mike »

In fact, you can select a group of layers:

Code: Select all

CMDlayercolor "select|unselect" 0...12 /* color group index */
//@return "error": if an error occurs
//@return int: number of layer selected/unselected
TVPaint Team
User avatar
NathanOtano
Posts: 1202
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Select A layer with george

Post by NathanOtano »

That's part of a solution, in fact I've already seen the command, but obviously It's not versatile enough :)

Thanks anyway!
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1557
Joined: 28 Dec 2006, 10:08

Re: Select A layer with george

Post by Svengali »

I think I see an easy way to script the selection of multiple layers using layer colors. I'll post something later today. :wink:

Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Svengali
Posts: 1557
Joined: 28 Dec 2006, 10:08

Re: Select A layer with george

Post by Svengali »

Here's a way to use scripting and color groups to SELECT multiple layers
After which the script restores the original color groups from a temporary array.

The script needs to know which layers to SELECT... so you store 1 and 0 flags in the SelectFlag array.

Code: Select all

TotalLayers = 4									// Your script must set var to total number of layers
SelectFlag(0) = 1								// You script must set array flags so 1 = select and 0 = unselect
SelectFlag(1) = 0
SelectFlag(2) = 1
SelectFlag(3) = 0


FOR i = 0 to TotalLayers - 1					// save original colorgroups and set temporary colorgroups
	tv_LayerGetID i								// get ID for layer
	LayerID = result
	tv_LayerColor GET LayerID					// get original color group for layer
	OrigColor(i) = result						// save original color groups for layers in array 
	tv_LayerColor SET LayerID SelectFlag(i)		// set temp color for layer (1 = select and 0 = deselect)
END
	tv_LayerColor "deselect" 0					// deSelect all layers in temp color group 0
	tv_LayerColor "select" 1					// Select all layers in temp color group 1

FOR i = 0 to TotalLayers - 1					// loop to restore original color groups
	tv_LayerGetID i								// get ID for layer
	LayerID = result
	tv_LayerColor SET LayerID OrigColor(i)		// restore original stored color group for each layer
END


TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
NathanOtano
Posts: 1202
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Select A layer with george

Post by NathanOtano »

Svengali wrote:Here's a way to use scripting and color groups to SELECT multiple layers
After which the script restores the original color groups from a temporary array.

The script needs to know which layers to SELECT... so you store 1 and 0 flags in the SelectFlag array.

Code: Select all

TotalLayers = 4									// Your script must set var to total number of layers
SelectFlag(0) = 1								// You script must set array flags so 1 = select and 0 = unselect
SelectFlag(1) = 0
SelectFlag(2) = 1
SelectFlag(3) = 0


FOR i = 0 to TotalLayers - 1					// save original colorgroups and set temporary colorgroups
	tv_LayerGetID i								// get ID for layer
	LayerID = result
	tv_LayerColor GET LayerID					// get original color group for layer
	OrigColor(i) = result						// save original color groups for layers in array 
	tv_LayerColor SET LayerID SelectFlag(i)		// set temp color for layer (1 = select and 0 = deselect)
END
	tv_LayerColor "deselect" 0					// deSelect all layers in temp color group 0
	tv_LayerColor "select" 1					// Select all layers in temp color group 1

FOR i = 0 to TotalLayers - 1					// loop to restore original color groups
	tv_LayerGetID i								// get ID for layer
	LayerID = result
	tv_LayerColor SET LayerID OrigColor(i)		// restore original stored color group for each layer
END


That's what I was afraid to have to do for such a simple thing haha, thanks a lot! I'll try to do a "select current layer" when work will calm down. Hope this script, despite the number of lines, will be quick enough.

Nathan
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1557
Joined: 28 Dec 2006, 10:08

Re: Select A layer with george

Post by Svengali »

NathanOtano wrote:That's what I was afraid to have to do for such a simple thing haha, thanks a lot! I'll try to do a "select current layer" when work will calm down. Hope this script, despite the number of lines, will be quick enough. Nathan
Yup... most of the script involves preserving then restoring your original color groups so you can temporarily convert all layers into two color groups, (in this case group 0 and group 1). But its a workable kludge until the programmers find time to add a GEORGE command to directly"SELECT/UNSELECT" multiple layers. :?

Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Post Reply