Skip to content

Utilise transactions to keep preserve history#28

Open
phantomeye1931 wants to merge 1 commit intoPKGaspi:mainfrom
phantomeye1931:main
Open

Utilise transactions to keep preserve history#28
phantomeye1931 wants to merge 1 commit intoPKGaspi:mainfrom
phantomeye1931:main

Conversation

@phantomeye1931
Copy link
Copy Markdown

Thanks so much for publishing this script. It has made it really easy to keep my textures organised in 1 file and export them all at once. However, every time I would use it, it would fuck up my entire undo history. This PR is to resolve that.

In all 3 scripts, I utilised a transaction that bundles all edits together, and undoes them at the end. That way, the user's edit history is preserved, and it's restored to the state it was before running the script. This way, you can quickly go back and revert changes made before the export, without having to sit through hundreds of crops.

Before After

The diffs show a lot of changed lines, but in reality I only added such wrappers:

-- Finally, perform everything, maintaining 1 transaction
app.transaction("Export Slices", function()
  -- ...
end)
-- Undo the transaction to revert history to before exporting
app.undo() 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant