Page 1 of 1

GEORGE : Layer selection

Posted: 16 Oct 2016, 14:01
by schwarzgrau
It would be pretty nice, if you could get the information which layers are selected in George. Also it could be pretty handy if you could select multiple layers in it.

Re: GEORGE : Layer selection

Posted: 14 May 2019, 10:23
by Gary
Bumping this request because some tools artists here have requested are entirely impossible without being able to detect multiple selected layers with George.

Re: GEORGE : Layer selection

Posted: 14 May 2019, 10:35
by NathanOtano
Can't you just run on all the layers with tv_layerinfo to check which are selected and put that in a list of variables to interact with? It's less handy that the command you want but such a command would be weird to use. How much variables would you get? How do you code that on your scripts?

Re: GEORGE : Layer selection

Posted: 14 May 2019, 10:59
by Gary
I didn't realise LayerInfo had that info (in fact I didn't realise it could be called on a layer that wasn't the current layer). Thanks for the tip!

I suppose you have a point about how it'd be represented. I forget that George commands can only return simple data structures even though you can make tables/arrays yourself.

Re: GEORGE : Layer selection

Posted: 14 May 2019, 13:05
by NathanOtano
Nice :)

You can also create a function for the whole process in one command :) and share it here hehe

Re: GEORGE : Layer selection

Posted: 14 May 2019, 16:03
by Gary
I have!

I'm sure there's improvements that could be made (like a better way to iterate over layers) but this does the job for me. Here's the function:

Code: Select all

FUNCTION get_selected()
    select_count = 0
    FOR id = 1 to 10000
        tv_LayerInfo id
        PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable selected x
        IF (CMP(selected,'1') == 1)
            select_count = select_count + 1
            selected[select_count] = id
        END
    END
    return selected
END
Also some sample usage:

Code: Select all

get_selected()
selected = result

FOR x = 1 to select_count
    tv_warn "ID"selected[x]
END

Re: GEORGE : Layer selection

Posted: 15 May 2019, 04:09
by Hironori Takagi
The layerselection item in tv_layerinfo is not listed on tvpaintwiki, but it is described in the TVPaint 11 Documentation published last year.

https://www.tvpaint.com/doc/tvpaint-ani ... _layerinfo

Re: GEORGE : Layer selection

Posted: 17 May 2019, 18:22
by NathanOtano
Nice thanks :)