-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow to process USD files to use relative paths when published #957
Allow to process USD files to use relative paths when published #957
Conversation
…lug-in you can enable.
One could argue that this should really be in However, that addon currently always downloads USD libs and configures USD resolvers and whatnot - which means there's so much bloat if you just want this. (However, IF the USD libs are available to tray publisher then technically this remapping would then also work for tray publisher which could be a strong combination.) I'm just wondering - should we make that 'downloading' of USD libs and configuring of the asset resolver optional via settings in the |
We may need to test this functionality with asset paths with |
tbh i think we should move it there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if my testing was correct but the image there shows my output.
what is did:
- open houdi 20.5 create a sop lop and stored the data on my desktop
- then i created a usd also on the Desktop that references the other one
- then i referenced the second usd and created an Usd asset from it. (using the ayon Uris is enabled btw)
- but the output ends up with the correct remapping just not the Uris are remaped.
So - what the code does for now is:
Also note that if you were to load USDs from a different drive it would also fail to make it relative of course. A warning would then be logged to the publish report for that particular case. This is the code used to 'detect' the drive. With that explained, I actually feel your particular example is working exactly as it should. However, it'd be better to also test without AYON Entity URIs to confirm the asset contributions, etc. also remap accordingly. (Again, it'd only remap the new contributions because the older ones would still be using the entity URIs) |
okay then i can approve this. i assumed you would remap URIs because your PR says that you want to send the files to an external person, and that would then need the resolver no ? |
Correct - but this is about shipping those projects that are enabled like this from the beginning. It does not "fix" existing files on disk. (It's not hard to fix them with a post-script though if needed, as this code nicely shows) I can add a setting to also remap entity URIs with this processor - but once you're doing that you're better off disabling the generation of them in the first place. |
okay so this is just for the current publish then?
but yeah not having that makes sens i mean it would break the files if we make them with relative paths in the publish.
nah if its not for sending the file to an external "company" then this would be a bad idea, just imagine accidentally having it on and all you :latest url get to be paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dose its job.
tested on Linux Houdini 20.5
That'd be just a call to USD Utils API to localize the assets if you really wanted to do just that. But it's indeed not what this PR is about. Thanks for checking. |
Closing this PR in favor of PR on |
This PR has moved
This PR has been superseded by ynput/ayon-usd#70
Changelog Description
This adds a publish plug-in that is able to remap all paths inside the USD layer to a relative path. As such, by doing so - this means that all published USD files will be using solely relative paths to other published paths.
Additional info
This could allow you to 'archive' your project or share the publishes (while maintaining the project's folder structure for the publishes) and share those files with others, allow them to load it - without having to remap anything and without using an asset resolver.
This uses
UsdUtils.ModifyAssetPaths
which has existed for at least six years in USD, see commit. So should be safe to use nowadays across the board, but for completeness it was added in USD 19.03 so this feature requires USD 19.03+Example result when loading an asset back in:
The top non-relative path is just the 'path' I loaded into Houdini to check the file contents; so that not being relative is entirely correct.
Testing notes:
ayon+settings://core/publish/USDOutputProcessorRemapToRelativePaths/enabled
. (It is disabled by default.)Tested: