-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cmdline ar resolver #165
Cmdline ar resolver #165
Conversation
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.
Hey @elrond79, I had a couple of notes and questions down below. Thanks!
pxr/usd/bin/usddiff/usddiff.py
Outdated
# Sdf.Layer.FindOrOpen first | ||
args = [] | ||
for arg in origArgs: | ||
layer = Sdf.Layer.FindOrOpen(arg) |
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.
I think this would break usddiff in the case where you pass in directories to compare, since args (and origArgs) would contain directory names. You would wind up calling Sdf.Layer.FindOrOpen on a directory, which would fail and result in a ValueError getting raised.
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.
See my response to the comment above...
pxr/usd/bin/usddiff/usddiff.py
Outdated
origArgs = args | ||
|
||
# path may not be a "real" path due to custom resolvers... so use | ||
# Sdf.Layer.FindOrOpen first |
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.
I'm concerned about the performance impact of using Sdf.Layer.FindOrOpen to try to deal with custom asset paths that may not have a corresponding file on the filesystem. It seems like we don't really care about loading the layer here, we just want to know whether a layer at that path actually exists. So instead of doing this, could we try to use Ar.Resolver.Resolve somehow to give us this information?
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.
Hmm, good point. Essentially want we want to do here is just validate using the ArResolver. I actually posted a question on the mailing list about this (and some other resolver issues) - see the third question here: https://groups.google.com/forum/#!topic/usd-interest/E3huSatYrLI
Assuming that we can rely on getting back an empty string as a form of validation, I think maybe the best thing to do is to just replace the look that checks for existence with one which checks that either it resolves to non-empty, OR it's a dir (per your next note).
UsdStageRefPtr const& stage = UsdStage::Open(rootLayer, sessionLayer, | ||
ArGetResolver().GetCurrentContext(), | ||
UsdStageRefPtr const& stage = UsdStage::Open(rootLayer, sessionLayer, | ||
ArGetResolver().CreateDefaultContextForAsset(fileName), |
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.
What was the reason for changing this to use a new context rather than whatever context was currently bound?
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.
Hmm, just confusion about best practices - see my first question here: https://groups.google.com/forum/#!topic/usd-interest/E3huSatYrLI
Going off of some other examples (ie, usdviewq/mainWindow.py, and _createPathResolverContext), it seemed like the "best" thing to do was, if you knew the path you were about to open, to create a context for it. Apologies if this isn't the proper thing to do - I will remove this change!
// absolute paths | ||
std::string expandedPath = mayaFile.expandedFullName().asChar(); | ||
ArResolver& resolver = ArGetResolver(); | ||
resolver.ConfigureResolverForAsset(expandedPath); |
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.
I don't think we should reconfigure the resolver here, since that's a stateful change that potentially affects all subsequent consumers of ArResolver for path resolution. Can you describe what issue you were running into here?
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.
Again, just confusion about best practices.
Your comment about this being a stateful change helps clarify things somewhat, though - on re-reviewing the existing code, it seems like everywhere that's calling ConfigureResolverForAsset is doing so from within "application level" code. I'll remove that line.
First - thanks for the code review, was very helpful! Second - I'm making the changes noted... and realizing that using on-disk filepaths and unresolved asset paths interchangeably is tricky, once directories get involved. For simplicity, I'm going to make the following assumptions:
I'll add a note to the parser help to this effect. Let me know if you'd rather proceed in a different manner. |
8f6c5be
to
191720a
Compare
191720a
to
d4a74d5
Compare
So, I pushed a fresh branch where I've made the changes requested. Sorry for the delay - we're in the middle of migrating our commits over to topgit to make juggling our various patches more manageable. Anyway, this branch is a "clean" history - if you want to see all the incremental changes, I can push the topgit patch branches. Thanks again for the review! |
Pushed a new version that fixed a test failure... formerly failed testUsdDiffToolVariousFormats4 + 5 - _getFileFormat wasn't returning None for unrecognized file formats |
Filed as internal issue #147131. |
Hi @elrond79, I was trying to merge this in but I still run into a test failure with testUsdDiffToolVariousFormats5: Traceback (most recent call last): Do you guys see the same thing? Or is this something on my end? |
d4a74d5
to
dd7f456
Compare
Oops - sorry, yes, that is a problem we saw, and fixed a while ago... but apparently forgot to push a refreshed PR. The PR should be up-to-date now. For your reference, here's the (non-collapsed) commit that fixed this: |
ie, can now do "usdview custom://asset_bigGuy/costume_red/version_0023" (assuming you have a custom ArResolver to handle "custom://" paths) usdview, usdcat, usdcheck, and usddiff should now all work with unresolved paths; usdstitch already worked usdstitchclips and usdGenSchema are untested, due to not having appropriate inputs on hand; usdrender is untested, due to not having a OpenGL.raw._GLX module
9586848
to
fdb3a78
Compare
Rebased the PR to resolve merge conflicts... |
…fix_frameRecorder_failure OGSMOD-2625: Fix test case "testUsdAppUtilsFrameRecorder" failure
Description of Change(s)
Fixes to allow usage of unresolved asset paths with both the command-line tools and the katana plugin
Included Commit(s)
LumaPictures@f903a6eLumaPictures@c575ac5LumaPictures@55502b7562ec2c2a63b36d4a74d5eb95591790810bdd7f456cf84e05
b9cef7b
fdb3a78
Fixes Issue(s)
None previously reported (that I know of...)