chore: snapshot workflow migration progress

This commit is contained in:
2026-04-12 11:49:04 +02:00
parent 0cd02513d5
commit 3e810c74a3
163 changed files with 31774 additions and 2753 deletions
+17 -3
View File
@@ -15,6 +15,7 @@ import logging
from sqlalchemy import create_engine, select, and_, exists
from sqlalchemy.orm import Session
from app.domains.materials.library_paths import resolve_asset_library_blend_path
from app.models.render_template import RenderTemplate
from app.models.system_setting import SystemSetting
from app.domains.rendering.models import render_template_output_types
@@ -121,14 +122,27 @@ def get_material_library_path_for_session(session: Session) -> str | None:
row = session.execute(
select(AssetLibrary).where(AssetLibrary.is_active == True).limit(1) # noqa: E712
).scalar_one_or_none()
if row and row.blend_file_path:
return row.blend_file_path
if row:
resolved_path = resolve_asset_library_blend_path(
blend_file_path=row.blend_file_path,
asset_library_id=row.id,
)
if resolved_path:
if row.blend_file_path and resolved_path != row.blend_file_path:
logger.warning(
"Active asset library %s points to missing file %s; using %s instead",
row.id,
row.blend_file_path,
resolved_path,
)
return resolved_path
row = session.execute(
select(SystemSetting).where(SystemSetting.key == "material_library_path")
).scalar_one_or_none()
if row and row.value and row.value.strip():
return row.value.strip()
resolved_path = resolve_asset_library_blend_path(blend_file_path=row.value.strip())
return resolved_path or row.value.strip()
return None