pymel.core.rendering.cameraView

static rendering.cameraView(*args, **kwargs)

This command creates a preset view for a camera which is then independent of the camera. The view stores a camera’s eye point, center of interest point, up vector, tumble pivot, horizontal aperture, vertical aperature, focal length, orthographic width, and whether the camera is orthographic or perspective by default. Or you can only store 2D pan/zoom attributes by setting the bookmarkType to 1. These settings can be applied to any other camera through the set camera flag. This command can be used for creation or edit of camera view objects. This command can only be executed with one of the add bookmark, or remove bookmark and one of set camera, or the set view flags set.

Flags:
Long name (short name) Argument Types Properties
addBookmark (ab) bool ../../../_images/create.gif ../../../_images/edit.gif
 
Associate this view with the camera specified or the camera in the active model panel. This flag can be used for creation or edit.
animate (an) bool ../../../_images/edit.gif
   
bookmarkType (typ) int ../../../_images/create.gif
 

Specify the bookmark type, which can be: 0. 3D bookmark; 1. 2D Pan/Zoom bookmark. Flag can have multiple arguments, passed either as a tuple or a list.

camera (c) PyNode ../../../_images/edit.gif
 

Specify the camera to use. This flag should be used in conjunction with the add bookmark, remove bookmark, set camera, or set view flags. If this flag is not specified the camera in the active model panel will be used.

name (n) unicode ../../../_images/create.gif
 
Set the name of the view. This flag can only be used for creation.
removeBookmark (rb) bool ../../../_images/edit.gif
 
Remove the association of this view with the camera specified or the camera in the active model panel. This can only be used with edit.
setCamera (sc) bool ../../../_images/edit.gif
 
Set this view into a camera specified by the camera flag or the camera in the active model panel. This flag can only be used with edit.
setView (sv) bool ../../../_images/edit.gif
 
Set the camera view to match a camera specified or the active model panel. This flag can only be used with edit.

Derived from mel command maya.cmds.cameraView

Example:

import pymel.core as pm

# Save the current position of the persp camera.
homeName = pm.cameraView(camera='persp')

# Add this view to the persp bookmark menu.
pm.cameraView( homeName, e=True, camera='persp', ab=True )

# Change the persp camera position.
pm.dolly( 'persp', distance=-30 )

# Create another bookmark for the zoomed position.
pm.cameraView( camera='persp', name='zoom', ab=True )
# Result: nt.CameraView(u'zoom') #

# Restore original camera position.
pm.cameraView( homeName, e=True, camera='persp', sc=True )

# Save the current 2D pan/zoom attributes of the persp camera
panZoomBookmark = pm.cameraView( camera='persp', ab=True, typ=1 )

# Enable 2D pan/zoom
pm.setAttr( 'perspShape.panZoomEnabled', True )

# Pan right
pm.panZoom( 'persp', r=0.6 )

# Restore original film position
pm.cameraView( panZoomBookmark, e=True, camera='persp', sc=True )

Previous topic

pymel.core.rendering.cameraSet

Next topic

pymel.core.rendering.checkDefaultRenderGlobals

Core

Core Modules

Other Modules

This Page