feat(M5-M7): embed canonical material names in USD via customData + pxr direct read
- export_step_to_usd.py: accept --material_map CLI arg, write
schaeffler:canonicalMaterialName as customData on each Mesh prim,
fix geometry transform (strip shape Location before face exploration,
apply both face_loc and shape_loc sequentially)
- import_usd.py: after Blender USD import, use pxr to read customData
directly from the USD file — builds {part_key: material_name} lookup
(Blender ignores STRING primvars and customData, but pxr reads both)
- _blender_materials.py: add apply_material_library_direct() for exact
dict-based material assignment without name-matching heuristics
- _blender_scene_setup.py: prefer direct USD lookup, fall back to
name-matching for legacy USD files without material metadata
- export_glb.py (generate_usd_master_task): resolve material_map via
material_service.resolve_material_map() and pass to subprocess;
include material hash in cache key for invalidation
- ROADMAP.md: update P5 status, add M5-M7 milestones
Tested: 3/3 parts matched (ans_lfs120), 172/175 parts matched
(F-802007.TR4-D1-H122AG). Previous: 0/25 matched.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,15 @@ def apply_rotation(parts: list, rx: float, ry: float, rz: float) -> None:
|
||||
print(f"[blender_render] applied rotation ({rx}°, {ry}°, {rz}°) to {len(parts)} parts")
|
||||
|
||||
|
||||
def import_usd_file(usd_path: str) -> list:
|
||||
"""Import USD stage into current Blender scene — delegates to import_usd module."""
|
||||
def import_usd_file(usd_path: str) -> tuple[list, dict]:
|
||||
"""Import USD stage into current Blender scene — delegates to import_usd module.
|
||||
|
||||
Returns (parts, material_lookup) where material_lookup maps
|
||||
blender_object_name → canonical SCHAEFFLER material name (from USD primvars).
|
||||
"""
|
||||
from import_usd import import_usd_file as _impl
|
||||
return _impl(usd_path)
|
||||
result = _impl(usd_path)
|
||||
# Backward compat: old import_usd returned just a list
|
||||
if isinstance(result, tuple):
|
||||
return result
|
||||
return result, {}
|
||||
|
||||
Reference in New Issue
Block a user