mmSolver.tools.savemarkerfile#

Tool to convert a Maya Camera (and Image Plane) into a file format readable by third-party software (for example, 3DEqualizer).

The aim is to make the tool similar to the Load Markers tool, allowing minimal set-up time for getting data between Maya and 3DEqualizer.

Tool#

The Save Marker File tool.

This tool will save the selected Markers to a .uv file, for loading in third-party software (such as 3DEqualizer).

mmSolver.tools.savemarkerfile.tool.main()#

Library#

The Save Marker File library functions.

Write out a mmSolver Marker node as a .uv file.

mmSolver.tools.savemarkerfile.lib.generate(mkr_list, frame_range, fmt=None)#

Convert all Markers to data that can be written out.

Parameters:
  • mkr_list ([Marker]) – List of Marker objects to convert.

  • frame_range (range) – Frame range to generate data for.

  • fmt (None or int) – The format to generate, either const.UV_TRACK_FORMAT_VERSION_1 or const.UV_TRACK_FORMAT_VERSION_4. If None, uses preferred version.

Returns:

String data (v1) or dictionary data (v4) that can be written out

Return type:

str or dict

mmSolver.tools.savemarkerfile.lib.write_file(file_path, data)#

Write data to file. Handles both string (v1) and dictionary (v4) data.

Parameters:
  • file_path (str) – Path to write the file to.

  • data (str or dict) – Data to write. String for v1, dict for v4.

Returns:

True if file was written successfully.

Return type:

bool

mmSolver.tools.savemarkerfile.lib.write_temp_file(data)#

Write file to temporary location. Handles both string (v1) and dictionary (v4) data.

Parameters:

data (str or dict) – Data to write. String for v1, dict for v4.

Returns:

Temporary file path or False if failed.

Return type:

str or bool

Constants#

Contains constant values for the Save Marker File tool.

The .uv format, resolution independent 2D tracking format.

This file supports .uv version 1 and version 4 formats.

The UV coordinate (0.0, 0.0) is the lower-left. The UV coordinate (1.0, 1.0) is the upper-right.

Format version 1 (ASCII):

{number_of_points}
{point_name}
{number_of_frames}
{frame} {x} {y} {weight}
{frame} {x} {y} {weight}
...

Format version 4 (JSON):

{
    'version': int,
    'num_points': int,
    'is_undistorted': None,  # Deprecated
    'points': [
        {
            'name': str,
            'id': int,  # or None
            'set_name': str,
            'per_frame': [
                {
                    'frame': int,
                    'pos_dist': (float, float),
                    'pos': (float, float),
                    'weight': float
                },
            ],
           '3d': {
                'x': float, # or None
                'y': float, # or None
                'z': float, # or None
                'x_lock': bool, # or None
                'y_lock': bool, # or None
                'z_lock': bool  # or None
            }
        },
    ],
    'camera': {
        'resolution': (int, int),
        'film_back_cm': (float, float),
        'lens_center_offset_cm': (float, float),
        'per_frame': [
            {
                'frame': int,
                'focal_length_cm': float,
            },
        ],
    }
}