There is a problem with how the HdMerginsSceneIndex handles _PrimsRemoved which can lead to hydra accessing invalid/expired UsdPrim objects, which results in exceptions being thrown and a failed hydra sync.
Steps to Reproduce
Expand the attached zip file and open usdview on output0.usda, with USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1.
prim_removal.zip
In the interpreter window, run the following code. This will cause usdview to show a grid of instanced cubes. All good.
l = usdviewApi.stage.GetRootLayer()
with Sdf.ChangeBlock():
l.subLayerPaths = ['F:/hips/139418/output1.usda']
In the interpreter window, run the following code. This should delete the point instancer and replace it with a single cube. But the update process throws an exception.
with Sdf.ChangeBlock():
l.subLayerPaths = ['F:/hips/139418/output2.usda']
The exception I see in the console is:
ERROR: Usdview encountered an error while rendering.Used expired 'Cube' prim </i
nstancer1/Prototypes/things/cube> - UsdExpiredPrimAccessError thrown:
-> Usd_ThrowExpiredPrimAccessError at F:\dev_tools\src\usd\usd-24.08\USD-py3.11
-qt5\pxr\usd\usd\primData.cpp:266 from
#0 0x00000000c351a44c in Tf_Throw<UsdExpiredPrimAccessError,basic_string<
char,char_traits<char>,allocator<char> > >+0xcc
#1 0x00000000c351a373 in Tf_Throw<UsdExpiredPrimAccessError,basic_string<
char,char_traits<char>,allocator<char> > >+0x43
#2 0x00000000c3517e68 in Usd_ThrowExpiredPrimAccessError+0x118
#3 0x00000000cc0d0e10 in Usd_PrimDataHandle::operator->+0x40
#4 0x00000000cc3554bc in UsdPrim::IsInstance+0x1c
#5 0x00000000cc354eb5 in UsdImagingDataSourceUsdPrimInfo::Get+0x175
#6 0x00000000cc5c01a2 in `anonymous namespace'::_RerootingSceneIndexConta
inerDataSource::Get+0xd2
#7 0x00000000cc278bc0 in HdSchema::_GetTypedDataSource<HdTypedSampledData
Source<SdfPath> >+0x80
#8 0x00000000cc597097 in UsdImagingUsdPrimInfoSchema::GetNiPrototypePath+
0x57
#9 0x00000000cc4046bf in `anonymous namespace'::_IsUsdNativeInstance+0x4f
#10 0x00000000cc404855 in `anonymous namespace'::_GetDrawMode+0x95
#11 0x00000000cc403823 in UsdImagingDrawModeSceneIndex::_PrimsDirtied+0x44
3
#12 0x00000000c246fbea in HdSingleInputFilteringSceneIndexBase::_Observer:
:PrimsDirtied+0x4a
#13 0x00000000c26f8282 in HdSceneIndexBase::_SendPrimsDirtied+0x102
#14 0x00000000c2485d2c in HdFlatteningSceneIndex::_PrimsAdded+0x26c
#15 0x00000000c246fb2a in HdSingleInputFilteringSceneIndexBase::_Observer:
:PrimsAdded+0x4a
... 40 more frames
Description of Issue
There is a problem with how the HdMerginsSceneIndex handles _PrimsRemoved which can lead to hydra accessing invalid/expired UsdPrim objects, which results in exceptions being thrown and a failed hydra sync.
Steps to Reproduce
USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1
. prim_removal.zipSystem Information (OS, Hardware)
Windows
Package Versions
USD 24.08