fix: preview slider shows non-support layer count instead of total Z … - #624
Open
mwz-iot wants to merge 2 commits into
Open
fix: preview slider shows non-support layer count instead of total Z …#624mwz-iot wants to merge 2 commits into
mwz-iot wants to merge 2 commits into
Conversation
…xed 490px width - GCode.cpp: separate model_layer_idx / support_layer_idx counters for progress - GCode.cpp/GCode.hpp: m_model_only_layer_count for total layer count - GCodeViewer: negative value mapping for support layer numbering - IMSlider: 3-line bubble layout (number / Z height / Support) for support layers - IMSlider: fix lower bubble invisible text (IM_COL32_WHITE -> theme color) - SlicingProgressNotification: fixed 490px width, single-line, no shrink on state change - i18n: add (support) and layer %1% (support) msgids for all 20 locales Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bluetianyu
reviewed
Aug 4, 2026
|
|
||
| #, boost-format | ||
| msgid "Generating G-code: layer %1% (support)" | ||
| msgstr "" |
bluetianyu
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves layer numbering and tooltip display when Independent Support Layer Height is enabled.
When independent support layer height is enabled, model layers and support-only layers may use different Z positions. The previous implementation treated all sorted Z positions as a single layer sequence, which caused several issues:
--in the Preview slider.Line typestatistics panel in languages with longer translations.This PR separates model and support layer numbering, updates the Preview tooltip layout, and stabilizes the slicing progress window.
The original model and support toolpaths remain unchanged.
Main Changes
1. Separate model and support layer numbering during G-code generation
GCode.cppnow maintains two independent counters:model_layer_idxis incremented only for model layers.support_layer_idxis incremented only for support-only layers.The layer type is determined using
layer.object_layer:layer.object_layer != nullptrindicates a model layer.layer.object_layer == nullptrindicates a support-only layer.This information is already populated by
collect_layers_to_print().The slicing progress status can therefore distinguish between:
Layer 1359Layer 27 (Support)The
Supporttext continues to use the existing localization system.2. Count only model layers in the total layer count
The existing
m_layer_countcontains all Z nodes, including both model layers and support-only layers.When independent support layer height is enabled, additional support-only Z positions increase this value and make the reported total layer count larger than the actual number of model layers.
This PR introduces
m_model_only_layer_count, calculated fromobject->layers().The model-only layer count is now used for:
total layers countvalue in the G-code header.total_layer_countplaceholder.Support-only Z positions remain available for toolpath generation and Preview navigation but are no longer included in the reported model layer total.
3. Assign independent numbers to support-only Preview positions
Previously, support-only Z positions in
GCodeViewerwere mapped to-1, which was treated as an invalid or unavailable layer number and displayed as--.The Preview mapping now uses signed values:
1, 2, 3...-1, -2, -3...IMSliderinterprets the mapping as follows:mapped > 0: displaymappedas the model layer number.mapped < 0: display-mappedas the independent support layer number.This allows model and support-only layers to maintain separate numbering while preserving all Z positions in the Preview slider.
4. Display support-only tooltips using a three-line layout
The previous support tooltip combined the layer number and localized support text on one line:
This could make the tooltip too wide and cause it to overlap the
Line typestatistics panel, especially in languages with longer translations.Support-only tooltips now use three lines:
The lines represent:
Supporttext.Model layer tooltips remain unchanged and continue to use the existing two-line layout.
5. Fix the lower tooltip text color
The lower tooltip uses a white background, but its text was previously rendered with
IM_COL32_WHITE.This resulted in white text on a white background.
The text color now uses:
ImGui::GetColorU32(ImGuiCol_Text)This follows the active ImGui theme:
The lower tooltip is therefore readable in both light and dark themes.
6. Draw tooltips on the foreground layer
The tooltip was previously drawn using
window->DrawList, which could be clipped by child-window boundaries.Tooltip rendering now uses:
ImGui::GetForegroundDrawList()This ensures the tooltip is rendered above other UI elements and is not clipped by the current child window.
7. Stabilize the slicing progress window
Three coordinated changes were made in
SlicingProgressNotification:init()m_lines_count = 1render()490pxset_status_text()update()from resetting or shrinking the window width.Together, these changes ensure that the slicing progress window:
490px.Compatibility
The following behavior remains unchanged:
There are no breaking changes or new external dependencies introduced by this PR.
Screenshots/Recordings/Graphs
Before
Support-only Z positions were displayed using an unavailable layer number or combined the layer number and support label on one line.
This could produce
--or a wide tooltip such as:The wide tooltip could overlap the
Line typestatistics panel.After - Model Layer
Model Z positions display the correct model-only layer number and Z height.
The existing two-line layout remains unchanged.
After - Support-only Layer
Support-only Z positions display their independent support layer number, Z height, and localized support label on three separate lines.
After - Long Localized Text
Long localized support labels, including German and other supported languages, remain within the tooltip and do not overlap the
Line typestatistics panel.After - Slicing Progress Window
The slicing progress window remains
490pxwide, keeps the status text on one line, and no longer resizes when the status changes.Tests
The following cases were tested:
layer.object_layer.total_layer_countplaceholder contains only the model layer count.--.Line typestatistics panel.Line typestatistics panel.490px.