From 1abb7bda344511935379ebb6d8d52dff33778b14 Mon Sep 17 00:00:00 2001 From: vkleinmp Date: Tue, 24 Nov 2026 11:41:17 +0100 Subject: [PATCH] Output templates: new output maps get a per texture set file name Create named new rows just "Grayscale", "RGB" or "RGB Alpha", so every texture set of a multi-set export planned the same file and the export was refused for the name clash. New rows now start with "$mesh_$textureSet_" (as the old "$mesh_$textureSet_Output" default did), followed by the reference's row name. The output_templates test that pinned the bare "RGB" checks the suffix and the set token instead. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/export_templates.rs | 5 ++++- crates/ui-egui/tests/it/output_templates.rs | 4 +++- docs/ui-parity.md | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/export_templates.rs b/crates/ui-egui/src/export_templates.rs index 0dd0d996..4a6fd523 100644 --- a/crates/ui-egui/src/export_templates.rs +++ b/crates/ui-egui/src/export_templates.rs @@ -167,6 +167,9 @@ const CREATE: [(&str, Layout, bool, &str); 5] = [ ("RGB+A", Layout::Rgba, false, "RGB Alpha"), ("R+G+B+A", Layout::Rgba, true, "RGB Alpha"), ]; +/// What a new output map's file name starts with, so each texture set (and mesh) writes a file +/// of its own; the reference's row name follows it +const NEW_MAP_PREFIX: &str = "$mesh_$textureSet_"; /// The swatch right-click menu's constants: (label, value) const CONSTANTS: [(&str, f32); 3] = [(n_("Black"), 0.0), (n_("Gray 50%"), 0.5), (n_("White"), 1.0)]; @@ -837,7 +840,7 @@ fn outputs(app: &mut TextureCraftApp, ui: &mut Ui) { } let acted = match edit.action { Some(MapAction::Add(layout, split_rgb, file)) => { - let file = unique_file(&preset.maps, file); + let file = unique_file(&preset.maps, &format!("{NEW_MAP_PREFIX}{file}")); preset.maps.push(new_map(layout, &file)); origin.push(None); split.push(split_rgb); diff --git a/crates/ui-egui/tests/it/output_templates.rs b/crates/ui-egui/tests/it/output_templates.rs index e8bb3af9..918bea96 100644 --- a/crates/ui-egui/tests/it/output_templates.rs +++ b/crates/ui-egui/tests/it/output_templates.rs @@ -501,7 +501,9 @@ fn a_click_on_a_channel_offers_clear_and_split_or_collapse_and_a_right_click_inv let mut h = harness(&library); click(&mut h, "RGB"); let last = h.state().session.export_preset("Mine").unwrap().maps.len() - 1; - assert_eq!(h.state().session.export_preset("Mine").unwrap().maps[last].file, "RGB", "the reference's name for a new RGB row"); + let file = &h.state().session.export_preset("Mine").unwrap().maps[last].file; + assert!(file.ends_with("_RGB"), "the reference's name for a new RGB row: {file}"); + assert!(file.contains("$textureSet"), "each texture set writes a file of its own: {file}"); last_window_button(&h, "RGB: Default black").click(); h.run_steps(4); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 1d52846a..573bed16 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -351,7 +351,8 @@ that numbers hide once a tile is under 40 points on screen. $mesh, $textureSet, $udim, $uvTileName greyed, $colorSpace, then TextureCraft's $channel), the channel swatches (Gr, RGB or R, G, B, then A), the file format ("File format") and bit depth ("Bit depth"; "8 bits + dithering" greyed, templates do not keep it) lists, duplicate and "×". - Create names new rows "Grayscale", "RGB" and "RGB Alpha", with "_1", "_2" when taken. An + Create names new rows "Grayscale", "RGB" and "RGB Alpha" after "$mesh_$textureSet_", so the + texture sets of one export do not write the same file, with "_1", "_2" when taken. An empty swatch reads "Default black" ("Default white" for A), a filled one " ()", e.g. "Base color (Red)" or "Metallic (Grayscale)". Dropping a map on a swatch opens "From ": a gray map offers *Gray Channel* and *A Channel*, a colour map *Gray Channel*, *R Channel*, *G