refactor: remove dead export_gltf.py, cleanup rendering tasks, improve tessellation UI
- Remove export_gltf.py (Blender-based GLB export replaced by OCC direct) - Remove unused export_gltf_for_order_line_task - Add Ultra tessellation preset to Admin settings - Improve tessellation preset descriptions and styling - Minor cleanup across media, rendering, and workflow modules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -506,52 +506,6 @@ def render_order_line_still_task(self, order_line_id: str, **params) -> dict:
|
||||
raise self.retry(exc=exc, countdown=30)
|
||||
|
||||
|
||||
@celery_app.task(
|
||||
bind=True,
|
||||
name="app.domains.rendering.tasks.export_gltf_for_order_line_task",
|
||||
queue="asset_pipeline",
|
||||
max_retries=1,
|
||||
)
|
||||
def export_gltf_for_order_line_task(self, order_line_id: str) -> dict:
|
||||
"""Export a geometry GLB directly from STEP via OCC (no STL intermediary).
|
||||
|
||||
Publishes a MediaAsset with asset_type='gltf_geometry'.
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
step_path_str, cad_file_id = _resolve_step_path_for_order_line(order_line_id)
|
||||
if not step_path_str:
|
||||
raise RuntimeError(f"Cannot resolve STEP path for order_line {order_line_id}")
|
||||
|
||||
step = Path(step_path_str)
|
||||
output_path = step.parent / f"{step.stem}_geometry.glb"
|
||||
scripts_dir = Path(os.environ.get("RENDER_SCRIPTS_DIR", "/render-scripts"))
|
||||
occ_script = scripts_dir / "export_step_to_gltf.py"
|
||||
|
||||
if not occ_script.exists():
|
||||
raise RuntimeError(f"export_step_to_gltf.py not found at {occ_script}")
|
||||
|
||||
try:
|
||||
cmd = [
|
||||
sys.executable, str(occ_script),
|
||||
"--step_path", str(step),
|
||||
"--output_path", str(output_path),
|
||||
]
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
|
||||
if result.returncode != 0:
|
||||
raise RuntimeError(
|
||||
f"export_step_to_gltf.py exited {result.returncode}:\n{result.stderr[-500:]}"
|
||||
)
|
||||
publish_asset.delay(order_line_id, "gltf_geometry", str(output_path))
|
||||
logger.info("export_gltf_for_order_line_task completed via OCC: %s", output_path.name)
|
||||
return {"glb_path": str(output_path), "method": "occ"}
|
||||
except Exception as exc:
|
||||
logger.error("export_gltf_for_order_line_task failed for %s: %s", order_line_id, exc)
|
||||
raise self.retry(exc=exc, countdown=15)
|
||||
|
||||
|
||||
@celery_app.task(
|
||||
bind=True,
|
||||
name="app.domains.rendering.tasks.export_blend_for_order_line_task",
|
||||
|
||||
@@ -64,23 +64,16 @@ def _build_multi_angle(order_line_id: str, params: dict):
|
||||
|
||||
|
||||
def _build_still_with_exports(order_line_id: str, params: dict):
|
||||
"""Still render + parallel GLB exports (geometry + production quality).
|
||||
"""Still render + .blend export.
|
||||
|
||||
Pipeline:
|
||||
render_order_line_still_task → group(
|
||||
export_gltf_for_order_line_task,
|
||||
export_blend_for_order_line_task,
|
||||
)
|
||||
render_order_line_still_task → export_blend_for_order_line_task
|
||||
"""
|
||||
from app.domains.rendering.tasks import (
|
||||
render_order_line_still_task,
|
||||
export_gltf_for_order_line_task,
|
||||
export_blend_for_order_line_task,
|
||||
)
|
||||
return chain(
|
||||
render_order_line_still_task.si(order_line_id, **params),
|
||||
group(
|
||||
export_gltf_for_order_line_task.si(order_line_id),
|
||||
export_blend_for_order_line_task.si(order_line_id),
|
||||
),
|
||||
export_blend_for_order_line_task.si(order_line_id),
|
||||
)
|
||||
|
||||
@@ -45,8 +45,7 @@ STEP_TASK_MAP: dict[StepName, str] = {
|
||||
# ── Order line stills & turntables ──────────────────────────────────
|
||||
StepName.BLENDER_STILL: "app.domains.rendering.tasks.render_order_line_still_task",
|
||||
StepName.BLENDER_TURNTABLE: "app.domains.rendering.tasks.render_turntable_task",
|
||||
# ── GLB / asset export ───────────────────────────────────────────────
|
||||
StepName.EXPORT_GLB_GEOMETRY: "app.domains.rendering.tasks.export_gltf_for_order_line_task",
|
||||
# ── Asset export ─────────────────────────────────────────────────────
|
||||
StepName.EXPORT_BLEND: "app.domains.rendering.tasks.export_blend_for_order_line_task",
|
||||
# ── Steps without a dedicated standalone task (no mapping) ───────────
|
||||
# StepName.GLB_BBOX — computed inline inside process_step_file
|
||||
|
||||
@@ -51,7 +51,6 @@ _STEP_CATEGORIES: dict[StepName, StepCategory] = {
|
||||
StepName.BLENDER_STILL: "rendering",
|
||||
StepName.BLENDER_TURNTABLE: "rendering",
|
||||
StepName.OUTPUT_SAVE: "output",
|
||||
StepName.EXPORT_GLB_GEOMETRY: "output",
|
||||
StepName.EXPORT_BLEND: "output",
|
||||
StepName.STL_CACHE_GENERATE: "processing",
|
||||
StepName.NOTIFY: "output",
|
||||
@@ -72,7 +71,6 @@ _STEP_DESCRIPTIONS: dict[StepName, str] = {
|
||||
StepName.BLENDER_STILL: "Render a production still image (PNG) via Blender HTTP micro-service",
|
||||
StepName.BLENDER_TURNTABLE: "Render all turntable animation frames via Blender HTTP micro-service",
|
||||
StepName.OUTPUT_SAVE: "Upload the rendered output file to storage and create a MediaAsset record",
|
||||
StepName.EXPORT_GLB_GEOMETRY: "Export a geometry-only GLB for the 3-D viewer (no materials)",
|
||||
StepName.EXPORT_BLEND: "Save the production .blend file as a downloadable MediaAsset",
|
||||
StepName.STL_CACHE_GENERATE: "Convert STEP → STL (low + high quality) and cache next to the STEP file",
|
||||
StepName.NOTIFY: "Emit a user notification via the audit-log notification channel",
|
||||
|
||||
Reference in New Issue
Block a user