Skip to content

Fix terrain alpha map saving - #727

Open
martinnicolas wants to merge 1 commit into
jMonkeyEngine:masterfrom
martinnicolas:fix-terrain-alpha-map-save
Open

martinnicolas wants to merge 1 commit into
jMonkeyEngine:masterfrom
martinnicolas:fix-terrain-alpha-map-save

Conversation

@martinnicolas

Copy link
Copy Markdown

Description

Fixes an issue where terrain alpha maps were not saved when using the Terrain Editor.

The alphaLayersChanged flag was being reset immediately after enqueueing the save operation, causing doSaveAlphaImages() to be skipped when the queued task executed.

Move the flag reset inside the enqueued task, after saving the alpha images and the scene asset.

Related issue

Related to #68.

@jaime-jmebot jaime-jmebot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for this focused fix. Moving the alphaLayersChanged reset into the queued save task addresses the ordering issue directly: the task now checks the flag and writes the alpha images before clearing it, rather than clearing it on the calling thread while the save is still waiting to run. Keeping the reset after saveAsset() also means the change is only marked handled once both parts of the save operation have completed.

I reviewed the surrounding save path and the diff, and the change fits the existing enqueue-based flow without broadening its scope. There are no CI checks reported for this PR, but I don’t see a correctness issue in the change. Looks good to me!

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