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

disable shading import in UsdMayaTranslatorCamera::ReadToCamera() #849

Conversation

mattyjams
Copy link
Contributor

Some additional fallout following #822. This is a workaround specific to ReadToCamera(), but we may want to reconsider how/when the UsdPreviewSurface shading mode conversion is registered to fix this for all potential cases.

Code that links against mayaUsd but otherwise does not load any Maya plugins currently encounters an error that looks like this when it calls ReadToCamera():

Error in '_shadingModesImportArgs' at line 244 in file ext/mayapkg/maya_open_source/maya-usd/lib/mayaUsd/fileio/jobs/jobArgs.cpp : 'Unknown material conversion 'UsdPreviewSurface''```

The issue is that the UsdPreviewSurface shading conversion is specified as the default in the default args dictionary in the mayaUsd core, but that conversion is only registered when one of the mayaUsdPlugin, usdPreviewSurface, or pxrUsdPreviewSurface plugins are loaded.

Since in this case we're only interested in importing cameras, we can work around that issue for now by overriding shadingMode in the default args dictionary and disabling shading import.

Code that links against mayaUsd but otherwise does not load any Maya plugins
currently encounters an error that looks like this when it calls ReadToCamera():

Error in '_shadingModesImportArgs' at line 244 in file ext/mayapkg/maya_open_source/maya-usd/lib/mayaUsd/fileio/jobs/jobArgs.cpp : 'Unknown material conversion 'UsdPreviewSurface''

The issue is that the "UsdPreviewSurface" shading conversion is specified as
the default in the default args dictionary in the mayaUsd core, but that
conversion is only registered when one of the mayaUsdPlugin, usdPreviewSurface,
or pxrUsdPreviewSurface plugins are loaded.

Since in this case we're only interested in importing cameras, we can work
around that issue for now by overriding "shadingMode" in the default args
dictionary and disabling shading import.
@mattyjams mattyjams added import-export Related to Import and/or Export regression Something that used to work is no longer working labels Oct 19, 2020
@kxl-adsk
Copy link

@mattyjams I'm not familiar with ReadToCamera, where is it used?

@mattyjams
Copy link
Contributor Author

@mattyjams I'm not familiar with ReadToCamera, where is it used?

@kxl-adsk It looks like it's not actually used by any other code in maya-usd, but internally we have a simple tool that uses it to transfer a static camera in USD to an existing Maya camera.

ReadToCamera() is pretty much the same thing as Read() except that it bypasses all of the node creation and imports onto a camera node already in the scene. I imagine this is probably functionality that we'd like all of the translators to have at some point, though admittedly probably not implemented like this. We just do so much with cameras that we added this helper function as a special case.

@kxl-adsk
Copy link

I see how this is useful and it would be great to have a test for it.

@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Oct 20, 2020
@kxl-adsk kxl-adsk merged commit f1f393a into Autodesk:dev Oct 20, 2020
@mattyjams mattyjams deleted the pr/disable_shading_import_in_UsdMayaTranslatorCamera_ReadToCamera branch October 20, 2020 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import-export Related to Import and/or Export ready-for-merge Development process is finished, PR is ready for merge regression Something that used to work is no longer working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants