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

null and anonymous layer checks #1212

Merged
merged 2 commits into from
Feb 26, 2021
Merged

Conversation

fowlertADSK
Copy link
Contributor

No description provided.

Comment on lines 507 to 509
if (!layer->IsAnonymous()) {
layer->Save();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a larger change coming where we handle anonymous root layers better, but this avoids the error that is printed to the script editor even though everything appears to work correctly. The problem with an anonymous root layer is that we Export it and then do a setAttr on the filePath attribute of the proxy to update it, but right here after we've done the Export we are still holding on to the old root layer. All we need to do here is skip the anonymous layer, and it will be replaced shortly after when the proxy computes again.

Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to consider using SdfLayer::PermissionToSave() instead which will catch the anonymous case as well as others that might be problematic, such as saving to a muted layer:

https://github.com/PixarAnimationStudios/USD/blob/dc710925675f7f58f7a37f6c18d046a687b09271/pxr/usd/sdf/layer.cpp#L2011

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I'm remember this one while I continue cleaning up some of the serialization code.

@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Feb 25, 2021
@kxl-adsk kxl-adsk added the workflows Related to in-context workflows label Feb 25, 2021
@kxl-adsk kxl-adsk merged commit 02fdccd into dev Feb 26, 2021
@kxl-adsk kxl-adsk deleted the fowlert/MAYA-109952/nullptr_check branch February 26, 2021 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants