refactor: rebrand project to HartOMat
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Runs inside Blender's Python environment (bpy available).
|
||||
Imports a USD stage and restores seam + sharp edges from
|
||||
schaeffler:*EdgeVertexPairs primvars. Blender's built-in USD importer does
|
||||
hartomat:*EdgeVertexPairs primvars. Blender's built-in USD importer does
|
||||
NOT map arbitrary custom primvars (constant Int2Array) to mesh attributes,
|
||||
so we read them directly via the pxr module and apply via bmesh.
|
||||
|
||||
@@ -22,7 +22,7 @@ def import_usd_file(usd_path: str) -> list | tuple:
|
||||
Returns a tuple of (parts, material_lookup) where:
|
||||
- parts: list of imported mesh objects, centred at world origin
|
||||
- material_lookup: dict mapping blender_object_name → canonical_material_name
|
||||
(populated from schaeffler:canonicalMaterialName customData, empty dict if absent)
|
||||
(populated from hartomat:canonicalMaterialName customData, empty dict if absent)
|
||||
|
||||
USD stage is mm Y-up with metersPerUnit=0.001 — Blender scales to metres.
|
||||
"""
|
||||
@@ -49,20 +49,20 @@ def import_usd_file(usd_path: str) -> list | tuple:
|
||||
for prim in stage.Traverse():
|
||||
if prim.GetTypeName() != "Mesh":
|
||||
continue
|
||||
part_key = prim.GetCustomDataByKey("schaeffler:partKey") or ""
|
||||
mat_name = prim.GetCustomDataByKey("schaeffler:canonicalMaterialName") or ""
|
||||
part_key = prim.GetCustomDataByKey("hartomat:partKey") or ""
|
||||
mat_name = prim.GetCustomDataByKey("hartomat:canonicalMaterialName") or ""
|
||||
if not part_key or not mat_name:
|
||||
parent = prim.GetParent()
|
||||
if parent:
|
||||
part_key = part_key or (parent.GetCustomDataByKey("schaeffler:partKey") or "")
|
||||
mat_name = mat_name or (parent.GetCustomDataByKey("schaeffler:canonicalMaterialName") or "")
|
||||
part_key = part_key or (parent.GetCustomDataByKey("hartomat:partKey") or "")
|
||||
mat_name = mat_name or (parent.GetCustomDataByKey("hartomat:canonicalMaterialName") or "")
|
||||
if part_key and mat_name:
|
||||
material_lookup[part_key] = mat_name
|
||||
|
||||
# Read seam/sharp primvars from USD mesh prim
|
||||
pvs_api = UsdGeom.PrimvarsAPI(prim)
|
||||
sharp_pv = pvs_api.GetPrimvar("schaeffler:sharpEdgeVertexPairs")
|
||||
seam_pv = pvs_api.GetPrimvar("schaeffler:seamEdgeVertexPairs")
|
||||
sharp_pv = pvs_api.GetPrimvar("hartomat:sharpEdgeVertexPairs")
|
||||
seam_pv = pvs_api.GetPrimvar("hartomat:seamEdgeVertexPairs")
|
||||
sharp_list = []
|
||||
seam_list = []
|
||||
if sharp_pv and sharp_pv.HasValue():
|
||||
@@ -83,7 +83,7 @@ def import_usd_file(usd_path: str) -> list | tuple:
|
||||
print(f"[import_usd] pxr material lookup: {len(material_lookup)}/{len(parts)} parts",
|
||||
flush=True)
|
||||
else:
|
||||
print("[import_usd] no schaeffler:canonicalMaterialName metadata found (legacy USD)",
|
||||
print("[import_usd] no hartomat:canonicalMaterialName metadata found (legacy USD)",
|
||||
flush=True)
|
||||
|
||||
if edge_data:
|
||||
|
||||
Reference in New Issue
Block a user