mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +00:00
A painted relief did not survive closing the project: nothing about the feature was written to the .3mf, so the layers, their textures and the paint mask were all lost on save. The layer struct's cereal save()/load() serve the undo/redo stack only, which is one session and one binary stream. Write the layer stack and the per-volume options as JSON in the archive, and each layer's texture as the image file it was loaded from, both referenced by path - the same split EmbossShape already makes for its SVG. The image stays out of the XML deliberately: it is binary and routinely megabytes, and base64 in an attribute would bloat the one file every reader parses just to list the objects. JSON rather than the cereal stream next to it because that one is positional and unversioned, which would make every future field a project-breaking change; an unknown key is ignored and a missing one keeps its default, so a project written by either side keeps loading. The paint masks go in as one attribute per layer slot, mirroring paint_color. Older readers ignore attributes they do not know, so a project written here still opens in a build without the feature - it loses the relief, which is all it could have done with it anyway. The layers are restored while the volume is being built rather than after the archive is walked: volumes are constructed only once the whole archive has been read, so a hook placed after the walk ran before any volume existed and restored nothing.
OrcaSlicer tests
Building, running and writing tests is documented on the wiki, under How to Test.
Two files here rather than there, because coding agents only read what is in the repository: