Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

viewSet( [camera] , [animate=boolean], [back=boolean], [bottom=boolean], [fit=boolean], [fitFactor=float], [front=boolean], [home=boolean], [keepRenderSettings=boolean], [leftSide=boolean], [namespace=string], [nextView=boolean], [persp=boolean], [previousView=boolean], [rightSide=boolean], [side=boolean], [top=boolean], [viewNegativeX=boolean], [viewNegativeY=boolean], [viewNegativeZ=boolean], [viewX=boolean], [viewY=boolean], [viewZ=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

viewSet is undoable, queryable, and NOT editable.

This command positions the camera to one of the pre-defined positions. If the fit flag is set in conjunction with persp, top, side, or front, the view is "fit" based on the list of selected objects (if there are any) or on all the objects if nothing is selected. Notice that the fit flag cannot be set in conjunction with view along axis commands like viewX. If a camera is not specified, the camera in the active view will be used. If no flag is specified, the camera is set to the home position.

Return value

None

In query mode, return type is based on queried flag.

Related

camera, cameraView, dolly, listCameras, lookThru, orbit, roll, track, tumble, viewCamera, viewClipPlane, viewFit, viewHeadOn, viewLookAt, viewPlace

Flags

animate, back, bottom, fit, fitFactor, front, home, keepRenderSettings, leftSide, namespace, nextView, persp, previousView, rightSide, side, top, viewNegativeX, viewNegativeY, viewNegativeZ, viewX, viewY, viewZ
Long name (short name) Argument types Properties
animate(an) boolean create
Specifies that the transition between camera positions should be animated.
back(b) boolean create
Moves the camera to the back position.
bottom(bo) boolean create
Moves the camera to the bottom position.
fit(fit) boolean createquery
Apply a viewFit after positioning camera to persp, top, side, or front.
fitFactor(ff) float create
Specifies how much of the view should be filled with the "fitted" items
front(f) boolean create
Moves the camera to the front position.
home(h) boolean create
Executes the camera's home attribute command. Before the string is executed, all occurances of "%camera" will be replaced by the camera's name. Use the camera command to set a camera's home command.
keepRenderSettings(krs) boolean createquery
Retain the 'renderable' flag vaue on the view. Especially important if it switches from perspective to orthographic and then back again.
leftSide(ls) boolean create
Moves the camera to the left side position.
namespace(ns) string create
Specifies a namespace that should be excluded. All objects in the specified namespace will be excluded from the fit process.
nextView(nv) boolean createquery
Moves the camera to the next position.
persp(p) boolean create
Moves the camera to the persp position.
previousView(pv) boolean createquery
Moves the camera to the previous position.
rightSide(rs) boolean create
Moves the camera to the right side position.
side(s) boolean create
Moves the camera to the (right) side position (deprecated).
top(t) boolean create
Moves the camera to the top position.
viewNegativeX(vnx) boolean create
Moves the camera to view along negative X axis.
viewNegativeY(vny) boolean create
Moves the camera to view along negative Y axis.
viewNegativeZ(vnz) boolean create
Moves the camera to view along negative Z axis.
viewX(vx) boolean create
Moves the camera to view along X axis.
viewY(vy) boolean create
Moves the camera to view along Y axis.
viewZ(vz) boolean create
Moves the camera to view along Z axis.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create a new camera
cam = cmds.camera();
camShape = cam[1];

# Set cameraShape1 to the persp position
cmds.viewSet( camShape, p=True )

# Set the camera in the active view to the top position
cmds.viewSet( t=True )