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:
@@ -715,6 +715,7 @@ def render_to_file(
|
||||
denoising_prefilter: str = "",
|
||||
denoising_quality: str = "",
|
||||
denoising_use_gpu: str = "",
|
||||
order_line_id: str | None = None,
|
||||
) -> tuple[bool, dict]:
|
||||
"""Render a STEP file to a specific output path using current system settings.
|
||||
|
||||
@@ -734,6 +735,7 @@ def render_to_file(
|
||||
target_collection: Blender collection name to import geometry into.
|
||||
material_library_path: Optional path to material library .blend file.
|
||||
material_map: Optional {part_name: material_name} for material replacement.
|
||||
order_line_id: Optional order line ID for live log streaming.
|
||||
|
||||
Returns:
|
||||
(success: bool, render_log: dict)
|
||||
@@ -819,6 +821,11 @@ def render_to_file(
|
||||
if denoising_use_gpu:
|
||||
extra["denoising_use_gpu"] = denoising_use_gpu
|
||||
from app.services.render_blender import is_blender_available, render_still
|
||||
# Build live-log callback for streaming Blender output to Redis
|
||||
_log_cb = None
|
||||
if order_line_id:
|
||||
from app.services import render_log as _rl
|
||||
_log_cb = lambda line: _rl.emit(order_line_id, line)
|
||||
if is_blender_available():
|
||||
try:
|
||||
service_data = render_still(
|
||||
@@ -845,6 +852,7 @@ def render_to_file(
|
||||
denoising_prefilter=denoising_prefilter,
|
||||
denoising_quality=denoising_quality,
|
||||
denoising_use_gpu=denoising_use_gpu,
|
||||
log_callback=_log_cb,
|
||||
)
|
||||
rendered_png = tmp_png if tmp_png.exists() else None
|
||||
except Exception as exc:
|
||||
|
||||
Reference in New Issue
Block a user