david-cattermole/mayaMatchMoveSolver

Load Marker is not compatible with locked camera nodes

Closed this issue · 3 comments

We have a scene with both a Maya camera and a proprietary SL Maya camera hierarchy.

When I attempt Load Marker, the very existence of the proprietary camera in the Maya scene prevents Load Marker from loading markers, even to the standard Maya camera.

So I have to first remove all proprietary Maya cameras from the scene and then after successfully using Load Marker, I can reimport the proprietary camera.

Here is the error message:

global proc mmsolver_startup() { python("import mmSolver.startup; mmSolver.startup.mmsolver_startup()"); } evalDeferred("mmsolver_startup");
# Error: RuntimeError: file S:\rez_cache\maya_matchmovesolver\0.4.6\31ea\a\python\mmSolver\_api\camera.py line 61: (kFailure): Unexpected Internal Failure #

Here is a .zip of the offending Maya file:
http://michaelkarp.net/YH_000_0490_maya_techanim_chenMuchi202401AHeadStabRes5DIG.zip

  • mmSolver version: 0.4.6

  • Maya version 2022 Windows

global proc mmsolver_startup() { python("import mmSolver.startup; mmSolver.startup.mmsolver_startup()"); } evalDeferred("mmsolver_startup");
# Error: RuntimeError: file S:\rez_cache\maya_matchmovesolver\0.4.6\31ea\a\python\mmSolver\_api\camera.py line 61: (kFailure): Unexpected Internal Failure #

Hi Michael,

I think your issue is caused by locked nodes in your Maya scene. Locked nodes cannot have attributes added to them, which causes the code to break.

See the "lockNode" Python command:
https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=__CommandsPython_lockNode_html

I suspect the full traceback error looks like this:

# Warning: mmSolver.tools.solver.tool : No active Collection found, creating new Collection... #
# Error: (kFailure): Unexpected Internal Failure
# Traceback (most recent call last):
#   File "<maya console>", line 2, in <module>
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\tools\cameracontextmenu\tool.py", line 126, in create_menu
#     items = ui.create_camera_menu_items(menu_name, camera_nodes)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\tools\cameracontextmenu\ui.py", line 324, in create_camera_menu_items
#     lens_nodes = lib.get_camera_lens_nodes(shp)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\tools\cameracontextmenu\lib\lens.py", line 40, in get_camera_lens_nodes
#     cam = mmapi.Camera(shape=camera_shape_node)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\_api\camera.py", line 172, in __init__
#     self.set_shape_node(shape)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\_api\camera.py", line 328, in set_shape_node
#     _create_lens_toggle_setup(cam_tfm, cam_shp)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\_api\camera.py", line 77, in _create_lens_toggle_setup
#     _create_camera_attributes(cam_shp)
#   File "C:\Users\username\Documents\maya\2022\modules\mayaMatchMoveSolver-0.5.0.beta4-maya2022-win64\python\mmSolver\_api\camera.py", line 61, in _create_camera_attributes
#     dg_node_fn.addAttribute(attr_obj)
# RuntimeError: (kFailure): Unexpected Internal Failure # 

If you run this code in your Maya Script Editor (Python tab), the locked nodes will be unlocked and mmSolver won't fail anymore.

import maya.cmds

locked_nodes = maya.cmds.ls(lockedNodes=True, long=True) or []
for node in locked_nodes:
    print('Unlocking node: ', repr(node))

if len(locked_nodes) > 0:
    maya.cmds.lockNode(locked_nodes, lock=False)

I'll make mmSolver more resilient to Maya nodes being locked, however currently I've written mmSolver assuming that all nodes are unlocked (the default state).

Let me know if this workaround allows you to continue working.

Thanks,
David

I have a fix for this issue. The Maya scene file was very helpful finding all the potential problems.

The fix will be released in v0.5.0, and will be backported to v0.4.x later.