Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usdzip --asset #2135

Closed
nicolaspopravka opened this issue Dec 19, 2022 · 2 comments
Closed

usdzip --asset #2135

nicolaspopravka opened this issue Dec 19, 2022 · 2 comments

Comments

@nicolaspopravka
Copy link
Contributor

nicolaspopravka commented Dec 19, 2022

Description of Issue

Following the asset structure guidelines and given an asset named, well, asset, I have something like this:

% cat asset/asset.usd
#usda 1.0
(
    defaultPrim = "asset"
)

def Xform "asset" (
    assetInfo = {
        asset identifier = @asset/asset.usd@
        string name = "asset"
    }
    kind = "component"
    prepend payload = @payload.usd@
)
{
}

I now want to flatten this asset and conveniently zip it and its textures behind its payload into one file. I then run this:

% usdcat --flatten --out asset/asset.usdc asset/asset.usd
% usdzip --verbose --asset asset/asset.usdc asset/asset.usdz
Not recursing into sub-directories.
Creating USDZ package at '.\asset\asset.usdz' containing asset @.\asset\asset.usdc@.
.. adding layer @c:/<...>/asset/asset.usdc@ to package at path 'asset/asset.usdc'.
.. adding layer @c:/<...>/asset/asset.usd@ to package at path 'asset/0/asset.usd'.
.. adding layer @c:/<...>/asset/payload.usd@ to package at path 'asset/0/payload.usd'.
...
.. adding file 'd:\<...>\tx2.exr' to package at path '2/tx2.exr'.
.. adding file 'd:\<...>\tx1.exr' to package at path '1/tx1.exr'.

While it works and all texture referenced in are made local into the resulting USDZ file, all the original unflattened layers are also zipped in. For these not to be included, what I expect after the flattening, I need to remove the line asset identifier = @asset/asset.usd@ from the root layer file. This makes me think my use of --asset is not "typical" of its intent. Unless this is not intentional ?

@nicolaspopravka
Copy link
Contributor Author

nicolaspopravka commented Dec 19, 2022

@spiffmon replied on usd-interest:

Hi Nicolas,
Two things:

Firstly, this is not a case we took into account, and I'd agree those results are not desirable. If you flattened an asset in your pipeline, it may still be useful to have the assetInfo telling you where the previously-referenced assets live. But your intent when flattening for packaging in usdz clearly does not want that. So I believe the proper solution here is to add a --flatten argument to usdzip that can be used in combination with --asset, and only when --flatten is specified, first remove the assetInfo["identifier"] entries from all prims in the flattened stage, prior to performing asset dependency analysis (which doesn't know semantically that identifiers should be treated any differently than any other asset-paths). Would you file an Issue for that? As a workaround, it should be a pretty simple script to write to do that cleanup yourself on the flat usd, prior to running usdzip, as you say you did manually.

Secondly, wondering if you can confirm that, in the "broken" case, the identifiers you get in the usdz do actually resolve to the assets that got undesirably packaged into your usdz?

@sunyab
Copy link
Contributor

sunyab commented Jan 3, 2023

Filed as internal issue #USD-7834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants