You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our studio pipeline, we have setup export chaser in Python, we recently found that accessing the "referenceObjectMode" argument from Python would cause Python exception, if the exception is not caught, it would cause Maya to crash.
So far we have seen "referenceObjectMode" and "exportRelativeTextures" arguments could cause problem, other arguments are working fine.
Steps to reproduce
Steps to reproduce the behavior:
Launch Maya
Run following code snippet:
# Load Maya USD pluginfrommayaimportcmdscmds.loadPlugin('mayaUsdPlugin')
# Define the export chaser in Python (minimum example):classTestExportChaser(mayaUsd.lib.ExportChaser):
def__init__(self, factoryContext, *args):
print(factoryContext)
print(factoryContext.GetJobArgs())
try:
print(factoryContext.GetJobArgs().referenceObjectMode)
exceptExceptionasexc:
print(exc)
defExportDefault(self):
returnTruedefExportFrame(self, frame):
returnTruedefPostExport(self):
returnTrue# Register the chasermayaUsd.lib.ExportChaser.Register(TestExportChaser, 'TestExportChaser')
# Export to USD file to trigger the problemfilePath='/path/to/export/location.usda'cmds.file(filePath, force=True, type="USD Export", ea=True,
options="chaser=[TestExportChaser];defaultUSDFormat=usda;referenceObjectMode=defaultToMesh;")
Maya script editor would have output like this:
<mayaUsd.lib.UsdMayaExportChaserRegistryFactoryContext object at 0x7ff8661d9540>
<mayaUsd.lib.JobExportArgs object at 0x7ff865eec220>
No Python class registered for C++ class pxrInternal_v0_23__pxrReserved__::TfToken
If the try....except.... around print(factoryContext.GetJobArgs().referenceObjectMode) wasn't there, Maya would simply crash.
Expected behavior
Be able to access "referenceObjectMode" without any problem.
Specs (if applicable):
OS & version: CentOS 7.8
Compiler & version: GCC 6.3
Maya version: Maya-2023
Maya USD: Official v0.28.0
Pixar USD: Official v23.02, v22.05
Additional context
The problem seems to be fact that TfToken was exposed directly but it should behave like a Python string, there is one related comment in USD repo: PixarAnimationStudios/OpenUSD#1194 (comment)
csyshing
changed the title
Accessing JobExportArgs "referenceObjectMode" from Python would cause Maya to crash
Accessing JobExportArgs "referenceObjectMode" or "exportRelativeTextures" from Python would cause Maya to crash
Jun 7, 2024
@csyshing Sorry for the delay. Would you be able to submit a PR with your fix and a unit test to verify that both these attributes can be properly accessed?
Describe the bug
In our studio pipeline, we have setup export chaser in Python, we recently found that accessing the "referenceObjectMode" argument from Python would cause Python exception, if the exception is not caught, it would cause Maya to crash.
So far we have seen "referenceObjectMode" and "exportRelativeTextures" arguments could cause problem, other arguments are working fine.
Steps to reproduce
Steps to reproduce the behavior:
try....except....
aroundprint(factoryContext.GetJobArgs().referenceObjectMode)
wasn't there, Maya would simply crash.Expected behavior
Be able to access "referenceObjectMode" without any problem.
Specs (if applicable):
Additional context
The problem seems to be fact that
TfToken
was exposed directly but it should behave like a Python string, there is one related comment in USD repo:PixarAnimationStudios/OpenUSD#1194 (comment)
One of the potential fixes might be changing the way how to expose this "referenceObjectMode" argument and "exportRelativeTextures" argument in Python binding, e.g.:
Changing
.def_readonly(....)
:https://github.com/Autodesk/maya-usd/blob/v0.28.0/lib/mayaUsd/python/wrapPrimWriter.cpp#L544
.def_readonly("referenceObjectMode", &UsdMayaJobExportArgs::referenceObjectMode)
To be something like:
The text was updated successfully, but these errors were encountered: