Why does UsdImagingSelectionSceneIndex::GetPrim() add a selection data source to all prims?

seems to add a selection data source to all (valid) scene index prims. Why is that? My expectation would be that only selected scene index prims would need this. Thanks for any help.

Pierre

Hi Pierre,

The selection scene index will perform a map on every prim, but the map is evaluated (and potentially re-evaluated) lazily, and refers to the selection state. If you look up a bit: https://github.com/PixarAnimationStudios/OpenUSD/blob/0b18ad3f840c24eb25e16b795a5b0821cf05126e/pxr/usdImaging/usdImaging/selectionSceneIndex.cpp#L191 … in _PrimSource, you can see that if the prim is selected, we overlay a “selections” datasource onto it; and if not, we just pass through to the underlying scene data.

Hope that clarifies!
Tom