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 <noreply@anthropic.com>
This commit is contained in:
vkleinmpandClaude Opus 5.5 committed 2026-11-24 11:41:17 +01:00
1 parent c68e8f9959
commit 1abb7bda34
3 files changed
+9 -3

No files matched your search

+4 -1
View File
@@ -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);
+3 -1
View File
@@ -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);
+2 -1
View File
@@ -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 "<map> (<channel>)",
e.g. "Base color (Red)" or "Metallic (Grayscale)". Dropping a map on a swatch opens "From <map>":
a gray map offers *Gray Channel* and *A Channel*, a colour map *Gray Channel*, *R Channel*, *G