Difference between Added and Appended references

Traversing primspecs to find references I noticed there is a distinction between “added” and “appended” references.

i.e. in python Im getting a referenceList result like:

{ 
'added': [],
'prepended': [
    SdfReference(my_id1.usd, /cone_geo, SdfLayerOffset(0, 1), {}), 
    SdfReference(my_id2.usd, /cylinder_geo, SdfLayerOffset(0, 1), {})
],
'appended': [], 
'deleted': [], 
'ordered': [] 
}

I cant see much distinction in the docs between “add” and “append” - is there anything I should watch out for there? (Indeed I cant see any method that looks like an “appendReference”)

Also interesting is that I constructed this example using only the Prim.GetReferences().AddReference() method, yet these are described as prepended references. Is that something I should be concerned about?

Appreciate any clarity!
Phil

Hi @PhilS,
added is considered deprecated, and the UsdPrim-based API’s will not ever create “added” entries for you. added listOps have some complicated ordering behavior to them that was originally deemed useful in Presto, but prevent lossless “flattening” of layerStacks. About six years ago we rethought how listOps could work, and replaced the add & reorder (the ordered field in your above example) with append and prepend. Add and Reorder are still there in Sdf only because we have yet to update Presto’s API’s to use them, or updated the many many Presto assets that use them.

We decided not to change the UsdReferences (et al) method names, and instead added a position argument that lets you specify whether you want appending or prepending.

2 Likes

Thanks for clearing that up @spiff!