Skip to content

fix: restore custom bed texture after undo/redo (#11211)#11251

Open
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/11211-undo-restores-bed-texture
Open

fix: restore custom bed texture after undo/redo (#11211)#11251
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:fix/11211-undo-restores-bed-texture

Conversation

@BenJule

@BenJule BenJule commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The custom bed (logo) texture disappears after an undo (#11211).

Root cause: the plate logo texture filename (PartPlate::m_logo_texture_filename) is not part of the undo snapshot — PartPlateList::serialize does not include it and the per-plate serialize is commented out, so when the plates are rebuilt on deserialize the texture filename is lost. update_after_undo_redo() never re-applies it.

Fix: re-apply the bed texture from the config (which is not part of the model undo stack and therefore survives the undo) in update_after_undo_redo() via set_bed_shape(). Its internal guard only re-sets the logo texture filename when the bed shape is unchanged (the common case for a model-level undo), so this is cheap and does not rebuild the bed geometry.

⚠️ I can't build/run locally, so this is untested at runtime — the reasoning is from the code path. A quick check (load a custom bed texture, add/copy an object, undo → texture should remain) would be appreciated.

Fixes #11211

The custom bed (logo) texture filename is not part of the undo snapshot, so
it is lost when the part plates are rebuilt on deserialize — the custom bed
background disappears after an undo. Re-apply it from the config (which is
not part of the model undo stack) in update_after_undo_redo via
set_bed_shape(); when the bed shape itself is unchanged this only re-sets the
logo texture filename, so it is cheap.

Fixes bambulab#11211
@Haidiye00

Copy link
Copy Markdown
Contributor

Hello, could you show the before and after comparison? It can be a picture or a gif, thanks.

@Haidiye00 Haidiye00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello, could you show the before and after comparison? It can be a picture or a gif, thanks.

@BenJule

BenJule commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Here's the before/after (#11211):

Before: set a custom bed (logo) texture, then do any edit and press Undo (or Redo). The custom bed texture disappears and the bed falls back to the default - the logo is gone until you reload the project.

After: the custom bed texture is preserved across undo/redo.

Root cause: the custom bed/logo texture filename isn't part of the undo snapshot (it's not serialized by PartPlateList::serialize), so restoring a snapshot dropped it. The fix re-applies the bed shape (which re-reads bed_custom_texture from config) in update_after_undo_redo, so the logo is restored after each undo/redo.

Repro: load a custom bed texture → move/edit an object → Undo → (before) texture gone / (after) texture stays.

Same caveat as my other GUI PRs: no build environment here, so this is traced from code rather than a recorded GIF. Can add a capture if a maintainer build is handy.

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

Labels

None yet

2 participants