Don't let UsdUtilsModifyAssetPaths change the length of asset array attributes/metadata #3063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
When modifying asset paths in a layer, don't remove empty elements from arrays. The empty elements may be meaningful, as in primvars that must be a specific length. Updated the output of the ModifyAssetPaths "removal" test, which validates the behavior of this API when modified asset paths are empty.
Arguably, this change should perhaps be limited to USD attributes (not metadata), but depending on the use case changing the array length is still throwing away what may be important information in a pipeline.
I also considered whether an array that has all values set to empty asset paths should remove the attribute. This seems more defensible to me, but again, I'm not sure the length of the array couldn't still be considered useful information that is worth preserving in some circumstances.
I'm open to different answers on these two questions, and I believe each could be addressed without too drastic changes to this PR.
Fixes Issue(s)
UsdUtils.ModifyAssetPaths strips empty paths from asset array attributes #3060
[ X ] I have verified that all unit tests pass with the proposed changes
[ X ] I have submitted a signed Contributor License Agreement