migrated texture generation script to cli

This commit is contained in:
ykcheungab
2026-09-16 21:34:59 +08:00
parent a29ca6846c
commit 026f495f77
12 changed files with 1292 additions and 124 deletions
+52 -2
View File
@@ -66,7 +66,7 @@ cd D:\orisys_ws\orisys-sensor-design
python -m pip install -e .
```
Three commands for v1:
Four commands for v1:
```powershell
# 1) Check revision metadata and (optionally) Blender scene conventions
@@ -75,7 +75,10 @@ orisys-design validate sensors/finger/r01
# 2) Export nominal geometry for a profile (compute → SDK layout)
orisys-design export sensors/finger/r01 --profile compute
# 3) Write release manifest with file hashes
# 3) Generate the colored patch texture headlessly
orisys-design texture sensors/finger/r01
# 4) Write release manifest with file hashes
orisys-design manifest sensors/finger/r01
```
@@ -108,6 +111,53 @@ build/export/finger/r01/
└── world_to_cam.npy
```
## Texture patches (headless)
`orisys-design texture` generates the colored patch texture headlessly. UV
unwrapping is **still an in-app Blender step**: this command consumes the UV map
already stored in `source_blend` and never creates or unwraps one. Unwrap the
mesh in the Blender GUI, save the `.blend`, then run the command.
```powershell
orisys-design texture sensors/finger/r01
# writes build/textures/finger/r01/_texture_job.json then runs Blender
```
Output is revision-scoped, so nothing has to be copied by hand:
```text
build/textures/finger/r01/
├── _texture_job.json # Blender input, regenerated by texture (gitignored)
└── patch_texture.png # colored patch texture (tracked, Git LFS)
```
Generated PNGs are **committed** so a revision's texture can be synced to
hardware production; `.gitattributes` already routes `*.png` through Git LFS
(`git lfs install` / `git lfs pull` as usual). Only `_texture_job.json` is
ignored, because it records absolute machine paths and is rewritten every run.
Defaults come from the `texture_patch` block in `design.yaml` — mesh, camera,
texture size, patch grid, colour separation, edge sampling, reference cross,
file name, and an optional seed. CLI flags override every value:
```powershell
orisys-design texture sensors/finger/r01 `
--width 1024 --height 1024 --nx 16 --ny 12 --seed 7 --no-cross
```
Manual Blender invocation with the same job:
```powershell
blender -b sensors/finger/r01/source/geometry.blend -P blender/scripts/random_patch_dd02c.py -- `
--job D:\orisys_ws\orisys-sensor-design\build\textures\finger\r01\_texture_job.json
```
Only the colored "patches" mode is reachable headlessly; the checker and dot
helpers remain in `random_patch_dd02c.py` but are not exposed by the CLI. The
default 3280×3200 grid matches the in-app script and is deliberately slow
(pure-Python rasterization) — use smaller `--width/--height/--nx/--ny` for quick
check runs, and the full default grid for the texture you actually ship.
Collection check:
```powershell