Here’s some sample code for referencing USD files and transforming them:
Code for referencing USD files into a shot stage in C++ would be something like this:
// Reference the "Models/Sphere.usd"
{
pxr::SdfPath pathRef = pathWorld.AppendChild(pxr::TfToken("RefSphere"));
pxr::UsdPrim primRef = stage->OverridePrim(pathRef); // Create an "over".
primRef.GetReferences().AddReference("Models/Sphere.usd");
primRef.SetInstanceable(true); // Let the renderer instance the referenced part geometry if it's used more than once.
pxr::UsdGeomXformable xform(primRef);
xform.ClearXformOpOrder();
pxr::GfVec3f translation(-1.25f, 0.0f, 0.0f); // Move to the left.
pxr::UsdGeomXformOp xformOp = xform.AddTranslateOp(pxr::UsdGeomXformOp::PrecisionFloat); // Default would be PrecisionDouble.
xformOp.Set(translation);
}
As for referencing MDL files, if you know their location you can use the Connect Sample’s MDL shader specification code in the static void createMaterial(UsdGeomMesh meshIn)
function.