How to check if SdfPrimSpec is empty?

I want to catch data that looks like this: over “foo” {}. That example would be considered “empty”

However these are not empty:

  • over “foo” (some=”thing”) {} - Defines some metadata, could be anything
  • over SomeType “foo” {} - Defines a type
  • over “foo” { over “child” { … } } - Has a child
  • over “foo” { variantSet “thing” = { … } } - Has a variantSet

In my case, the entry-point is a Sdf.Layer and I’m trying to delete all “empty” overs recursively until there are no empty overs left.

For example for a layer like this:
over “foo” { over “child” {} }

The first iteration would detect and remove “/foo/child”, then the second iteration would detect and remove “/foo” because it no longer has anything in it. If something like that doesn’t already exist, I can handle removing the PrimSpecs but I need something to discover them.

I saw some references to “IsInert” in the code-base but so far haven’t found exactly what I’m looking for. Does anyone know an easy way to find empty-overs (Sdf, ideally)?

Nevermind it was just prim_spec.isInert. Not sure how I missed that one!