From 5d0edb3a1fab8ccafedd3ddbf887fda81dfeb65c Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Mon, 6 Apr 2026 23:32:11 +0300 Subject: [PATCH] fix: Wipeout fill color respects BACKGROUND command override Scene now carries bg_color / paper_bg_color fields (defaults match previous hard-coded values). synced_hatch_models() reads these instead of hard-coded constants, so Wipeout fills correctly use the custom background when BACKGROUND has been set. BACKGROUND command syncs both DocumentTab.bg_color and scene.bg_color. Co-Authored-By: Claude Sonnet 4.6 --- src/app/commands.rs | 4 ++++ src/scene/mod.rs | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/commands.rs b/src/app/commands.rs index 6d47e55d0..3b3aa0c09 100644 --- a/src/app/commands.rs +++ b/src/app/commands.rs @@ -41,8 +41,10 @@ impl H7CAD { if args.first().map(|s| s.eq_ignore_ascii_case("RESET")).unwrap_or(false) { if is_paper { self.tabs[i].paper_bg_color = None; + self.tabs[i].scene.paper_bg_color = [0.22, 0.24, 0.28, 1.0]; } else { self.tabs[i].bg_color = None; + self.tabs[i].scene.bg_color = [0.11, 0.11, 0.11, 1.0]; } self.command_line.push_output("Background reset to default."); } else if args.len() >= 3 { @@ -51,8 +53,10 @@ impl H7CAD { let b = args[2].parse::().unwrap_or(0) as f32 / 255.0; if is_paper { self.tabs[i].paper_bg_color = Some([r, g, b, 1.0]); + self.tabs[i].scene.paper_bg_color = [r, g, b, 1.0]; } else { self.tabs[i].bg_color = Some([r, g, b, 1.0]); + self.tabs[i].scene.bg_color = [r, g, b, 1.0]; } self.command_line .push_output(&format!("Background: rgb({}, {}, {})", args[0], args[1], args[2])); diff --git a/src/scene/mod.rs b/src/scene/mod.rs index 9ca11c1be..ff5385a1d 100644 --- a/src/scene/mod.rs +++ b/src/scene/mod.rs @@ -69,6 +69,11 @@ pub struct Scene { /// `None` = paper space editing (PSPACE). Only meaningful when /// `current_layout != "Model"`. pub active_viewport: Option, + /// Custom model-space background fill color for Wipeout entities. + /// Set from the active tab's `bg_color`; defaults to dark grey. + pub bg_color: [f32; 4], + /// Custom paper-space background fill color for Wipeout entities. + pub paper_bg_color: [f32; 4], } impl Scene { @@ -86,6 +91,8 @@ impl Scene { meshes: HashMap::new(), images: HashMap::new(), active_viewport: None, + bg_color: [0.11, 0.11, 0.11, 1.0], + paper_bg_color: [0.22, 0.24, 0.28, 1.0], } } @@ -1216,9 +1223,9 @@ impl Scene { // they mask hatch fills drawn earlier in the same pass. // Wipeout fills are appended last so they render on top of other hatches. let bg_color: [f32; 4] = if self.current_layout == "Model" { - [0.11, 0.11, 0.11, 1.0] + self.bg_color } else { - [0.22, 0.24, 0.28, 1.0] + self.paper_bg_color }; for entity in self.document.entities() { let EntityType::Wipeout(wo) = entity else { continue };