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

Maya API - Custom Camera Transform nodes raise an error #123

Closed
david-cattermole opened this issue Aug 30, 2019 · 4 comments
Closed

Maya API - Custom Camera Transform nodes raise an error #123

david-cattermole opened this issue Aug 30, 2019 · 4 comments
Assignees
Labels
maya utility Python modules to be used across the mmSolver project. python api The Python API for mmSolver
Milestone

Comments

@david-cattermole
Copy link
Owner

Problem

mmSolver only works with Maya transform and camera nodes. Sub-classed, custom plug-ins will cause an assertion error (because they are untested).
We should attempt to allow all types of transform nodes, even if they are custom plug-ins.

Expected behavior:
If a camera (transform and shape node) are custom (derived API nodes), then we should not error.

Actual behavior:
When loading 2D Marker data onto a camera with custom Maya transform plugin (MPxTransform), we get an assertion error.

# Traceback (most recent call last):
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/solver/ui/solver_window.py", line 365, in loadMarkerCB
#     loadmarker_tool.open_window()
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/tool.py", line 22, in open_window
#     loadmarker_window.main()
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_window.py", line 121, in main
#     delete=delete
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/ui/base_maya_window.py", line 120, in open_window
#     cls.instance = cls(parent=parent, name=name)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_window.py", line 38, in __init__
#     self.addSubForm(loadmarker_layout.LoadMarkerLayout)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/ui/base_maya_window.py", line 79, in addSubForm
#     self.subForm = SubForm(self)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_layout.py", line 77, in __init__
#     self.populateUi()
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_layout.py", line 85, in populateUi
#     selected_cameras
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_layout.py", line 122, in updateCameraList
#     self.populateCameraModel(model)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/ui/loadmarker_layout.py", line 136, in populateCameraModel
#     camera_nodes = lib.get_cameras()
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/tools/loadmarker/lib.py", line 83, in get_cameras
#     cam = mmapi.Camera(shape=node)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/_api/camera.py", line 47, in __init__
#     self.set_shape_node(shape)
#   File "/home/davidc/maya/modules/mayaMatchMoveSolver-0.2.1-maya2018-linux/python/mmSolver/_api/camera.py", line 163, in set_shape_node
#     assert tfm_dag.apiType() == OpenMaya.MFn.kTransform
# AssertionError

Steps to Reproduce

  1. Select a custom transform camera node plug-in.
  2. Run the Load Markers UI tool.
  3. We get an error.

Software Versions

  • mmSolver version:
    v0.2.1

  • Maya version:
    Maya 2018

  • Operating System (OS):
    Linux

@david-cattermole david-cattermole added the python api The Python API for mmSolver label Aug 30, 2019
@david-cattermole david-cattermole added this to the v0.4.0 milestone Aug 30, 2019
david-cattermole added a commit that referenced this issue Sep 26, 2019
@david-cattermole
Copy link
Owner Author

I have changed the mmSolver API to allow custom Maya transform node plug-ins, now. Assuming the custom transform node still uses the standard Maya translate, rotate and scale attributes, I expect any Maya transform plug-in node to work with mmSolver.

This will be merged into the master branch as part of #72 and #57.

@david-cattermole
Copy link
Owner Author

It has been reported that this issue is happening again, in v0.3.2.

@david-cattermole david-cattermole self-assigned this Feb 3, 2020
@david-cattermole david-cattermole modified the milestones: v0.3.2, v0.3.3 Feb 3, 2020
@david-cattermole
Copy link
Owner Author

The problem in question seems to be due to type checking against the transform node type explicitly.

For example:

elif node_type == 'transform':

To effectively fix the bug, and ensure we don't reintroduce the bug, we need to write unit tests for (all?) tools that work with cameras. We will need to create a test transform plug-in, and load it during the unit tests.

This is a relatively low priority problem, because workflows exist to work around the problem, and the user base affected is small.

@david-cattermole david-cattermole modified the milestones: v0.3.3, v0.3.4, v0.4.0 Feb 9, 2020
@david-cattermole david-cattermole removed their assignment Feb 14, 2020
david-cattermole added a commit that referenced this issue Oct 11, 2020
Fixed the camera utility and API modules.
Added tests for camera types, and added general tests for cameras.

Issue #123.
@david-cattermole david-cattermole modified the milestones: v0.4.0, v0.3.7 Oct 11, 2020
@david-cattermole david-cattermole added maya utility Python modules to be used across the mmSolver project. and removed help wanted labels Oct 11, 2020
@david-cattermole david-cattermole self-assigned this Oct 11, 2020
@david-cattermole
Copy link
Owner Author

Custom transform plug-in nodes will now work for cameras.

All the unit tests seem to work. It's still possible there's some mmSolver.tool.* code that doesn't work, but the utilities and API work correctly with custom transform nodes.

The only requirement of a transform node is that it's derived from a transform. It is not possible to derive a custom MPxNode with the same attributes - it must derive from MPxTransform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maya utility Python modules to be used across the mmSolver project. python api The Python API for mmSolver
Projects
None yet
Development

No branches or pull requests

1 participant