Detecting if a specific Layer is Selected (bug?)

A forum dedicated to George scripting questions
Post Reply
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Detecting if a specific Layer is Selected (bug?)

Post by Svengali »

I'm trying to detect whether a given layer is "selected" or "notselected".

It looks like tv_LayerInfo is the correct command:
tv_LayerInfo

tv_LayerInfo id

Gives 10 informations about the layer with identifier id. This information includes the display, position, opacity, name, type, start, end, pre-lighttable, post-lighttable and selection. The display value indicates if the layer is displayed (ON) or masked (OFF). The position value is the position of the layer in the list (the first layer is at position 0). The opacity value indicates the global opacity of the layer (between 0 and 100). The name value contains the layer name. The type value indicates if the layer is an animation layer (SEQUENCE), an image layer (IMAGE) or a read only layer (VIDEO). The start and end values defined the first and last frame numbers on the global time-line. The pre and post lighttable values indicates if the light tablet is inactive (0) or active (non-zero value, max 7) for this layer. The selection value is 0 if the layer is not selected or 1 if selected.
However, parsing the result displays the Selection value as "OFF", not as a value of 0 or 1... and the value is always "OFF" no matter if the layer is selected or not. Can anyone confirm?

Sven
User avatar
Hervé
Site Admin
Posts: 3490
Joined: 08 Feb 2006, 17:00
Location: Metz France
Contact:

Re: Detecting if a specific Layer is Selected (bug?)

Post by Hervé »

The selection flag is alway true if the layer is the current layer.The result is valid for other layers.
Hervé ADAM, TVPaint Team
Svengali
Posts: 1553
Joined: 28 Dec 2006, 10:08

Re: Detecting if a specific Layer is Selected (bug?) Not a bug

Post by Svengali »

Thanks Hervé, I think I asked the wrong question but you gave me the right answer. :D

Sven
jokinb
Posts: 7
Joined: 18 Aug 2009, 07:13

Re: Detecting if a specific Layer is Selected (bug?)

Post by jokinb »

To detect whether a given layer is "the current layer" or not (the white layer in the time line), we must use :
tv_LayerCurrentID.
It return the ID of the current layer.

To detect whether a given layer is "a selected layer" (the layer with a yelow rectangule) we must use:
tv_LayerInfo ID
parse result display pos opac name type start end prelight postlight sel unlock stencil

If sel == 1 then it is selected.

It remains internally selected until we selects another layer.

Jokinb
Post Reply