feat(K): Blender Asset Library + production exports (GLB + .blend)

- feat(migration): 045_asset_libraries — new asset_libraries table (blend_file_path, catalog JSONB)
- feat(model): AssetLibrary SQLAlchemy model in domains/materials/models.py
- feat(api): POST/GET/PATCH/DELETE /api/asset-libraries + /upload-blend + /refresh-catalog endpoints
- feat(celery): refresh_asset_library_catalog task on thumbnail_rendering queue — runs Blender headless
- feat(blender): catalog_assets.py — extracts asset-marked materials + node_groups from .blend
- feat(blender): asset_library.py — apply_asset_library_materials + apply_asset_library_node_groups helpers
- feat(blender): export_gltf.py — STEP→STL→GLB production export with optional asset library
- feat(blender): export_blend.py — STEP→STL→.blend production export with pack_all()
- feat(frontend): api/assetLibraries.ts — full CRUD API client
- feat(frontend): AssetLibraryPanel in Admin.tsx — upload, refresh, expand catalog view
- docs: Blender asset_data marking requirement learning in LEARNINGS.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 20:56:26 +01:00
parent 7a1329958d
commit a18d4c23ec
14 changed files with 922 additions and 10 deletions
+8 -8
View File
@@ -257,7 +257,7 @@ Frontend:
## Phase K Tasks (nach Commit)
### Task K1: Migration 045 + AssetLibrary Model [ ]
### Task K1: Migration 045 + AssetLibrary Model [x]
- **Datei**: `backend/alembic/versions/045_asset_libraries.py` (neu, autogenerate), `domains/materials/models.py`
- **Was**:
```python
@@ -271,7 +271,7 @@ Frontend:
- `output_types.asset_library_id` FK optional (nullable)
- **Akzeptanzkriterium**: `alembic upgrade head` erfolgreich, `asset_libraries` Tabelle in DB
### Task K2: Asset Library CRUD Backend [ ]
### Task K2: Asset Library CRUD Backend [x]
- **Datei**: `backend/app/domains/materials/router.py` + `service.py` + `schemas.py`
- **Was**:
- `POST /api/asset-libraries` -- .blend Upload -> MinIO `asset-libraries/{id}.blend` -> queut Katalog-Refresh
@@ -281,7 +281,7 @@ Frontend:
- `AssetLibraryOut` Schema mit `catalog` field
- **Akzeptanzkriterium**: POST + GET funktionieren, .blend in MinIO gespeichert
### Task K3: Katalog-Refresh Celery Task + Blender Script [ ]
### Task K3: Katalog-Refresh Celery Task + Blender Script [x]
- **Datei**: `backend/app/domains/materials/tasks.py` (neu), `render-worker/scripts/catalog_assets.py` (neu)
- **Was**:
- Celery Task `refresh_asset_library_catalog(asset_library_id)` auf Queue `thumbnail_rendering`
@@ -301,7 +301,7 @@ Frontend:
- Schreibt Katalog in `asset_libraries.catalog JSONB`
- **Akzeptanzkriterium**: Nach .blend-Upload enthaelt `catalog` JSONB die Asset-Namen
### Task K4: Blender Asset Library Apply Script [ ]
### Task K4: Blender Asset Library Apply Script [x]
- **Datei**: `render-worker/scripts/asset_library.py` (neu)
- **Was**:
```python
@@ -329,7 +329,7 @@ Frontend:
```
- **Akzeptanzkriterium**: Render mit Asset-Library zeigt korrekte Produktionsmaterialien
### Task K5: export_gltf + export_blend Scripts [ ]
### Task K5: export_gltf + export_blend Scripts [x]
- **Dateien**: `render-worker/scripts/export_gltf.py` (neu), `render-worker/scripts/export_blend.py` (neu)
- **Was**:
- `export_gltf.py`:
@@ -345,7 +345,7 @@ Frontend:
4. MediaAsset-Record mit `asset_type=blend_production`
- **Akzeptanzkriterium**: GLB-Download oeffnet sich im Three.js Viewer mit Materialien
### Task K6: Workflow-Builder -- Asset Library Nodes [ ]
### Task K6: Workflow-Builder -- Asset Library Nodes [x]
- **Datei**: `backend/app/domains/rendering/workflow_builder.py`
- **Was**:
- Neue Celery Tasks: `apply_asset_library_materials_task`, `apply_asset_library_modifiers_task`, `export_gltf_task`, `export_blend_task`
@@ -364,7 +364,7 @@ Frontend:
```
- **Akzeptanzkriterium**: Dispatch eines `still_production` Workflows -> PNG + GLB + .blend erzeugt
### Task K7: Asset Library Management UI [ ]
### Task K7: Asset Library Management UI [x]
- **Dateien**: `frontend/src/api/assetLibraries.ts` (neu), `frontend/src/pages/Admin.tsx` erweitern
- **Was**:
- API Client: `getAssetLibraries`, `uploadAssetLibrary` (multipart), `deleteAssetLibrary`, `getAssetLibraryCatalog`
@@ -375,7 +375,7 @@ Frontend:
- OutputTypeTable: Asset-Library-Dropdown-Spalte
- **Akzeptanzkriterium**: Admin kann .blend hochladen, Katalog sehen, OutputType zuweisen
### Task K8: PLAN.md + LEARNINGS.md + Commit [ ]
### Task K8: PLAN.md + LEARNINGS.md + Commit [x]
- **Was**:
- PLAN.md: Phase K als ABGESCHLOSSEN markieren
- LEARNINGS.md: Asset Library link=True Pattern, GLB-Export Blender API