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

install and remove UsdMayaDiagnosticDelegate for adsk plugin load and unload #1003

Conversation

mattyjams
Copy link
Contributor

These changes make mayaUsdPlugin use UsdMayaDiagnosticDelegate in the same way that the pxrUsd plugin currently does. The delegate's install and remove functions were modified slightly to make this work, using a pattern similar to the one used for MayaUsdProxyShapePlugin.

The diagnostic delegate takes care of intercepting messages emitted by the Tf library in core USD and relaying them to the appropriate MGlobal functions (e.g. displayWarning(), displayError(), etc.).

This should address an issue @ysiewappl ran into in #952 where it was necessary to explicitly call both diagnostic functions with the same message:
https://github.com/Autodesk/maya-usd/pull/952/files#r539582025

It also turns out that this fixes an issue @ppt-adsk ran into where the full error message in Python exceptions was not making it through in the testUsdExportStripNamespaces test.

…lugins

This adds an installation count that is used to determine whether to construct
or destroy the shared UsdMayaDiagnosticDelegate when multiple calls to the
static InstallDelegate() and RemoveDelegate() functions are made. This ensures
that only a single instance of the delegate is installed when for example both
the "pxrUsd" and "mayaUsdPlugin" Maya plugins are loaded, and that the delegate
is not removed until both plugins are unloaded.

The installation counter follows a similar pattern to the one used for
MayaUsdProxyShapePlugin.
It turns out that the absence of UsdMayaDiagnosticDelegate when using the
mayaUsdPlugin was the reason that the full error message was being suppressed.
Now that mayaUsdPlugin installs the delegate as well, we can test for the
correct error message.
@mattyjams mattyjams added the adsk Related to Autodesk plugin label Dec 14, 2020
@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Dec 15, 2020
@kxl-adsk kxl-adsk merged commit c411bab into Autodesk:dev Dec 15, 2020
@mattyjams mattyjams deleted the pr/install_and_remove_diagnostic_delegate_for_adsk_plugin_load_and_unload branch December 15, 2020 01:42
ysiewappl added a commit to dgovil/maya-usd that referenced this pull request Dec 17, 2020
ysiewappl added a commit to dgovil/maya-usd that referenced this pull request Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants