OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

UsdUtils.ModifyAssetPaths strips empty paths from asset array attributes

Open marktucker opened this issue 1 year ago • 3 comments

Description of Issue

UsdUtils.ModifyAssetPaths strips empty asset paths from asset array attributes. This makes sense for composition arcs, but for attributes/primvars, this kind of arbitrary manipulation of array contents (and lengths!) is likely to break things. This change appears to be new, probably cause when ModifyAssetPaths moved over to the AssetLocalization framework.

Steps to Reproduce

  1. Extract the attached asset_array.usda: asset_array.zip
  2. Run the following script in python:
def cb(asset):
    return asset

from pxr import Usd, UsdUtils, Sdf
l = Sdf.Layer.FindOrOpen("asset_array.usda")
print(l.ExportToString())
UsdUtils.ModifyAssetPaths(l, cb)
print(l.ExportToString())
  1. The result should be completely unchanged (since the callback doesn't change any asset paths), but instead the empty asset paths have been stripped from the asset array.

Package Versions

24.03

marktucker avatar Apr 26 '24 16:04 marktucker

Filed as internal issue #USD-9595

jesschimein avatar Apr 26 '24 16:04 jesschimein

Thanks, @marktucker - agreed and we'll try to get this addressed for the next release.

spiffmon avatar Apr 26 '24 22:04 spiffmon

Thanks. I have a PR that I just need to do a little more testing on before I submit it for your approval (hopefully).

marktucker avatar Apr 27 '24 02:04 marktucker