feat: sharp edge pipeline V02, tessellation presets, media cache-bust, GMSH plan
Sharp Edge Pipeline V02:
- export_step_to_gltf.py: replace BRep_Tool.Polygon3D_s (returns None in XCAF) with
GCPnts_UniformAbscissa curve sampling at 0.3mm step — extracts 17,129 segment pairs
- Inject sharp_edge_pairs + sharp_threshold_deg into GLB extras (scenes[0].extras)
via binary GLB JSON-chunk patching (no extra dependency)
- export_gltf.py: read schaeffler_sharp_edge_pairs from Blender scene custom props,
apply via KD-tree to mark edges sharp=True + seam=True (OCC mm Z-up → Blender transform)
- tools/restore_sharp_marks.py: dual-pass (dihedral angle + OCC pairs), updated coordinate
transform (X, -Z, Y) * 0.001
Tessellation:
- Admin UI: Draft / Standard / Fine preset buttons with active-state highlighting
- Default angular deflection: preview 0.5→0.1 rad, production 0.2→0.05 rad
- export_glb.py: read updated defaults from system_settings
Media / Cache:
- media/service.py: get_download_url appends ?v={file_size_bytes} cache-buster
- media/router.py: Cache-Control: no-cache for all download/thumbnail endpoints
Render pipeline:
- still_render.py / turntable_render.py: shared GPU activation + camera improvements
- render_order_line.py: global render position support
- render_thumbnail.py: updated defaults
Frontend:
- InlineCadViewer: file_size_bytes-aware URL update triggers re-fetch on regeneration
- ThreeDViewer: material panel, part selection, PBR mode improvements
- Admin.tsx: tessellation preset cards, GMSH setting dropdown
- MediaBrowser, ProductDetail, OrderDetail, Orders: various UI improvements
- New: MaterialPanel, GlobalRenderPositionsPanel, StepIndicator components
- New: renderPositions.ts API client
Plans / Docs:
- plan.md: GMSH Frontal-Delaunay tessellation plan (6 tasks)
- LEARNINGS.md: OCC Polygon3D_s None issue + GCPnts fix
- .gitignore: add backend/core (core dump from root process)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,8 +88,12 @@ def _apply_sharp_edges_from_occ(mesh_objects: list, sharp_edge_pairs: list) -> N
|
||||
continue # degenerate — both endpoints map to same vertex
|
||||
bv0, bv1 = bm.verts[idx0], bm.verts[idx1]
|
||||
edge = bm.edges.get((bv0, bv1)) or bm.edges.get((bv1, bv0))
|
||||
if edge is not None and edge.smooth:
|
||||
if edge is not None:
|
||||
# Mark sharp (for normal splitting) AND seam (for UV unwrap).
|
||||
# Both are needed: sharp controls glTF vertex splits / shading;
|
||||
# seam defines UV island boundaries for correct UV unwrapping.
|
||||
edge.smooth = False
|
||||
edge.seam = True
|
||||
marked += 1
|
||||
|
||||
bm.to_mesh(obj.data)
|
||||
@@ -116,6 +120,14 @@ def main() -> None:
|
||||
mesh_objects = [o for o in bpy.data.objects if o.type == "MESH"]
|
||||
print(f"Imported geometry GLB: {args.glb_path} ({len(mesh_objects)} mesh objects)")
|
||||
|
||||
# Read OCC sharp edge pairs embedded by export_step_to_gltf.py into GLB extras.
|
||||
# Blender 5.0 maps glTF scenes[0].extras as scene custom properties on import.
|
||||
# These take priority over the mesh_attributes CLI argument (which only has 2
|
||||
# endpoints per edge — see V02 refactor for why this matters).
|
||||
glb_sharp_pairs = bpy.context.scene.get("schaeffler_sharp_edge_pairs") or []
|
||||
if glb_sharp_pairs:
|
||||
print(f"Loaded {len(glb_sharp_pairs)} OCC sharp edge pairs from GLB extras")
|
||||
|
||||
# Remove OCC-baked custom normals from the geometry GLB.
|
||||
# RWGltf_CafWriter embeds per-corner normals from OCC tessellation as a
|
||||
# 'custom_normal' attribute (CORNER, INT16_2D). If left in place, Blender's
|
||||
@@ -168,10 +180,14 @@ def main() -> None:
|
||||
|
||||
print(f"Marked {total_sharp} sharp/seam edges across {len(mesh_objects)} objects")
|
||||
|
||||
# Apply OCC sharp edges if available (additional explicit sharp edges from CAD data)
|
||||
sharp_pairs = mesh_attributes.get("sharp_edge_pairs") or []
|
||||
if sharp_pairs:
|
||||
_apply_sharp_edges_from_occ(mesh_objects, sharp_pairs)
|
||||
# Apply OCC sharp edges from GLB extras (V02: dense tessellation segment pairs).
|
||||
# Prefer GLB-embedded pairs over mesh_attributes CLI argument — the GLB extras
|
||||
# contain the full tessellated polyline for each sharp B-rep edge (all intermediate
|
||||
# points), while mesh_attributes only has 2 endpoints per edge (too sparse for
|
||||
# reliable KD-tree matching). Fall back to mesh_attributes if GLB extras absent.
|
||||
occ_pairs = list(glb_sharp_pairs) or (mesh_attributes.get("sharp_edge_pairs") or [])
|
||||
if occ_pairs:
|
||||
_apply_sharp_edges_from_occ(mesh_objects, occ_pairs)
|
||||
|
||||
# Apply asset library materials if provided.
|
||||
# link=False (append) is required: the GLTF exporter can only traverse
|
||||
|
||||
Reference in New Issue
Block a user