How to remove variantset in SDF Python?

In C++, I can call RemoveVariantSet on the SdfPrimSpec.

But how do I do the same in Python?

The variantSets wrapper doesn’t seem to have a remove or pop method?

You’d need access to the VariantSetSpec to remove it. Technically you’d need access to the PrimSpec.variantSets.

Basically you’d need to del it from the owner’s variantSets. Given a spec here is an example on how to remove it.

I’m pretty sure the USD Survival Guide might be a helpful read on this topic as well.

So from the SdfPrimSpec you’d basically do:

del prim_spec.variantSets[variant_set_name]
1 Like

Thanks!

I didn’t find it in the survival guide, but I might have overlooked.

Strange that to remove a variant, you call RemoveVariant on the Sdf.VariantSetSpec, and del set_spec.variants[variant_name] doesn’t work, but to remove a variantset, you call del prim_spec.variantSets[variant_set_name], and RemoveVariantSet doesn’t exist?

That does indeed seem like an inconsistency, likely going back more than 15 years!