mmSolver.tools.loadmarker#

Tool to load markers into Maya from various thirdparty file formats.

Tool#

The Load Marker tool - user facing.

mmSolver.tools.loadmarker.tool.open_window()#

Open the Load Marker GUI.

Library - Basics#

Module for reading marker files.

This should be used by end-users, not the internal modules.

mmSolver.tools.loadmarker.lib.mayareadfile.read(file_path, **kwargs)#

Read a file path, find the format parser based on the file extension.

mmSolver.tools.loadmarker.lib.mayareadfile.create_nodes(mkr_data_list, cam=None, mkr_grp=None, col=None, with_bundles=None, load_bundle_position=None, camera_field_of_view=None)#

Create Markers for all given MarkerData objects

Parameters:
  • mkr_data_list ([MarkerData, ..]) – List of MarkerData with data for creating markers.

  • cam (Camera) – Camera to create Markers under.

  • mkr_grp (MarkerGroup) – Marker Group, under cam, that the markers will be created under.

  • col (Collection or None) – Collection to add Markers to.

  • with_bundles (bool) – Create a bundle for each Marker.

  • load_bundle_position (bool) – Apply the 3D positions to bundle.

  • camera_field_of_view ([(int, float, float)]) – The camera field of view of the original camera with this 2D data.

Returns:

List of Markers.

Return type:

[Marker, ..]

mmSolver.tools.loadmarker.lib.mayareadfile.update_nodes(mkr_list, mkr_data_list, load_bundle_position=None, camera_field_of_view=None)#

Update the given mkr_list with data from mkr_data_list. The length of both lists must match.

Parameters:
  • mkr_list ([Marker, ..]) – Markers to update.

  • mkr_data_list ([MarkerData, ..]) – The MarkerData list to search for a match.

  • load_bundle_position (bool) – Apply the 3D positions to bundle.

  • camera_field_of_view ([(int, float, float)]) – The camera field of view of the original camera with this 2D data.

Returns:

List of Marker objects that were changed.

Return type:

[Marker, ..]

Library - Advanced#

The Load Marker tool - user facing.

mmSolver.tools.loadmarker.lib.utils.get_selected_cameras()#

Return the (associated) Camera objects from the selection.

Returns:

Camera objects.

Return type:

mmSolver.api.Camera

mmSolver.tools.loadmarker.lib.utils.get_cameras()#

Get all cameras in the scene file.

Start-up cameras are ignored (‘persp’, ‘top’, ‘side’, ‘front’, etc)

Return type:

list of mmSolver.api.Camera

mmSolver.tools.loadmarker.lib.utils.get_marker_groups(cam)#

Get all MarkerGroups for the given camera.

Return type:

list of mmSolver.api.MarkerGroup

mmSolver.tools.loadmarker.lib.utils.get_selected_markers()#

Get selected Marker object.

Return type:

list of mmSolver.api.Marker

mmSolver.tools.loadmarker.lib.utils.get_active_viewport_camera()#

Get the Camera that is attached to the active viewport.

Returns:

The Camera object, or None.

Return type:

Camera or None

mmSolver.tools.loadmarker.lib.utils.get_start_directory(file_path)#

Get a start directory for a file browser window.

Parameters:

file_path – An input

Returns:

mmSolver.tools.loadmarker.lib.utils.create_new_camera()#

Create a new camera nodes and object.

Returns:

Camera object.

Return type:

Camera

mmSolver.tools.loadmarker.lib.utils.create_new_marker_group(cam)#

Create a new marker group node and object.

Parameters:

cam (Camera) – The camera to create the Marker Group under.

Returns:

MarkerGroup object.

Return type:

MarkerGroup

mmSolver.tools.loadmarker.lib.utils.get_default_image_resolution()#

Get image resolution from Maya Render Settings (Render ‘Globals’).

Returns:

tuple of two ints.

Return type:

(int, int)

mmSolver.tools.loadmarker.lib.utils.trigger_maya_to_refresh()#

Trigger Maya to refresh.

mmSolver.tools.loadmarker.lib.utils.deferred_revert_of_config_value(config, key, old_value)#

Set the user preferences to a value, as a deferred fashion.

Camera field of view maths related functions.

mmSolver.tools.loadmarker.lib.fieldofview.get_camera_field_of_view(cam_shp, frames)#

Compute the Camera’s field of view with a camera shape node at frames.

Parameters:
  • cam_shp (str) – Maya camera shape node.

  • frames ([int, ..]) – List of frames to sample the camera/marker group

Returns:

Return type:

[(int, float, float), ..]

mmSolver.tools.loadmarker.lib.fieldofview.calculate_overscan_ratio(cam, mkr_grp, camera_fov)#

Calculate overscan with camera and FOV.

Query the overscan of cam by comparing to the camera_fov field of view.

Parameters:
  • cam (Camera) – The mmSolver.api.Camera object to query field of view from.

  • camera_fov ([(int, float, float), ..]) – Tuple of camera field of view per-frame values X and Y.

  • mkr_grp (MarkerGroup or None) – The mmapi MarkerGroup object, to be used additionally to the provided camera to calculate the overscan.

Returns:

Overscan X and Y values.

Return type:

(float, float)

Library - Formats#

Constants#

Contains constant values for the Load Marker tool.