I want to remove all payloads from a usd stage and write a flattened layer for debugging. I saw previous topics on this but wasn’t convinced this was a bad idea. This function eliminates 90% of the payloads but not all of them. Does this need a change in my understanding or a change in the code (or both)?
def minibake(src, dst):
stage = Usd.Stage.Open(src)
clobber = []
for prim in stage.TraverseAll():
for spec in reversed(prim.GetPrimStack()):
if spec.payloadList.GetAddedOrExplicitItems():
clobber.append(spec)
for spec in reversed(clobber):
spec.payloadList.ClearEditsAndMakeExplicit()
spec.payloadList.explicitItems = []
stage.Flatten().Export(dst)