The branch collided with the Image gizmo branch in four places that are not
real disagreements, only two features reaching for the same line:
- the layer's preview_adjust field and the three new declarations in
TextureDisplacement.hpp sat at the same two insertion points
- the panel's member block sat on top of m_erase_mode, which the other
branch moves to protected
- all three texture getters grew an adjustment clause in the same if, and
one of those ifs is rewritten there too
The first three are moved a few lines away. The cache keys are dropped: the
panel now calls invalidate_adjust_textures() when it moves or reverts the
adjustment, which is less code than three widened keys and leaves the
getters alone. 'cog.svg' and the panel's tests also move to a line of their
own, for the same reason.
misc-include-cleaner on the changed lines:
TextureLibrary.cpp uses DecodedHeightTexture, which only reached it through
TextureLibrary.hpp; it now includes libslic3r/TextureDisplacement.hpp itself.
The contrast test uses std::not_equal_to, so <functional>.
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.
Adds brightness, contrast, sharpness, blur and hue over one layer's image,
shown on the image itself and updating as the sliders move. Reached from an
"Adjust image" button in the layer card, beside Smoothing.
What the panel produces is not a set of layer parameters: it replaces the
layer's image, so the adjusted pixels feed the colour and the displacement
together and a brightness change moves the relief too. That is deliberate,
and the panel says so. It is also why brightness is a lift toward white
rather than an additive offset: an offset drives everything above mid-grey
to a flat 255, and since the image is the height map, that region would bake
as flat relief instead of bright relief.
Three exits: Cancel discards, Overwrite replaces the layer's image_data, and
Save as copy writes a new PNG into the user's texture library and points the
layer at it. Overwrite and Save as copy both hand the layer a brand new
allocation, which is what invalidates decode_height_texture()'s cache,
analyze_texture_detail()'s, and the GPU thumbnail and height/colour
textures, all of them keyed by that pointer.
Grayscale in, grayscale out: a grey image is not promoted to RGB, since that
would offer the colour feature a row of identical greys and triple the
stored PNG for it. Hue is disabled for a grayscale source, with the reason
shown, because grey has no hue to turn.
The live preview runs on its own thread over a 384 px downscale, one pass in
flight at a time so a drag coalesces to wherever the sliders stop. Measured
on a 1024x1024 with every knob engaged, a full-size pass costs 13-19 ms
grayscale and 40-60 ms in colour (130-190 ms at 2048 in colour), which is
far too much to repeat per slider frame; the same pass on the downscale is
3-4 ms and 9-12 ms. Not the plater's job worker either: that is a single
FIFO shared with Bake, where a per-frame image filter would queue behind
multi-second mesh work. The full-size pass runs once, on commit, on the UI
thread, because the rebuild_preview() immediately after it is an order of
magnitude more work synchronously already.
The image maths lands in libslic3r as apply_texture_adjustments() and
downscale_height_texture(), so it is testable without a GUI, and the blur
reuses the same smooth_height_pixels() the Smoothing slider drives.
The green highlight and tint no longer cover a colour preview, and return while a stroke is
painted. The Fast view also keeps the other parts of a multi-part object.
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy
Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.
* Ignore minilzo's Config Headers in clang-tidy
lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.
* Add Missing Includes Across the Remaining Sources and Tests
Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.
* Make the GUI and Test Headers Compile on Their Own
Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.
* Keep Windows and nanosvg Setup Ahead of the Added Includes
OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.
* Add the GUI Includes the First Pass Missed
Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.
* Keep the Added Test Includes Below the NOMINMAX Guard
test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
Refinement now tapers off away from the paint, and the unpainted surface is kept out of
simplification, so what one bake leaves unpainted is still the model's own triangles when a later
bake paints there. A second bake used to refine the slivers and long triangles the first one left
around its stroke, and came out many times denser, with walls off the texture's lines.
Once the budget is met the progress fraction stops moving, and a cancel was only checked when it
moved, so Cancel did nothing until the flat-face merging finished. It is now also checked every 16k
steps.
Meeting the triangle budget by merging flat faces alone no longer raises the warning, and the
warning now quotes the budget instead of the triangle count left after the flat faces were merged.
- Bake: each layer is sampled only on its own painted area; analytic
projections used to stack every layer over every painted region, so the
top layer's texture showed on all of them (colour sampler too)
- Auto resolution follows the texture's texel size and sharpness again
- Unwrap: charts cut by each face's own normal (a cube gives 6 islands, not
12 triangles); non-disk charts (tubes, closed shells) are split until they
flatten; connected nets test real triangle overlap, grow from the largest
chart and are packed side by side
- UV edits are stored per unwrapped copy, so dragging a seam vertex no
longer moves its copies in neighbouring islands
- UV pane: tool strip with unwrap settings moved in from the panel, sharp
HiDPI icons, clearer island/edge/selection drawing with hover, texture
picker from the thumbnail, texture no longer lost on reopen (GL state
from the 3D view, background upload retries)
- Panel: whole-model select/erase as icons in the tools row; inactive
layers' paint shown muted; colour textures shown in colour in the picker
- Built-in displacement texture library
- Tests for unwrap segmentation, connected nets, UV edits and per-layer
sampling
Colour height maps now displace the same way up as grayscale ones. A
truncated or corrupt PNG in the texture folder or a project file now
loads as an empty texture instead of aborting the app, and a 16-bit
colour PNG is converted on load rather than displacing as noise.