I want the layer's scale info, so I tried this:
float unitscale = usd_metadata(0, '/', 'metersPerUnit');
But I get a zero instead of the right unit. Is this wrong? Sorry if I'm spamming the forum with obvious questions…
float unitscale = usd_metadata(0, '/', 'metersPerUnit');
from pxr import Usd
stage = Usd.Stage.Open(<usd file path>)
unitscale = stage.GetMetadata("metersPerUnit")
>>> stage.GetObjectAtPath('/').GetAllMetadata() Traceback (most recent call last): File "<console>", line 1, in <module> RuntimeError: Accessed <pxr.Usd.Object object at 0x7f234d02b2f8>
pwd().inputs()[0].stage().GetMetadata('metersPerUnit')