Add displayColor authoring to site geometry when converting MJCF to USD.

PiperOrigin-RevId: 789311878
Change-Id: I70027cd5d8d02f4ee26043f3b9fb03311e38984b
This commit is contained in:
Sam Haves
2025-07-31 06:27:29 -07:00
committed by Copybara-Service
parent 82cf27992d
commit b5368a3385
2 changed files with 50 additions and 22 deletions
@@ -350,6 +350,25 @@ TEST_F(MjcfSdfFileFormatPluginTest, TestGeomRgba) {
pxr::VtArray<float>{0.9});
}
TEST_F(MjcfSdfFileFormatPluginTest, TestSiteRgba) {
static constexpr char kXml[] = R"(
<mujoco model="test">
<worldbody>
<site type="sphere" name="sphere_red" size="1" rgba="1 0 0 1"/>
</worldbody>
</mujoco>
)";
pxr::SdfLayerRefPtr layer = LoadLayer(kXml);
auto stage = pxr::UsdStage::Open(layer);
EXPECT_PRIM_VALID(stage, "/test/sphere_red");
ExpectAttributeEqual(stage, "/test/sphere_red.primvars:displayColor",
pxr::VtArray<pxr::GfVec3f>{{1, 0, 0}});
EXPECT_ATTRIBUTE_HAS_NO_VALUE(stage,
"/test/sphere_red.primvars:displayOpacity");
}
TEST_F(MjcfSdfFileFormatPluginTest, TestFaceVaryingMeshSourcesSimpleMjcfMesh) {
static constexpr char kXml[] = R"(
<mujoco model="mesh test">