Skip to content

Fix unstable batch exports on larger processes#40

Open
JusticeShultz wants to merge 2 commits intocpetry:gh-pagesfrom
JusticeShultz:gh-pages
Open

Fix unstable batch exports on larger processes#40
JusticeShultz wants to merge 2 commits intocpetry:gh-pagesfrom
JusticeShultz:gh-pages

Conversation

@JusticeShultz
Copy link

Batch mode was not reliably exporting all selected files. The download path fired multiple async saves without actually waiting for completion, so browsers would only allow some of the downloads through. The render pipeline was also creating new WebGL render targets during repeated batch processing without disposing old ones, which made larger batches increasingly unstable.

This PR:

  • makes batch downloads run sequentially
  • improves file detection for image uploads, including TGA by extension
  • disposes old WebGL render targets during regeneration to keep batch processing stable

@cpetry
Copy link
Owner

cpetry commented Mar 15, 2026

Overall it looks fine and I really appreciate your contribution!

In your PR you created disposeRenderTarget() for ambient, displace and specular classes.
Why not create disposeRenderTarget() method in a 'common' class (or new one) and use it for every map?
Is there a reason to create separate ones?

I see a few other refactorings. The downloadImage() method in your PR returns a Promise. Why not using async function()? Also you refactored isSupportedImageFile() and isTargaFile(). Could you please do this as a separate PR to keep changes to the issue you are referring to in your PR?

I'll approve once you updated

@JusticeShultz
Copy link
Author

@cpetry
Pushed an update addressing your feedback.

Changes made:

  • moved render target cleanup into a shared helper (renderTargetUtils.js) and reused it for the affected map generators instead of keeping separate disposeRenderTarget() methods
  • changed downloadImage() to an async function and only wrapped the callback-based blob creation where needed
  • removed the isSupportedImageFile() / isTargaFile() refactor from this PR so it stays scoped to the batch export issue

The PR should now only contain the batching fix and the related render target cleanup needed for stability. If you'd like, I can open the TGA/file handling cleanup as a separate PR.

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.

2 participants