diff --git a/pxr/usdImaging/usdImaging/instanceAdapter.cpp b/pxr/usdImaging/usdImaging/instanceAdapter.cpp index 5275f1dd4d..71df63e303 100644 --- a/pxr/usdImaging/usdImaging/instanceAdapter.cpp +++ b/pxr/usdImaging/usdImaging/instanceAdapter.cpp @@ -1261,8 +1261,11 @@ UsdImagingInstanceAdapter::ProcessPropertyChange(UsdPrim const& prim, _ProtoPrim const& proto = _GetProtoPrim(prim.GetPath(), cachePath, &instancerContext); - if (!TF_VERIFY(proto.adapter, "%s", cachePath.GetText())) { - return HdChangeTracker::AllDirty; + if (!proto.adapter) { + // Note: if we can't find the correct prototype, it may have been + // removed by a previous property update, so we can't treat it + // as an error. Instead, we just return Clean. + return HdChangeTracker::Clean; } UsdPrim protoPrim = _GetPrim(proto.path); @@ -2170,8 +2173,13 @@ UsdImagingInstanceAdapter::_GetProtoPrim(SdfPath const& instancerPath, } } } - if (!TF_VERIFY(r, "instancer = %s, cachePath = %s", - instancerPath.GetText(), cachePath.GetText())) { + + if (!r) { + // Note: for some callers, like ProcessPropertyChange, it's possible + // for this call to fail when trying to process property changes on + // things that have already been removed from the instancer map by + // a previous change. Callers that expect this call to succeed should + // TF_VERIFY(r->adapter). return EMPTY; } @@ -2457,6 +2465,10 @@ UsdImagingInstanceAdapter::GetScenePrimPath( cachePath.GetAbsoluteRootOrPrimPath(), cachePath, &instancerContext); + if (!proto.adapter) { + return SdfPath(); + } + _InstancerData const* instrData = TfMapLookupPtr(_instancerData, instancerContext.instancerCachePath); if (!instrData) { @@ -2796,6 +2808,11 @@ UsdImagingInstanceAdapter::GetVolumeFieldDescriptors( UsdImagingInstancerContext instancerContext; _ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), id, &instancerContext); + + if (!TF_VERIFY(proto.adapter, "%s", usdPrim.GetPath().GetText())) { + return HdVolumeFieldDescriptorVector(); + } + return proto.adapter->GetVolumeFieldDescriptors( _GetPrim(proto.path), id, time); }