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

Improve Alembic plugin to read assets with ArResolver to support other sources except local files #3302

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

roggiezhang-nv
Copy link

@roggiezhang-nv roggiezhang-nv commented Sep 19, 2024

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. However, interfaces of Alembic library have limitations that only accept local paths or std::istreams. We tried the following solutions in order to fix this:

  1. Read all assets into memory with ArResolver AND ArAsset and feed isteams into Alembic library. It works except Alembic library only accepts Ogawa format and layered assets are not supported with istreams. It also has performance implications that require all asset data to be in memory.
  2. Open assets with ArResolver. Instead of reading them into the memory, we get the mapped file path with ArchGetFileName from ArAsset::GetFileUnsafe. It doesn't work as ArchGetFileName only returns relative path to the current drive. We are not sure if it's a bug or that's the real purpose of that API.
  3. Open assets with ArResolver. Then we construct a std::filebuf with the file handle from ArAsset::GetFileUnsafe. It works and has the same limitations of 1st solution. Also, std::filebuf(FILE *) is not standard for c++ and compiler specific. This is the solution used in this MR also.
  4. Open assets with ArResolver. Instead, std::spanbuf with ArAsset::GetBuffer might be a solution with C++23. We aren't able to verify that it would work but from the docs it sounds like a good fit with the ArAsset API. It has the same limitations as 1st solution to use isteams.

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@roggiezhang-nv roggiezhang-nv changed the base branch from release to dev September 19, 2024 15:43
@jesschimein
Copy link

Filed as internal issue #USD-10155

@jesschimein
Copy link

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Successfully merging this pull request may close these issues.

2 participants