fix: unify filament temp mixing blocking with plate error gating - #589
Open
iesteem wants to merge 5 commits into
Open
fix: unify filament temp mixing blocking with plate error gating#589iesteem wants to merge 5 commits into
iesteem wants to merge 5 commits into
Conversation
- Remove has_sliceable_plate_for_slice_all() hijack in Preview tab switch that triggered unintended "slice all" instead of switching to preview - Add m_filament_temp_blocked flag to PartPlate so can_slice() reflects filament temp mixing state, consistent with m_apply_invalid for object-outside errors - Let sync_filament_temp_mixing_notification() manage its own flag, independent of the background validation system - Simplify EVT_GLVIEWTOOLBAR_PREVIEW to use can_slice() as unified gate for both error types Downstream effects: red exclamation icon on plate thumbnails, disabled slice/export buttons, and blocked auto-slice on preview switch now work uniformly for both object-outside and filament-temp-mixing errors.
…xing Replace the per-plate cached m_filament_temp_blocked flag with on-demand is_plate_blocked_by_filament_temp_mixing() checks in the rendering and preview-switch paths. This eliminates staleness risks identified during code review where non-current plates could retain stale blocked state after filament changes, undo/redo, or plate switching during slicing. Changes: - GLCanvas3D: add on-demand check for red exclamation on plate thumbnails - Plater: add on-demand check in EVT_GLVIEWTOOLBAR_PREVIEW alongside can_slice(), keep sync_filament_temp_mixing_notification() for notification freshness - PartPlate: revert cached flag; can_slice() unchanged Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…xing Merge duplicate key lists, rename used_slots for clarity, and group logic into scoped blocks. No semantic change.
…EPT_FILAMENTS_MIXING_TEMP Better reflects that the check is about high/low temperature material mixing, not just "different" temperatures.
Add per-filament high/low temperature breakdown to the filament temp mixing warning/error notifications so users can see exactly which slots are in conflict, both for single-plate and slice-all modes. - Plater::check_filament_temp_mixing now exposes a FilamentTempMixingDetail (high/low 1-based slot lists) via a new overload - Notification text becomes dynamic; sync_filament_temp_mixing_notification caches the exact pushed strings to work around NotificationManager's exact-text close matching - confirm_filament_temp_mixing_before_slice / _before_slice_all use the same breakdown in their modal dialogs - Safe translation helper tr_u8() avoids the dangling-pointer trap in I18N::translate_utf8() that crashed in non-English locales - Add zh_CN translations for the new strings Also fix a separate crash: GCodeReader::parse_file_raw_internal no longer dereferences a NULL FILE* when fopen fails (e.g. loading a non-existent gcode file at startup), and Plater::load_gcode now checks wxFileExists up front to give a precise "does not exist" error instead of the vague "does not contain valid G-code".
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.
Summary
Five commits hardening the filament temperature mixing (high/low temp materials on the same plate) blocking path, plus a related defensive fix.
Commit-by-commit
fix: unify filament temp mixing blocking with plate error gatinghas_sliceable_plate_for_slice_all()hijack in the Preview-tab switch that triggered an unintended "slice all" instead of switching to preview.m_filament_temp_blockedflag toPartPlatesocan_slice()reflects the filament-temp-mixing state, consistent withm_apply_invalidfor object-outside errors.sync_filament_temp_mixing_notification()manages its own flag, independent of the background validation system.EVT_GLVIEWTOOLBAR_PREVIEWto usecan_slice()as a unified gate for both error types.fix: use on-demand checks instead of cached flag for filament temp mixingm_filament_temp_blockedflag with on-demandis_plate_blocked_by_filament_temp_mixing()checks in the rendering and preview-switch paths.GLCanvas3D: on-demand red-exclamation check on plate thumbnails;Plater: on-demand check inEVT_GLVIEWTOOLBAR_PREVIEW.refactor: simplify filament slot collection in check_filament_temp_mixingused_slotsfor clarity, group logic into scoped blocks. No semantic change.refactor: rename STRING_EXCEPT_FILAMENTS_DIFFERENT_TEMP to STRING_EXCEPT_FILAMENTS_MIXING_TEMPPrintBase.hpp,Snapmaker_Orca.cpp(CLI), andPlater.cpp.feat: show per-filament high/low temp breakdown in mixing notificationsPlater::check_filament_temp_mixingnow exposes aFilamentTempMixingDetail(high/low 1-based slot lists) via a new overload.sync_filament_temp_mixing_notificationcaches the exact pushed strings to work aroundNotificationManager's exact-text close matching.Related defensive fix (bundled)
GCodeReader.cpp:parse_file_raw_internal()returns false whenfopenfails, preventingfread(NULL)from triggering a CRT invalid-parameter crash.zh_CN/Snapmaker_Orca_zh_CN.poupdated with the new dynamic notification strings (Chinese only; other languages to be synced by CI /update-translation.yml).Downstream effects
Red exclamation icon on plate thumbnails, disabled slice/export buttons, and blocked auto-slice on preview switch now work uniformly for both object-outside and filament-temp-mixing errors.
Reviewer Focus
Please prioritize the following (ordered by risk):
1. On-demand vs cached flag tradeoff (most important)
Commit 2 reverted the cached flag from commit 1 in favor of on-demand checks. Please confirm:
is_plate_blocked_by_filament_temp_mixing()is cheap enough to call on every plate-thumbnail render (GLCanvas3D::_render_imgui_select_plate_toolbar) — it walksmodel().objectsand resolves presets each call. For projects with many plates / objects, is there measurable render-time impact?m_filament_temp_blockednow go through the on-demand check. Are there any remaining readers of the (now-removed) flag that would silently compile tofalse?PartPlate::can_slice())? Ifcan_slice()no longer reflects temp-mixing state, the "unified gating" promise of commit 1 may regress.2.
EVT_GLVIEWTOOLBAR_PREVIEWbehavior changeBefore: clicking Preview with a sliceable plate auto-fired slice_all.
After: blocking checks run first; if blocked, switch to Preview view without slicing.
Please confirm the non-blocking path still auto-slices as before, and that the workflow change is intentional and surfaced to users (release notes / changelog).
3. Notification close-then-push correctness
sync_filament_temp_mixing_notification()now cachesfilament_temp_mixing_last_error_text/filament_temp_mixing_last_warning_textfor exact-text close. Please check:curr_plate == nullptr) — do they leak a stale notification by skipping the close step?4. Slot-collection refactor (commit 3) is purely cosmetic
"No semantic change" is claimed. Please diff-check:
wall_filament,sparse_infill_filament,solid_infill_filament,support_filament,support_interface_filament,wipe_tower_filament).uses_default_extruderbranch + globalextruderresolution order is unchanged.5. Enum rename impact
STRING_EXCEPT_FILAMENTS_DIFFERENT_TEMP→STRING_EXCEPT_FILAMENTS_MIXING_TEMP. Search the whole repo (including 3MF serialization, Sentry reporting, CLI) to confirm:= 2, which is preserved).6. Per-filament breakdown formatting
The notification text is now dynamic and lists slots like
[1] PLA White; [3] PETG Black. Please confirm:%1%etc.).7. Bundled
GCodeReader.cppfixfopenNULL check is a defensive fix unrelated to filament temp mixing — confirm it's intentional to bundle here (vs. a separate PR).8. i18n coverage
Only
zh_CN.pois updated; the other 20 languages will fall back to English for the new dynamic strings. Is that acceptable for merge, or should we wait forupdate-translation.ymlto sync?Test Plan
CLI_FILAMENTS_DIFFERENT_TEMP(rename is internal-only)🤖 Generated with Claude Code