For what it’s worth, I was running into the same issue. UE materials assigned to prims in the stage editor does apply the materials but the change is not persistent, meaning that if you save your usd session file, and reload the Unreal project later, the UE materials are no longer applied.
The custom UE material assignment code DOES make it in the usd session file but whatever happens when it gets loaded is not what happens when you do the assignment interactively in the UI. What does work is a manual asset export to usd from within UE but it defeats the purpose of having assets from my DCC have the correct UE material automatically assigned.
I wrote a python script that takes usd assets exported from Maya, strips out any assigned materials and creates a UE material entry so the assignment happens as needed when loaded in the usd stage. I can then run a script on all the many assets exported from maya so they automatically show up in UE with their correct UE materials assigned.
assignUEMaterialToUsdMesh.py (1.9 KB)
2 Likes