fix(USD): use canonical SCHAEFFLER material names for USD material bindings
Material prims now use resolved canonical names (e.g. SCHAEFFLER_010101_Steel_Bare) instead of source object names. When importing USD in Blender, materials show the correct SCHAEFFLER names directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -759,9 +759,15 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
pv_seam.Set(Vt.Vec2iArray([Gf.Vec2i(a, b) for a, b in seam_idx_pairs]))
|
pv_seam.Set(Vt.Vec2iArray([Gf.Vec2i(a, b) for a, b in seam_idx_pairs]))
|
||||||
|
|
||||||
# ── Material placeholder + binding ────────────────────────────
|
# ── Material binding ──────────────────────────────────────────
|
||||||
mat_name = _prim_name(source_name) if source_name else f"mat_{part_key}"
|
# Use canonical SCHAEFFLER material name when resolved; fall back
|
||||||
mat_usd_path = f"/Root/Looks/{mat_name}"
|
# to source_name so Blender imports show meaningful material names
|
||||||
|
# even without the library .blend appended.
|
||||||
|
if canonical_mat:
|
||||||
|
mat_prim_name = _prim_name(canonical_mat)
|
||||||
|
else:
|
||||||
|
mat_prim_name = _prim_name(source_name) if source_name else f"mat_{part_key}"
|
||||||
|
mat_usd_path = f"/Root/Looks/{mat_prim_name}"
|
||||||
if not stage.GetPrimAtPath(mat_usd_path):
|
if not stage.GetPrimAtPath(mat_usd_path):
|
||||||
UsdShade.Material.Define(stage, mat_usd_path)
|
UsdShade.Material.Define(stage, mat_usd_path)
|
||||||
UsdShade.MaterialBindingAPI(mesh.GetPrim()).Bind(
|
UsdShade.MaterialBindingAPI(mesh.GetPrim()).Bind(
|
||||||
|
|||||||
Reference in New Issue
Block a user