feat: GPU rendering + material matching + perf improvements
- GPU: fix Cycles device activation order — set compute_device_type BEFORE engine init, re-set AFTER open_mainfile wipes preferences - GPU: remove _mark_sharp_and_seams edit-mode loop (redundant with Blender 5.0 shade_smooth_by_angle), saves ~200s/render on 175 parts - Material: fix _AFN suffix mismatch — build AF-stripped mat_map keys and add prefix fallback in _apply_material_library (blender_render.py) - Material: production GLB now uses get_material_library_path() which checks active AssetLibrary instead of empty legacy system setting - Admin: RenderTemplateTable multi-select output types (M2M frontend) - Admin: MaterialLibraryPanel replaced with link to Asset Libraries - UX: move Toaster to top-left to avoid dispatch button overlap - SQLAlchemy: add .unique() to all RenderTemplate M2M collection queries - Logging: flush=True on all Blender progress prints, stdout reconfigure Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from sqlalchemy import String, DateTime, Boolean, Text, Integer, Float, ForeignKey
|
||||
from sqlalchemy import String, DateTime, Boolean, Text, Integer, Float, ForeignKey, Table, Column
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy.dialects.postgresql import UUID, JSONB
|
||||
from app.database import Base
|
||||
|
||||
|
||||
# M2M: render templates ↔ output types
|
||||
render_template_output_types = Table(
|
||||
"render_template_output_types",
|
||||
Base.metadata,
|
||||
Column("template_id", UUID(as_uuid=True), ForeignKey("render_templates.id", ondelete="CASCADE"), primary_key=True),
|
||||
Column("output_type_id", UUID(as_uuid=True), ForeignKey("output_types.id", ondelete="CASCADE"), primary_key=True),
|
||||
)
|
||||
|
||||
VALID_RENDER_BACKENDS = {"celery"}
|
||||
|
||||
|
||||
@@ -66,7 +75,10 @@ class RenderTemplate(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, server_default="now()")
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, server_default="now()", onupdate=datetime.utcnow)
|
||||
|
||||
# Legacy single FK (kept for backward compat, prefer output_types M2M)
|
||||
output_type = relationship("OutputType", lazy="joined")
|
||||
# M2M: multiple output types per template
|
||||
output_types = relationship("OutputType", secondary=render_template_output_types, lazy="joined")
|
||||
|
||||
|
||||
class ProductRenderPosition(Base):
|
||||
|
||||
Reference in New Issue
Block a user