Merge validated target into TextureCraft bake review

This commit is contained in:
chasse20 committed 2026-11-27 21:36:52 +00:00
commit b93c1a285d
10 files changed
+200 -13

No files matched your search

+2 -2
View File
@@ -82,7 +82,7 @@ The evidence column includes the November 16 scores for comparison.
| UI/UX fidelity | ~75% | 20 | TBD | Layer targeting, the workspace, Bake Mode and export dialogs changed. Live task, layout, shortcut and accessibility checks remain. November 16 estimate ~65% |
| File formats / interchange | ~70% | 10 | TBD | Shared import/export codecs, rebuilt UV persistence and linked `.mcmat` v3 have landed. Project/output contracts, `.spp` and destination-tool coverage remain open. November 16 estimate ~60% |
| Hardware (GPU, pen, displays) | ~50% | 8 | TBD | One Windows GPU exercised; pen tilt, pressure across platforms and display coverage remain incomplete. November 16 estimate ~50% |
| Localization | ~35% | 4 | TBD | Ten picker languages in source; optional shared catalogs/fonts and native-language review need current measurement. November 16 estimate ~35% |
| Localization | ~35% | 4 | TBD | Eleven picker languages in source; optional shared catalogs/fonts and native-language review need current measurement. November 16 estimate ~35% |
| Performance | ~45% | 10 | TBD | Main added dirty-region uploads, cheaper undo snapshots and faster glTF lookups. Establish response-time and memory budgets with representative large projects. November 16 estimate ~40% |
| Stability | ~60% | 10 | TBD | The live baseline covered small save/reopen and undo/redo. Rebuilt UV layouts gained persistence checks. Recovery, large projects and long sessions remain open. November 16 estimate ~55% |
| Platforms | ~70% | 3 | TBD | Desktop and web build paths exist. Nightly packaging and supervised signing workflows landed for Windows, Linux and macOS. Install, update and hardware checks remain. November 16 estimate ~65% |
@@ -151,7 +151,7 @@ signed release installation remain outside the November 25 test evidence.
## Languages
The [picker](crates/ui-egui/src/i18n.rs) contains ten languages. Shared catalogs are optional at
The [picker](crates/ui-egui/src/i18n.rs) contains eleven languages. Shared catalogs are optional at
build time; missing entries fall back to English, and builds without catalogs offer English only.
The older [coverage table](docs/localization-parity.md) predates catalog migration, so its “100%”
rows are not a current measurement. The November 16 live audit ran an English build without external catalogs.
+140
View File
@@ -344,6 +344,68 @@ pub fn open_in_materialcraft(package: &std::path::Path) -> Result<()> {
})
}
/// Prefix of the folders [`stage_handoff_package`] makes in the temp folder.
#[cfg(not(target_arch = "wasm32"))]
const HANDOFF_PREFIX: &str = "texturecraft-open-";
/// Folders from earlier hand-offs older than this are removed (MaterialCraft may still have a young one open).
#[cfg(not(target_arch = "wasm32"))]
const HANDOFF_MAX_AGE: std::time::Duration = std::time::Duration::from_secs(7 * 24 * 3600);
/// Write `package` as `file_name` inside a new folder only this call can have made under the temp folder, and return the
/// file's path (for [`open_in_materialcraft`]). A fixed `<temp>/<name>` is guessable: on a shared `/tmp` another user
/// could plant a file or link there first and the write would go through it. The folder name is random, is created
/// exclusively (mode `0700` on Unix) and the file is created with `create_new` (mode `0600`), so nothing planted is ever written through.
/// The folder stays after the call because MaterialCraft needs the file while it is open; folders over a week old go.
#[cfg(not(target_arch = "wasm32"))]
pub fn stage_handoff_package(file_name: &str, package: &[u8]) -> Result<std::path::PathBuf> {
stage_handoff_package_in(&std::env::temp_dir(), file_name, package)
}
#[cfg(not(target_arch = "wasm32"))]
fn stage_handoff_package_in(base: &std::path::Path, file_name: &str, package: &[u8]) -> Result<std::path::PathBuf> {
use std::io::Write;
let io = |e: std::io::Error| EngineError::Other(format!("cannot stage the package for MaterialCraft: {e}"));
if file_name.is_empty() || std::path::Path::new(file_name).file_name() != Some(std::ffi::OsStr::new(file_name)) {
return Err(EngineError::Other(format!("`{file_name}` is not a plain file name")));
}
sweep_old_handoffs(base, HANDOFF_MAX_AGE);
// Dropped (and removed) on any early return, so a failed write leaves no empty folder behind.
let mut builder = tempfile::Builder::new();
builder.prefix(HANDOFF_PREFIX);
// tempfile makes folders with the default mode (0755 under the usual umask), so ask for 0700 and 0600 explicitly.
#[cfg(unix)]
builder.permissions(std::os::unix::fs::PermissionsExt::from_mode(0o700));
let dir = builder.tempdir_in(base).map_err(io)?;
let path = dir.path().join(file_name);
let mut options = std::fs::OpenOptions::new();
options.write(true).create_new(true);
#[cfg(unix)]
std::os::unix::fs::OpenOptionsExt::mode(&mut options, 0o600);
let mut file = options.open(&path).map_err(io)?;
file.write_all(package).map_err(io)?;
file.sync_all().map_err(io)?;
let _ = dir.keep();
Ok(path)
}
/// Remove hand-off folders in `base` last changed more than `max_age` ago. Only real folders with our prefix are
/// touched (never a link), and every failure is ignored: a leftover folder costs disk space, not work.
#[cfg(not(target_arch = "wasm32"))]
fn sweep_old_handoffs(base: &std::path::Path, max_age: std::time::Duration) {
let Ok(entries) = std::fs::read_dir(base) else { return };
for entry in entries.flatten() {
if !entry.file_name().to_string_lossy().starts_with(HANDOFF_PREFIX) {
continue;
}
let Ok(meta) = std::fs::symlink_metadata(entry.path()) else { continue };
let old = meta.modified().ok().and_then(|t| t.elapsed().ok()).is_some_and(|age| age > max_age);
if meta.is_dir() && old {
let _ = std::fs::remove_dir_all(entry.path());
}
}
}
/// Source file extensions are chosen from the linked resource name, never an untrusted path.
pub fn source_extension(name: &str) -> &'static str {
if name.to_ascii_lowercase().ends_with(".mcmat") {
@@ -712,4 +774,82 @@ mod tests {
assert_eq!(typed(&p, &json!("#+f+f+f")), None);
assert!(typed(&p, &json!("#ff8000")).is_some());
}
#[cfg(not(target_arch = "wasm32"))]
fn scratch(name: &str) -> std::path::PathBuf {
let dir = std::env::temp_dir().join(format!("tc_handoff_{name}_{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
dir
}
/// A file another user planted at the old, guessable `<temp>/<name>` is never written through.
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn handoff_package_is_not_written_through_a_planted_link() {
let base = scratch("planted");
let victim = base.join("victim.txt");
std::fs::write(&victim, b"precious").unwrap();
// The old code wrote `<temp>/<name>` with `fs::write`; a hard link there reaches the victim on every platform.
std::fs::hard_link(&victim, base.join("wood.mcraft")).unwrap();
let path = super::stage_handoff_package_in(&base, "wood.mcraft", b"package").unwrap();
assert_eq!(std::fs::read(&victim).unwrap(), b"precious");
assert_eq!(std::fs::read(&path).unwrap(), b"package");
assert_ne!(path.parent().unwrap(), base, "the file is inside a folder of its own");
std::fs::remove_dir_all(&base).unwrap();
}
/// Every hand-off gets its own empty-until-written folder, even when the name repeats.
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn handoff_packages_get_distinct_folders() {
let base = scratch("distinct");
let a = super::stage_handoff_package_in(&base, "m.mcraft", b"a").unwrap();
let b = super::stage_handoff_package_in(&base, "m.mcraft", b"b").unwrap();
assert_ne!(a.parent(), b.parent());
assert_eq!((std::fs::read(&a).unwrap(), std::fs::read(&b).unwrap()), (b"a".to_vec(), b"b".to_vec()));
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
assert_eq!(std::fs::metadata(a.parent().unwrap()).unwrap().permissions().mode() & 0o777, 0o700);
assert_eq!(std::fs::metadata(&a).unwrap().permissions().mode() & 0o777, 0o600);
}
std::fs::remove_dir_all(&base).unwrap();
}
/// A name with a path in it cannot leave the new folder.
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn handoff_package_rejects_names_that_are_paths() {
let base = scratch("names");
for bad in ["", "..", "a/b.mcraft", "../x.mcraft"] {
assert!(super::stage_handoff_package_in(&base, bad, b"x").is_err(), "{bad}");
}
assert_eq!(std::fs::read_dir(&base).unwrap().count(), 0, "a rejected name leaves nothing behind");
std::fs::remove_dir_all(&base).unwrap();
}
/// Old hand-off folders are swept; young ones, other folders and files stay.
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn handoff_sweep_removes_only_old_handoff_folders() {
let base = scratch("sweep");
let old = base.join("texturecraft-open-old");
let other = base.join("somebody-elses-folder");
let file = base.join("texturecraft-open-file");
for dir in [&old, &other] {
std::fs::create_dir(dir).unwrap();
}
std::fs::write(&file, b"x").unwrap();
// Zero age limit: everything with the prefix that is a folder counts as old.
super::sweep_old_handoffs(&base, std::time::Duration::ZERO);
assert!(!old.exists() && other.exists() && file.exists());
let young = base.join("texturecraft-open-young");
std::fs::create_dir(&young).unwrap();
super::sweep_old_handoffs(&base, std::time::Duration::from_secs(3600));
assert!(young.exists());
std::fs::remove_dir_all(&base).unwrap();
}
}
+3 -3
View File
@@ -2787,12 +2787,12 @@ fn fill_properties(app: &mut TextureCraftApp, ui: &mut Ui, layer: &Layer) {
#[cfg(not(target_arch = "wasm32"))]
pub(crate) fn open_link_in_materialcraft(app: &mut TextureCraftApp, layer: LayerId, link: &texturecraft_engine::core::MaterialLink) {
let ext = texturecraft_engine::link_cmds::source_extension(&link.package);
let path = std::env::temp_dir().join(format!("{}.{ext}", texturecraft_engine::formats::export::sanitize_file_stem(&link.name)));
let file_name = format!("{}.{ext}", texturecraft_engine::formats::export::sanitize_file_stem(&link.name));
let opened = app
.session
.link_package(layer)
.and_then(|package| std::fs::write(&path, package.as_slice()).map_err(|err| texturecraft_engine::EngineError::Other(err.to_string())))
.and_then(|()| texturecraft_engine::link_cmds::open_in_materialcraft(&path));
.and_then(|package| texturecraft_engine::link_cmds::stage_handoff_package(&file_name, package.as_slice()))
.and_then(|path| texturecraft_engine::link_cmds::open_in_materialcraft(&path));
match opened {
Ok(()) => app.toast(tr("Opened in MaterialCraft: use File > Send to TextureCraft there to bring your changes back"), false),
Err(e) => app.toast(e.to_string(), true),
+4 -2
View File
@@ -278,9 +278,11 @@ mod tests {
assert_eq!(Script::of_language("ko"), Some(Script::Korean));
assert_eq!(Script::of_language("ar"), Some(Script::Arabic));
assert_eq!(Script::of_language("de"), None);
assert_eq!(Script::of_language("ru"), None);
for l in &crate::i18n::LANGUAGES {
// Past the Latin blocks and their diacritics.
let other_script = l.name.chars().any(|c| c > '\u{036F}');
// Past the Latin blocks and their diacritics. Cyrillic needs no fallback: the UI fonts
// themselves carry it (egui's Ubuntu and craft-fonts' Inter).
let other_script = l.name.chars().any(|c| c > '\u{036F}' && !('\u{0400}'..='\u{04FF}').contains(&c));
assert_eq!(other_script, Script::of_language(l.code).is_some(), "{}", l.code);
}
}
+14 -4
View File
@@ -37,7 +37,7 @@ pub struct Language {
pub english: &'static str,
}
const COUNT: usize = 10;
const COUNT: usize = 11;
pub static LANGUAGES: [Language; COUNT] = [
Language { code: "en", name: "English", english: "English" },
@@ -46,6 +46,7 @@ pub static LANGUAGES: [Language; COUNT] = [
Language { code: "es", name: "Español", english: "Spanish" },
Language { code: "pt-BR", name: "Português (Brasil)", english: "Portuguese (Brazil)" },
Language { code: "it", name: "Italiano", english: "Italian" },
Language { code: "ru", name: "Русский", english: "Russian" },
Language { code: "ja", name: "日本語", english: "Japanese" },
Language { code: "zh-Hans", name: "简体中文", english: "Chinese (Simplified)" },
Language { code: "ko", name: "한국어", english: "Korean" },
@@ -450,9 +451,18 @@ mod tests",
assert_eq!(trf("Saved {path}", &[("path", &"a.tcraft")]), "Saved a.tcraft");
assert_eq!(trf("{a} of {b} {c}", &[("a", &1), ("b", &2)]), "1 of 2 {c}");
assert_eq!(trf("{unclosed", &[]), "{unclosed");
for (locale, code) in
[("de-AT", "de"), ("pt_PT.UTF-8", "pt-BR"), ("zh-Hant-TW", "zh-Hans"), ("ja", "ja"), ("ko_KR", "ko"), ("ar-EG", "ar"), ("nl-NL", "en"), ("", "en")]
{
for (locale, code) in [
("de-AT", "de"),
("pt_PT.UTF-8", "pt-BR"),
("zh-Hant-TW", "zh-Hans"),
("ja", "ja"),
("ko_KR", "ko"),
("ar-EG", "ar"),
("ru-SK", "ru"),
("ru_RU.UTF-8", "ru"),
("nl-NL", "en"),
("", "en"),
] {
assert_eq!(language_for_locale(locale), code, "{locale}");
}
set_language("de");
+4 -2
View File
@@ -315,8 +315,10 @@ Everything TextureCraft does today, by area. What's still missing is in [`ROADMA
channel to a text file with each entry's recorded UTC time, severity and source. The desktop app asks
for a destination, and the browser downloads the file.
- A **History** panel: click any step to go back to it, or forward again to an undone one.
- **10 languages:** English, French, German, Spanish, Portuguese, Italian, Japanese, Chinese,
Korean and Arabic, switchable live.
- **11 languages:** English, French, German, Spanish, Portuguese, Italian, Russian, Japanese,
Chinese, Korean and Arabic, switchable live. A build without the shared craft-i18n catalogs
offers English only, and Japanese, Chinese, Korean and Arabic can be picked only where a font
for their script is available (craft-fonts or the system's); otherwise they show greyed out.
- **In the browser:** the same app compiled to WebAssembly, on WebGPU or WebGL2, with touch
navigation and project open, save and download.
+1
View File
@@ -29,6 +29,7 @@ generator, filter and brush alpha names (**KEYS** strings, counted by the
| Arabic | `ar` | KEYS (100%) | yes | Arabic glyphs: craft-fonts (Noto Sans Arabic) or system fonts on desktop; egui shapes the text and orders it right to left (panels keep the left-to-right layout) | yes | full | 0 h |
| French | `fr` | KEYS (100%) | yes | Latin | no | full | 1 h (review) |
| Portuguese (Brazil) | `pt-BR` | KEYS (100%) | yes | Latin | no | full | 1 h (review) |
| Russian | `ru` | KEYS (~99%) | yes | Cyrillic: egui's built-in fonts | yes | full with the craft-i18n `ru/texturecraft.tsv` catalog | 0 h |
| Indonesian | `id` | 0 | no | Latin | no | none | 3 h |
| Japanese | `ja` | KEYS (100%) | yes | CJK glyphs: craft-fonts (BIZ UDPGothic) or system fonts on desktop | no | full | 2 h (review) |
| German | `de` | KEYS (100%) | yes | Latin | no | full | 1 h (review) |
@@ -1,8 +1,11 @@
[Desktop Entry]
Type=Application
Name=TextureCraft
Name[ru]=TextureCraft
GenericName=3D Texture Painter
GenericName[ru]=Рисование 3D-текстур
Comment=Paint PBR textures directly on 3D meshes
Comment[ru]=Рисование PBR-текстур прямо на 3D-моделях
Exec=texturecraft %F
TryExec=texturecraft
Icon=ai.storyteller.texturecraft
@@ -11,4 +14,5 @@ StartupNotify=true
StartupWMClass=ai.storyteller.texturecraft
Categories=Graphics;3DGraphics;
Keywords=texture;paint;pbr;material;3d;mesh;bake;gltf;fbx;usd;
Keywords[ru]=текстура;рисование;pbr;материал;3d;сетка;меш;запекание;gltf;fbx;usd;
MimeType=application/x-texturecraft;model/gltf-binary;model/gltf+json;model/x-fbx;model/vnd.collada+xml;model/x-usd;model/vnd.usda;model/vnd.usdz+zip;model/x-alembic;model/obj;model/x-ply;model/stl;
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Translated strings in this file may be used under its CC0-1.0 metadata license. -->
<!-- AppStream metadata (software centres, Flathub). Template: package.sh and the Flatpak
manifest substitute @VERSION@ and @DATE@ from Cargo.toml and the build date. -->
<component type="desktop-application">
@@ -7,6 +8,7 @@
<project_license>MIT OR Apache-2.0</project_license>
<name>TextureCraft</name>
<summary>Paint PBR textures directly on 3D meshes</summary>
<summary xml:lang="ru">Рисование PBR-текстур прямо на 3D-моделях</summary>
<developer id="ai.storyteller">
<name>Learning Machines LLC</name>
</developer>
@@ -16,11 +18,21 @@
expect: familiar menus, shortcuts, panels and tools, with texture sets,
layers, masks, fills and effects painted straight onto the model.
</p>
<p xml:lang="ru">
TextureCraft — открытая нативная программа для рисования 3D-текстур, устроенная так,
как привыкли художники по текстурам: знакомые меню, сочетания клавиш, панели и
инструменты, а наборы текстур, слои, маски, заливки и эффекты наносятся прямо на
модель.
</p>
<ul>
<li>Open glTF/GLB, FBX, COLLADA, USD (USDA/USDC/USDZ), Alembic, OBJ, PLY and STL meshes and save projects as .tcraft</li>
<li xml:lang="ru">Открытие сеток glTF/GLB, FBX, COLLADA, USD (USDA/USDC/USDZ), Alembic, OBJ, PLY и STL и сохранение проектов в .tcraft</li>
<li>Paint base colour, roughness, metallic, normal and height together with PBR brushes</li>
<li xml:lang="ru">Рисование базового цвета, шероховатости, металличности, нормалей и высоты одновременно с помощью PBR-кистей</li>
<li>Bake mesh maps and export texture sets as PNG, EXR, TGA, JPEG or TIFF</li>
<li xml:lang="ru">Запекание карт сетки и экспорт наборов текстур в PNG, EXR, TGA, JPEG или TIFF</li>
<li>Every action is a command, scriptable from a CLI and a JSON control channel</li>
<li xml:lang="ru">Каждое действие — это команда, которую можно вызывать из CLI и через управляющий канал JSON</li>
</ul>
</description>
<launchable type="desktop-id">ai.storyteller.texturecraft.desktop</launchable>
@@ -36,9 +48,13 @@
</categories>
<keywords>
<keyword>texture painting</keyword>
<keyword xml:lang="ru">рисование текстур</keyword>
<keyword>pbr</keyword>
<keyword xml:lang="ru">pbr</keyword>
<keyword>3d</keyword>
<keyword xml:lang="ru">3d</keyword>
<keyword>mesh</keyword>
<keyword xml:lang="ru">сетка</keyword>
</keywords>
<branding>
<color type="primary" scheme_preference="light">#f0c39c</color>
@@ -5,12 +5,14 @@
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-texturecraft">
<comment>TextureCraft project</comment>
<comment xml:lang="ru">Проект TextureCraft</comment>
<sub-class-of type="application/zip"/>
<icon name="ai.storyteller.texturecraft"/>
<glob pattern="*.tcraft" weight="60"/>
</mime-type>
<mime-type type="model/gltf-binary">
<comment>glTF binary model</comment>
<comment xml:lang="ru">Двоичная модель glTF</comment>
<magic priority="50">
<match type="string" value="glTF" offset="0"/>
</magic>
@@ -18,11 +20,13 @@
</mime-type>
<mime-type type="model/gltf+json">
<comment>glTF model</comment>
<comment xml:lang="ru">Модель glTF</comment>
<sub-class-of type="application/json"/>
<glob pattern="*.gltf"/>
</mime-type>
<mime-type type="model/x-fbx">
<comment>FBX model</comment>
<comment xml:lang="ru">Модель FBX</comment>
<magic priority="50">
<match type="string" value="Kaydara FBX Binary" offset="0"/>
</magic>
@@ -30,11 +34,13 @@
</mime-type>
<mime-type type="model/vnd.collada+xml">
<comment>COLLADA model</comment>
<comment xml:lang="ru">Модель COLLADA</comment>
<sub-class-of type="application/xml"/>
<glob pattern="*.dae"/>
</mime-type>
<mime-type type="model/x-usd">
<comment>Universal Scene Description</comment>
<comment xml:lang="ru">Universal Scene Description</comment>
<magic priority="50">
<match type="string" value="PXR-USDC" offset="0"/>
<match type="string" value="#usda" offset="0"/>
@@ -44,17 +50,20 @@
</mime-type>
<mime-type type="model/vnd.usda">
<comment>Universal Scene Description (text)</comment>
<comment xml:lang="ru">Universal Scene Description (текст)</comment>
<sub-class-of type="text/plain"/>
<glob pattern="*.usda"/>
</mime-type>
<mime-type type="model/vnd.usdz+zip">
<comment>Universal Scene Description package</comment>
<comment xml:lang="ru">Пакет Universal Scene Description</comment>
<sub-class-of type="application/zip"/>
<glob pattern="*.usdz"/>
</mime-type>
<!-- *.abc is also ABC music notation; the Ogawa magic tells Alembic caches apart. -->
<mime-type type="model/x-alembic">
<comment>Alembic model</comment>
<comment xml:lang="ru">Модель Alembic</comment>
<magic priority="60">
<match type="string" value="Ogawa" offset="0"/>
</magic>
@@ -62,11 +71,13 @@
</mime-type>
<mime-type type="model/obj">
<comment>Wavefront OBJ model</comment>
<comment xml:lang="ru">Модель Wavefront OBJ</comment>
<sub-class-of type="text/plain"/>
<glob pattern="*.obj"/>
</mime-type>
<mime-type type="model/x-ply">
<comment>PLY model</comment>
<comment xml:lang="ru">Модель PLY</comment>
<magic priority="50">
<match type="string" value="ply\n" offset="0"/>
<match type="string" value="ply\r\n" offset="0"/>
@@ -75,6 +86,7 @@
</mime-type>
<mime-type type="model/stl">
<comment>STL model</comment>
<comment xml:lang="ru">Модель STL</comment>
<glob pattern="*.stl"/>
</mime-type>
</mime-info>