feat: performance optimizations + part-materials validation
- @timed_step decorator with wall-clock + RSS tracking (pipeline_logger) - Blender timing laps for sharp edges and material assignment - MeshRegistry pattern: eliminate 13 scene.traverse() calls across viewers - Lazy material cloning (clone-on-first-write in both viewers) - _pipeline_session context manager: 7 create_engine() → 2 in render_thumbnail - KD-tree spatial pre-filter for sharp edge marking (bbox-based pruning) - Batch material library append: N bpy.ops.wm.append → single bpy.data.libraries.load - GMSH single-session batching: compound all solids into one tessellation call - Validate part-materials save endpoints against parsed_objects (prevents bogus keys) - ROADMAP updated with completion status Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -647,6 +647,9 @@ def main() -> None:
|
||||
)
|
||||
|
||||
# Step 2: GMSH override for SOLID shapes (better seam topology)
|
||||
# Batch all eligible solids into a single compound and tessellate in one
|
||||
# GMSH session — avoids N × (gmsh init + brep write + brep read + finalize)
|
||||
# overhead. GMSH's internal OpenMP threading parallelizes across surfaces.
|
||||
_seen_shapes: list = [] # shapes already GMSH-tessellated; compared via IsSame()
|
||||
|
||||
solids = []
|
||||
@@ -661,6 +664,10 @@ def main() -> None:
|
||||
solids.append(exp.Current())
|
||||
exp.Next()
|
||||
|
||||
from OCP.TopoDS import TopoDS_Compound as _Compound
|
||||
from OCP.BRep import BRep_Builder as _BBuilder
|
||||
|
||||
eligible = []
|
||||
for solid in solids:
|
||||
# Skip REVERSED (mirrored) solids — keep BRepMesh tessellation.
|
||||
# GMSH produces inverted-Jacobian meshes for negative-scale shapes.
|
||||
@@ -673,9 +680,19 @@ def main() -> None:
|
||||
continue
|
||||
# Strip location: GMSH tessellates in definition space.
|
||||
# The XCAF writer applies instance transforms at GLB export time.
|
||||
solid_def = solid.Located(_TopLoc_Location())
|
||||
_tessellate_with_gmsh(solid_def, args.linear_deflection, args.angular_deflection)
|
||||
eligible.append(solid.Located(_TopLoc_Location()))
|
||||
_seen_shapes.append(solid)
|
||||
|
||||
if eligible:
|
||||
if len(eligible) == 1:
|
||||
_tessellate_with_gmsh(eligible[0], args.linear_deflection, args.angular_deflection)
|
||||
else:
|
||||
compound = _Compound()
|
||||
bb = _BBuilder()
|
||||
bb.MakeCompound(compound)
|
||||
for s in eligible:
|
||||
bb.Add(compound, s)
|
||||
_tessellate_with_gmsh(compound, args.linear_deflection, args.angular_deflection)
|
||||
else:
|
||||
for i in range(1, free_labels.Length() + 1):
|
||||
shape = shape_tool.GetShape_s(free_labels.Value(i))
|
||||
|
||||
Reference in New Issue
Block a user