-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve Alembic plugin to read assets with ArResolver to support other sources except local files #3302
base: dev
Are you sure you want to change the base?
Improve Alembic plugin to read assets with ArResolver to support other sources except local files #3302
Conversation
Filed as internal issue #USD-10155 |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
06a7e25
to
701b318
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
701b318
to
a020534
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
a020534
to
a52a420
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @roggiezhang-nv, thanks for opening the discussion with an implementation! We took a step back and looked at the current design and came up with the following concerns:
We're considering two other designs as well:
🤔 What do you think? |
Hi, An. Thanks for your reply. Here are my thoughts about your questions:
I may not describe it clearly. So Alembic library only accepts local URLs or override std::istream. In order to read assets that are not local, we'd have to do that in two ways:
We can simply check if the given urls exist so we can isolate the current work from the current PR. The only overhead for the current PR was in the |
d18ce48
to
44c7afd
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
42b9618
to
53615dd
Compare
/AzurePipelines run |
Pipelines were unable to run due to time out waiting for the pull request to finish merging. |
…r sources except local files
44c7afd
to
6dffeb3
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
hi @roggiezhang-nv ! Are you planning any further changes before I start some performance testing and reviews? |
@anwang2009 I added one strict checker to avoid open and release local asset twice so we treat local files the same as before without any side-effects. You can start evaluating the perf and review now. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
@anwang2009 I added one more change per request to hold assets within the lifetime of _ReaderContext. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Thanks @roggiezhang-nv , lgtm besides some minor things!
if (asset) | ||
{ | ||
FILE* fileHandle = asset->GetFileUnsafe().first; | ||
if (fileHandle) |
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.
Maybe also add the condition that the offset from GetFileUnsafe is not 0?
_ReaderContext::_OpenAndGetMappedFilePath(const std::string& filePath) | ||
{ | ||
// Return as it is if it's a local path and not a symlink. | ||
if (!TfIsFile(filePath)) |
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.
Let's resolve symlinks in this TfIsFile call
@anwang2009 All comments addressed. Thanks. |
if (asset) | ||
{ | ||
FILE* fileHandle = asset->GetFileUnsafe().first; | ||
if (fileHandle && ftell(fileHandle) == 0) |
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.
Can we use the offset that's returned by GetFileUnsafe().second instead of calling ftell?
It would be good to explain why the check against the file position is needed. I'm guessing it's to ensure that the .abc file we're looking at isn't embedded in a .usdz or other package, since the Alembic code itself won't know what to do with that.
- sunya
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.
Done.
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
a555836
to
46e0e33
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change(s)
Alembic plugin only accepts assets that are from local paths. In order to fix this, we need to use ArResolver/ArAsset to read/write contents so customized resolver can read assets from other locations. However, interfaces of Alembic library have limitations that can only accept local urls or
std::istream
. This PR uses the following solution:Open assets with
ArResolver
. Instead of reading them into the memory, we get the mapped file path with ArchGetFileName fromArAsset::GetFileUnsafe
.Fixes Issue(s)