Hello. I noticed that OpenAsset is not a part of the python bindings of ArResolver. Is there any reason to not support this? It seems like ArAsset has enough information to support python’s io interfaces.
Potential workflow–
attribute = prim.GetAttribute('path_to_json_file')
jsonAssetPath = attribute.Get()
# jsonAssetPath may or may not have been resolved to a file path
jsonAsset = resolver.OpenAsset(jsonAssetPath.resolvedPath)
# `ArAsset`'s `Read` is used to get the bytes.
json.load(jsonAsset)
The proposed changes aim to expose workflows such as the following (see referenced PR for details):
# [...]
# Retrieve the content of the asset at the given `Ar.ResolvedPath`:
with Ar.GetResolver().OpenAsset(resolvedPath=resolved_asset_path) as asset:
print(f'JSON asset data: {asset.GetBuffer()}')