# Editor de superficies 3D / 3D surface editor

ES: Inventario → Starbucks PG103 → selecciona una unidad → Editar, en la esquina del modelo. Elige una superficie en la lista o tocando el modelo; cambia el color, importa PNG/JPG/WebP (hasta 20 MB, optimizados a 1024 px) o usa Cuadros, Rayas o Terrazo. Ajusta repetición, rotación, rugosidad y metalizado; compara con el original y usa Deshacer/Rehacer. Aplicar al Xpacio guarda una versión por local + instancia + CI y actualiza sus superficies en Better/Best, también en otra pestaña del mismo navegador y dominio. Histórico permite recuperar un acabado y aplicarlo como nueva versión. Exportar copia JSON conserva imágenes e histórico; importar recupera el acabado actual como una nueva versión, sin reemplazar el histórico local. Guardado local, sin sincronización entre usuarios ni escritura en el histórico patrimonial de Yokup. Good, Matrix y los archivos GLB/Blender originales conservan su vista. El botellero no está colocado en la escena de referencia; editarlo no añade una ubicación. /marca y el shell Experto se conservan; /avatarDigital continúa a cargo de Woz.

EN: Inventory → Starbucks PG103 → select a unit → Edit in the model corner. Choose a surface from the list or by clicking the model; change its colour, import PNG/JPG/WebP (up to 20 MB, optimized to 1024 px), or use Checks, Stripes or Terrazzo. Adjust repeat, rotation, roughness and metalness; compare the original and use Undo/Redo. Apply to Xpacio saves a version keyed by venue + instance + CI and updates its surfaces in Better/Best, including another tab in the same browser and domain. History restores a finish to apply as a new version. Export JSON backup retains images and history; importing restores the current finish as a new version without replacing local history. Local storage, with no multiuser sync or writes to Yokup lifecycle history. Good, Matrix and original GLB/Blender files retain their view. The water rack is not placed in the reference scene; editing does not add a location. /marca and the Expert shell remain available; /avatarDigital remains Woz’s integration.

## Ejemplo / Example

1. Abre [mesa 1](https://www.xpaceos.com/inventario/starbucks/?item=PDG103-MES-01) → Editar. Elige Madera → color o imagen. / Open table 1 → Edit → Wood → colour or image.
2. Aplica al Xpacio y abre Ver Xpacio Best. Solo el tablero de `sb-table-a` cambia; la segunda mesa y las cuatro sillas mantienen sus propios acabados. / Apply to Xpacio → View Best Xpacio. Only `sb-table-a` changes; the other table and four chairs retain their own finishes.
3. Histórico → Recuperar → Aplicar conserva las versiones anteriores. Copia y transferencia → Exportar copia JSON guarda imágenes e histórico. / History → Restore → Apply retains prior versions. Backup and transfer → Export JSON backup saves images and history.

## Contrato compartido / Shared contract

- Maestro patrimonial / lifecycle master: Yokup. Identidades inmutables del [manifest](https://www.xpaceos.com/inventario/starbucks/manifest.json). `surface-identities.mjs` comprueba correspondencia de las catorce unidades (once desde el 1-10 y las tres cestas desde el 18-10) / tests confirm the fourteen-unit mapping.
- Clave / key: `venue/instance/itil_code`, por ejemplo / e.g. `alsea-sbux-021/sb-table-a/PDG103-MES-01`. Las dos mesas comparten GLB 48; cada una tiene acabados separados / shared GLB 48, separate appearances.
- Superficie / surface: nombre de material GLB; los nombres hexadecimales se normalizan (`#ad855b.014` → `#ad855b`) para coincidir con los materiales de la escena / normalized GLB names match room materials. Edición por material; los subcomponentes que comparten material cambian juntos / editing is per material; parts sharing that material change together.
- `inventario/surface-state.mjs`: validación de color, UV y paquete por identidad / validation and identity-bound bundle.
- `inventario/surface-store.mjs`: IndexedDB `xpace-surfaces-v1`, stores `units` and `images`; saved revisions contain complete appearance snapshots, immutable image IDs, UTC timestamps and action; restoration appends a revision. Atomic transaction and expected revision reject concurrent overwrites. BroadcastChannel `xpace-surfaces-v1` refreshes open Xpacio tabs.
- `admira-xp/scripts/surface-materials.mjs`: clones materials per unit; cached geometry and original maps remain shared; images use sRGB, existing UVs, repeat and rotation. Obsolete asynchronous previews release their resources and cannot overwrite newer ones.
- `inventario/surface-editor.mjs`: live preview, material picking, modal workspace, responsive layout, camera, colours, import, generated patterns, undo/redo (up to 100 draft steps), compare, surface reset, saved history, bundle import/export. Drafts persist during unit switching in this page, but require Apply before browser reload.
- `admira-xp/scripts/life-scene.mjs`: Better/Best procedural surfaces match stable unit IDs. Chair components remain grouped geometrically under tables while their finishes have separate IDs. No layout or physical position changes. Generic loaded assets support the same registered ID when present.
- Copia / backup: schema 1, identity, patches, saved history and image data; JSON up to 40 MB on import. Import previews the current finish and does not merge another browser’s audit history; the original exported history remains in the archive. A new local revision is appended when applied.

## Alcance y límites / Scope and limits

Persistencia local por dominio y navegador. Borrar datos del sitio también elimina este histórico; exportar copias permite conservarlo. No sincronización multiusuario, nueva API de escritura, nuevo MCP de edición, ni modificación del histórico ITIL de Yokup. / Local persistence per browser and origin. Clearing site data deletes local history; exported archives preserve it. No multiuser sync, new write API, MCP editing tool or modification of Yokup lifecycle history.

Los modelos son interpretativos. El editor usa sus UV existentes; no cambia geometría, medidas ni posiciones. Best conserva curvas, Better sus superficies simplificadas. La iluminación modifica el color percibido. Good y Matrix no reciben texturas. El botellero `sb-water-rack` no está colocado en la escena de referencia y editarlo no inventa su posición. GLB/Blender descargados siguen siendo originales; la copia JSON contiene los acabados. / Interpretative models use existing UVs without geometry or placement edits. Best retains curves, Better its simplified surfaces. Lighting affects perceived colour. Good and Matrix do not receive textures. The water rack is not placed in the reference scene. Downloaded GLB/Blender remain originals; the JSON bundle contains finishes.

`/marca` / `/brand` y la marca blanca de Experto siguen disponibles; los acabados no cambian el look and feel. `/avatarDigital` es el trabajo de Woz FLT-101350; esta mejora no sustituye su registro de comandos ni afirma que esté publicado. / Expert white label remains available independently of finishes. Woz owns `/avatarDigital`; this change retains the extensible shell and does not claim that integration is deployed.

## Evidencias / Evidence

Misión Yokup Hoy #84 `DCL-571ac5fe7ae1283ae74593f5`. [Minitutorial oficial verificado](https://api.yokup.com/media/fleet/48dc7b828ce966f7.mp4) creado en [ADmiraNeXT TikTok](https://www.admiranext.com/tiktok/), motor ADmira Motion: guía animada, no grabación real de pantalla. H.264 + AAC, 1080×1920, 15.16 s. / Verified official animated guide, not a screen recording.
