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.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
addBookmark (ab) | bool | ||
|
|||
animate (an) | bool | ||
bookmarkType (typ) | int | ||
Specify the bookmark type, which can be: 0. 3D bookmark; 1. 2D Pan/Zoom bookmark.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
camera (c) | PyNode | ||
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 | ||
|
|||
removeBookmark (rb) | bool | ||
|
|||
setCamera (sc) | bool | ||
|
|||
setView (sv) | bool | ||
|
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 )