maya.capture#

Maya Capture.

A modified version of https://github.com/abstractfactory/maya-capture by Marcus Ottosson.

Functions:

apply_scene(**options)

Apply options from scene

apply_view(panel, **options)

Apply options to panel

capture([camera, width, height, filename, ...])

Playblast in an independent panel.

nested(*contexts)

Reimplementation of nested in python 3.

parse_active_panel()

Parse the active modelPanel.

parse_active_scene()

Parse active scene for arguments for capture()

parse_active_view()

Parse the current settings from the active view

parse_view(panel)

Parse the scene, panel and camera for their current settings

snap(*args, **kwargs)

Single frame playblast in an independent panel.

bookmarks.maya.capture.apply_scene(**options)[source]#

Apply options from scene

Example

>>> apply_scene({'start_frame': 1009})
Parameters

options (dict) – Scene options

bookmarks.maya.capture.apply_view(panel, **options)[source]#

Apply options to panel

bookmarks.maya.capture.capture(camera=None, width=None, height=None, filename=None, start_frame=None, end_frame=None, frame=None, format='qt', compression='H.264', quality=100, off_screen=False, viewer=True, show_ornaments=True, sound=None, isolate=None, maintain_aspect_ratio=True, overwrite=False, frame_padding=4, raw_frame_numbers=False, camera_options=None, display_options=None, viewport_options=None, viewport2_options=None, complete_filename=None)[source]#

Playblast in an independent panel.

Parameters
  • camera (str, optional) – Name of camera, defaults to ‘persp’

  • width (int, optional) – Width of output in pixels

  • height (int, optional) – Height of output in pixels

  • filename (str, optional) – Name of output file. If none is specified, no files are saved.

  • start_frame (float, optional) – Defaults to current start frame.

  • end_frame (float, optional) – Defaults to current end frame.

  • frame (float or tuple, optional) – A single frame or list of frames. Use this to capture a single frame or an arbitrary sequence of frames.

  • format (str, optional) – Name of format, defaults to ‘qt’.

  • compression (str, optional) – Name of compression, defaults to ‘H.264’

  • quality (int, optional) – The quality of the output, defaults to 100

  • off_screen (bool, optional) – Whether to playblast off-screen

  • viewer (bool, optional) – Display results in native player

  • show_ornaments (bool, optional) – Whether model view ornaments (e.g. axis icon, grid and HUD) should be displayed.

  • sound (str, optional) – Specify the sound node to be used during playblast. When None (default) no sound will be used.

  • isolate (list) – List of nodes to isolate upon capturing

  • maintain_aspect_ratio (bool, optional) – Modify height in order to maintain aspect ratio.

  • overwrite (bool, optional) – Whether to overwrite if file already exists. If disabled and file exists and error will be raised.

  • frame_padding (bool, optional) – Number of zeros used to pad file name for image sequences.

  • raw_frame_numbers (bool, optional) – Whether to use the exact frame numbers from the scene or capture to a sequence starting at zero. Defaults to False. When set to True viewer can’t be used and will be forced to False.

  • camera_options (dict, optional) – Supplied camera options, using CameraOptions

  • display_options (dict, optional) – Supplied display options, using DisplayOptions

  • viewport_options (dict, optional) – Supplied viewport options, using ViewportOptions

  • viewport2_options (dict, optional) – Supplied display options, using Viewport2Options

  • complete_filename (str, optional) – Exact name of output file. Use this to override the output of filename so it excludes frame padding.

Example

>>> # Launch default capture
>>> capture()
>>> # Launch capture with custom viewport settings
>>> capture('persp', 800, 600,
...         viewport_options={
...             'displayAppearance': 'wireframe',
...             'grid': False,
...             'polymeshes': True,
...         },
...         camera_options={
...             'displayResolution': True
...         }
... )
bookmarks.maya.capture.nested(*contexts)[source]#

Reimplementation of nested in python 3.

bookmarks.maya.capture.parse_active_panel()[source]#

Parse the active modelPanel.

Raises

RuntimeError: When no active modelPanel an error is raised.

Returns

Name of modelPanel

Return type

str

bookmarks.maya.capture.parse_active_scene()[source]#

Parse active scene for arguments for capture()

Resolution taken from render common.

bookmarks.maya.capture.parse_active_view()[source]#

Parse the current settings from the active view

bookmarks.maya.capture.parse_view(panel)[source]#

Parse the scene, panel and camera for their current settings

Example

>>> parse_view('modelPanel1')
Parameters

panel (str) – Name of modelPanel

bookmarks.maya.capture.snap(*args, **kwargs)[source]#

Single frame playblast in an independent panel.

The arguments of capture are all valid here as well, except for start_frame and end_frame.

Parameters
  • frame (float, optional) – The frame to snap. If not provided current frame is used.

  • clipboard (bool, optional) – Whether to add the output image to the global clipboard. This allows to easily paste the snapped image into another application, e.g. into Photoshop.

Keywords:

See capture.