Files
OrcaSlicer/tests
ExPikaPaka 8f1c8f0580 feat: live displacement in the image-adjustment panel, reached from a per-layer icon
Four changes to the image-adjustment panel, all from using it:

Entry point. The panel is now opened by an icon in the layer's header row,
between the image name and the order arrows, rather than by a button buried
under "More settings". It acts on the image the name refers to, so it belongs
beside the name. Disabled for a layer with no image.

Only "Save as copy". Overwrite is gone, and with it the one path that edited
a layer's stored image in place. Writing the result to the texture library and
pointing the layer at it is the single way an adjustment becomes permanent,
which also means an adjusted texture is always a file the user can find and
reuse. encode_texture_image_data() had no other caller and is removed.

A window, not a popup. A popup dimmed the canvas and closed on any click
outside itself, which between them made it impossible to watch the model
while adjusting it. An ordinary floating window leaves the 3D view live,
clickable and orbitable, and stays put until Cancel, Save as copy or its
close button.

The displacement follows the sliders. TextureDisplacementLayer gains a
transient preview_adjust that decode_height_texture() applies on top of the
decoded image, before smoothing. Everything downstream of the decode then
sees the adjusted image without being told the panel exists: the relief, the
colour, the thumbnails, the UV backdrop and the bake. It is not serialized by
cereal or the .3mf, because it is the state of an open editor rather than a
property of the layer; the panel reverts it on every exit that is not a
commit, and a commit clears it before pointing the layer at the file that
already carries the edit, so the adjustment is never applied twice.

Two caches had to learn about it or they would have gone on serving the
pixels from before the slider moved, since neither the image_data pointer nor
the smoothing value changes while a slider is dragged: the new adjusted-copy
cache keys on (image, adjustments), the smoothed cache now keys on both, and
the GPU thumbnail, height and colour textures and the UV editor backdrop
carry the adjustment in their keys alongside smoothing. Two tests cover
exactly that: the same image_data with two different adjustments must decode
to two different images, with and without smoothing on.

The recompute is lazy. A slider move marks the preview dirty and the existing
"rebuild once the mouse is released" rule in the panel consumes it, so a drag
recomputes the displacement once, on release, instead of once per frame. The
panel's own image still updates continuously, from a background pass over a
384 px copy, so the photo tracks the slider while the model catches up after.
2026-10-12 08:18:58 +02:00
..
2025-12-08 22:42:11 +08:00

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:

  • AGENTS.md is the same guidance in short form, and is what an agent working under tests/ picks up.
  • CATCH2.md is the Catch2 reference, including the mistakes that break a test at runtime.