Skip to content

HdMergingSceneIndex re-adds removed prims during UsdImaging stage change #3967

@lanthia-adsk

Description

@lanthia-adsk

Hi,

We are encountering an issue in MayaHydra where prims from a previous USD source are not removed when the source file of a USD node is changed, resulting in overlapping geometry from the old and new stages in the viewport.

We get the following call sequence :

  1. void UsdImagingStageSceneIndex::SetStage(UsdStageRefPtr stage) was called with a null stage.
  2. UsdImagingStageSceneIndex::_SendPrimsRemoved({SdfPath::AbsoluteRootPath()}); was called to remove all prims.
  3. void HdMergingSceneIndex::_PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) was called and forwarded the removal by
    _SendPrimsRemoved(entries);
     However, after the removal propagation,
    _SendPrimsAdded(addedEntries);
    is called, which re-adds all previously removed prims.

This causes the prims from the old USD source remain active alongside prims from the new source, causing overlapping objects in the Hydra viewport. The stale prims are only cleared when the Hydra viewport is fully destroyed and recreated (for example, by switching viewports).

By reverting commit b4112c7, the problem goes away. We believe this might be similar to issue #3563 .

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions