UsdImagingGL engine doesn't refresh/update its authored purposes cache when purposes are changed on USD prims. Thus, it's not possible to see dynamically the effect of purposes edition without resetting the engine
Steps to Reproduce
Here is a little code that presents the bug
Test() {
mParams.showGuides = true;
mParams.showProxy = true;
mParams.showRender = false;
mRenderer = std::make_shared<UsdImagingGL>();
m_stage = UsdStage::CreateNew("sphere.usd");
UsdGeomXform::Define(m_stage, SdfPath("/xfo"));
UsdGeomSphere::Define(m_stage, SdfPath("/xfo/sphere"));
}
void renderPurpose(const TfToken& purpose) {
UsdPrim prim = mStage->GetPrimAtPath(SdfPath("/xfo/sphere"););
if (prim.IsA<UsdGeomImageable>()) {
UsdGeomImageable imageable(prim);
TfToken token(purpose);
VtValue vtValue(token);
UsdAttribute attribute = imageable.CreatePurposeAttr(vtValue);
}
mRenderer.reset(new UsdImagingGL); // --> !!! Need to re-construct the render engine to see the effects of a purpose change
mRenderer->Render(mDefaultPrim, mParams);
}
private:
UsdStageRefPtr mStage;
UsdImagingGLRefPtr mRenderer;
UsdImagingGLEngine::RenderParams mParams;
}
Make sure that the Render and Guide purposes are turned off. You should only see a sphere.
In the Interpreter window, run:
i = UsdGeom.Imageable(usdviewApi.stage.GetPrimAtPath('/sopimport1/mesh0'))
i.GetPurposeAttr().Set(UsdGeom.Tokens.default)
I would expect to see the grid (mesh_0) appear in the viewport, but it does not. Changing the display purposes at this point will force a refresh that will make the grid show up.
Description of Issue
UsdImagingGL engine doesn't refresh/update its authored purposes cache when purposes are changed on USD prims. Thus, it's not possible to see dynamically the effect of purposes edition without resetting the engine
Steps to Reproduce
Here is a little code that presents the bug
System Information (OS, Hardware)
All
Package Versions
0.8.5
Build Flags