david-cattermole / mayaMatchMoveSolver

A Bundle Adjustment solver for MatchMove related tasks.
https://david-cattermole.github.io/mayaMatchMoveSolver/
Other
101 stars 29 forks source link

Maya Tool - Reparent Under Node Fails with Locked Attributes #228

Closed david-cattermole closed 2 years ago

david-cattermole commented 2 years ago

Problem

The "Reparent Under Node" tool will error with the viewport hidden when a child node has locked channels.

If a child node has locked attributes, the attributes should either be unlocked/re-locked or skipped. Locked attributes should never cause the tool to fail and leave the viewport broken.

The traceback:

# Traceback (most recent call last):
#   File "C:\Users\username\Documents\maya\2020\modules\mayaMatchMoveSolver-0.3.14-maya2020-win64\python\mmSolver\tools\reparent2\ui\reparent2_window.py", line 115, in apply
#     tool.reparent(children_nodes, parent_node)
#   File "C:\Users\username\Documents\maya\2020\modules\mayaMatchMoveSolver-0.3.14-maya2020-win64\python\mmSolver\tools\reparent2\tool.py", line 146, in reparent
#     delete_static_anim_curves=bool(delete_static_anim_curves),
#   File "C:\Users\username\Documents\maya\2020\modules\mayaMatchMoveSolver-0.3.14-maya2020-win64\python\mmSolver\tools\reparent2\lib.py", line 208, in reparent
#     maya.cmds.orientConstraint(parent, child)
# RuntimeError: # Connection not made: 'pSphere1_orientConstraint1.constraintRotateX' -> 'pSphere1.rotateX'.  Destination is locked.
Could not add constraint or connections.
# 

Steps to Reproduce

  1. Create 2 objects, A and B.
  2. Lock the rotation XYX for object B.
  3. Open the Reparent tool UI.
  4. Choose A as the parent, and B as the child(ren).
  5. Press "Apply" button. The error will be displayed in the Script Editor, and the viewport will disappear.

Software Versions

david-cattermole commented 2 years ago

The above bug is now fixed. The user will be warned when nodes are locked, and the user can then cancel or continue (knowing the locked nodes will cause issues).

I also found another bug; when a node that is un-parented to world is reparented to the world, the tool will detect there is nothing to do and skip the operation on that node.

This will be released in v0.3.15.