My use case is this:
1. Exporting a usd asset with materials from Unreal (which due to UE's USD implementation makes the materials import as UsdPreviewMaterials).
2. Using a python lop to build a proper MaterialX material within the existing material network.
3. Being able to append an Edit Material LOP to check everything is wired up correctly.
I do not wish to programmatically append a material edit lop and load the network for what will eventually be hundreds of assets, I'm hoping to achieve this using the USD python API or whatever sorcery the Edit Material Lop uses.
Example below has a basic USD MaterialX Builder manually created inside a material library ('materiallibrary6').
Then you can see the python lop attempting to make a basic material. The Scene Graph prims appear correctly as far as I can see.
Third pic is when I load the programmatically created material into an Edit Material Lop. The contents are empty, although the material container does get created as a subnet.
from pxr import Usd, UsdShade, Sdf # Get the current USD stage from the LOP node context node = hou.pwd() stage = node.editableStage() # Define the path for the material material_path = Sdf.Path("/materials/my_custom_material") # Create the Material Prim material_prim = UsdShade.Material.Define(stage, material_path) material_primpath = stage.GetPrimAtPath(material_path) material_primpath.ApplyAPI("MaterialXConfigAPI") #Apply correct API Schema to Material container # Create a Shader Prim inside the material shader_path = material_path.AppendPath("mtlx_standard_surface") shader_prim = UsdShade.Shader.Define(stage, shader_path) shader_prim.CreateIdAttr("ND_standard_surface_surfaceshader") shader_primpath = stage.GetPrimAtPath(shader_path) shader_primpath.ApplyAPI("NodeGraphNodeAPI") #Apply correct API Schema to Shader

