Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting app.command.Cut() and app.command.Paste() does not work in --batch mode #4354

Open
jestarray opened this issue Mar 1, 2024 · 1 comment · May be fixed by #4446
Open

Scripting app.command.Cut() and app.command.Paste() does not work in --batch mode #4354

jestarray opened this issue Mar 1, 2024 · 1 comment · May be fixed by #4446
Assignees
Labels
Milestone

Comments

@jestarray
Copy link
Contributor

I'm trying to do a magic wand pixel selection on 1 layer and cut and paste to a new layer.

This is the minimum reproducible version because my real script is more complicated than this.

2024-02-29_22-09-28_c.mp4
local sprite = app.activeSprite
local from_layer = sprite.layers[1]
local frame_num = 1
local from_cel = from_layer:cel(frame_num)

app.useTool {
    tool = "magic_wand",
    layer = from_layer,
    cel = from_cel,
    button = MouseButton.LEFT,
    points = {from_cel.position},
    selection = SelectionMode.REPLACE
}
app.command.Cut()
local to_layer = sprite:newLayer()
app.activeLayer = to_layer
app.activeFrame = to_layer.sprite.frames[1]
app.activeLayer = to_layer
app.command.Paste()

local without_ext = app.fs.filePathAndTitle(app.activeSprite.filename)
app.command.SaveFile {
    ["filename"] = without_ext .. ".ase",
    ["filename-format"] = ".ase",
}

How to reproduce:

Extract folder and open command prompt in directory and run:
one_pixel_paste.zip

aseprite.exe ./one_pixel.png ./test_cut.lua

Aseprite and System version

  • Aseprite version: version number, installer/portable/Steam/beta/dev/commit-hash
    • v1.3 master branch
    • commit: 73fe8099d96479364f92ff6317a5687498d43d36
  • System: Arch Linux
@Gasparoken Gasparoken added this to the v1.3.x milestone Mar 19, 2024
@Gasparoken
Copy link
Member

Thanks for this report @jestarray. I was able to reproduce it.

@dacap dacap modified the milestones: v1.3.x, v1.3.6 Mar 19, 2024
@dacap dacap modified the milestones: v1.3.6, v1.3.7 Apr 9, 2024
@Gasparoken Gasparoken self-assigned this Apr 19, 2024
Gasparoken added a commit to Gasparoken/aseprite that referenced this issue May 2, 2024
Gasparoken pushed a commit to Gasparoken/aseprite that referenced this issue May 3, 2024
Gasparoken added a commit to Gasparoken/aseprite that referenced this issue May 3, 2024
Gasparoken added a commit to Gasparoken/aseprite that referenced this issue May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
3 participants