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

feat: adding httpResolver #20

Open
wants to merge 1 commit into
base: adsk/feature/wasm
Choose a base branch
from

Conversation

beersandrew
Copy link

Description of Change(s)

  • added httpAsset resolver that while resolving the first asset with an http path, will save that baseUrl and search for assets relative to that path. Calls are made in JS through EM_JS calls, and using -sASYNCIFY allows this call to JS to be synchronous from the C++ side.
  • [X ] I have verified that all unit tests pass with the proposed changes
  • [X ] I have submitted a signed Contributor License Agreement

- added httpAsset resolver that while resolving the first asset with an http path, will save that baseUrl and search for assets relative to that path. Calls are made in JS through EM_JS calls, and using -sASYNCIFY allows this call to JS to be synchronous from the C++ side.
// This path is chosen because if an asset is found with the path /../../../ it will go up the tmp directory structure
// in the case of using /tmp/ then all relative paths greater than depth 1, will look the same. using 6 here is arbitrary,
// is there a way to make this always work?
setBaseTempDir(tempDir.generic_string() + "/1/1/1/1/1/1/");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the right way to handle this? Originally I was saving the base asset in the base tmp dir (something like /tmp/baseAsset.usda). However, when assets reference other assets in parent folders (something like ../../../../materials/red.usda, it seems correct to make sure to save that asset in the virtual file system at the same relative place to the original base asset. Here I've arbitrarily created 6 folders called '1' just to allow for up to 6 directories above the root asset. Is there a good way to make this generic? Am I missing something?

void setBaseTempDir(const std::string &tempDir) const;
private:
mutable std::string baseUrl;
bool verbose = false;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a bad way to debug / set flags? I wasn't able to understand how to properly set debug flags within wasm (something like TF_DEBUG). Is that possible?

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.

1 participant