Representation of invalid HdSceneIndexPrim

It is often very convenient to have a concept of an invalid object, to represent error conditions or invalid queries. An invalid HdSceneIndexPrim

seems to be one that has a null data source, as demonstrated here:

It appears that it is legal for the prim type to be empty for a valid prim, which is then a typeless prim. Only the dataSource data member determines an invalid prim, when it is null. Is this interpretation correct?

My uncertainty is based on the fact that a retained scene index uses an SdfPathTable to store prims:

And SdfPathTable inserts missing ancestors on inserting a prim:

However, inserted ancestors are inserted with the default mapped type:

which for HdSceneIndexPrim is a prim with a null data source.

Therefore, a retained scene index can return prims that have a null data source. Hopefully someone can explain what appears to me to be a discrepancy. Thanks for any help!

Pierre

You’re correct that we do have typeless prims with data. I think sometimes we have typeless prims without data (but which have a path, and might later get data), and currently those are represented by a null datasource; I don’t think that’s semantically a problem, although it requires a null check before you refer to the datasource. Does that all make sense?

I guess if we wanted an invalid value with a null datasource, we could have the default constructor refer to a static empty container datasource.