Looking for info about app.command.LinkCels

Hey everyone—does anyone have experience using app.command.LinkCels? There’s no currently documentation for it, and looking at the C++ it’s still difficult for me to an idea of what’s going on.

My intended use case is to duplicate and link cel contents across a user-defined number of frames (i.e. executing the Duplicated Linked Cels command across X number of frames). I’m very open to alternate solutions to that end, so long as they don’t involve writing using another program to simply repeat the command (which is what I currently do).

Thanks!

——————————————————————

EDIT / UPDATE

hermetic snack pack in the Discord has sent some useful information my way

t seems that calling app.command.LinkCels() from Lua will Link multiple Cels in the timeline if multiple are currently selected.

For example, with these four Cels selected, calling app.command.LinkCels() would transform this:

CleanShot_2020-12-12_at_03.41.56

Into this:
CleanShot_2020-12-12_at_03.42.48

I reviewed the autogenerated gui.xml doc (aseprite/gui.xml at master · aseprite/aseprite · GitHub) and what I think is the relevant C++ file (aseprite/cmd_link_cels.cpp at c0ac9208ff281c567a22f18d8312915f01337d1d · aseprite/aseprite · GitHub) and it looks like the Lua interface for app.command.LinkCels() does not accept any arguments to allow it to be configured.

I’m pretty new to this code base, however, and could be mistaken there. :slight_smile:
My intended use case is to duplicate and link cel contents across a user-defined number of frames

So, your use case is to have one Cel with data like this, with the remaining Cels in that layer empty:
CleanShot_2020-12-12_at_03.42.13

I don’t see a way to programmatically set multiple Cels as selected, and app.command.LinkCels() seems to operate on whatever Cels are selected.

There’s app.range.cels, but that’s only for getting, not setting.

There’s app.activeCel which “Gets or sets the active Cel object.” but seems to get/set a single Cel, rather than a list/array of Cels.
I might be off, though! Is anyone more familiar with this?

hermetic snack pack went on to respond to PureAsbetos
Here’s some Lua I used to try to set app.range.cels
I used print() for simple debugging purposes.

local LinkCels = function()

    -- print the current value of app.range.cels  
    print(app.range.cels)
    print("-------")

    -- get frames 1–4 on the activeLayer
    -- and add them to a table "cels"
    local cels = {}
    for i=1, 4 do
        print(i)
        local cel = app.activeLayer:cel( i )
        print(cel)
        table.insert(cels, cel)
    end

    -- verify that "cels" is a table and that
    -- it contains 4 elements
    print("-------")
    print(cels)
    print(type(cels))
    print(#cels)

    -- again, print the current value of app.range.cels
    print("-------")
    print(app.range.cels)

    -- attempt to set app.range.cels to our table "cels"
    app.range.cels = cels

    -- print the value of app.range.cels one last time
    print("-------")
    print(app.range.cels)

    app.command.LinkCels()
end

The console output from that is:
CleanShot_2020-12-12_at_15.15.37