Go to: Synopsis. Return value. Related. Flags. Python examples.
viewFit(
[camera]
, [allObjects=boolean], [animate=boolean], [fitFactor=float], [namespace=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
viewFit is undoable, queryable, and editable.
The viewFit command positions the specified camera so its point-of-view contains all selected objects other than itself. If no objects are selected, everything is fit to the view (excepting cameras, lights, and sketching plannes). The fit-factor, if specified, determines how much of the view should be filled. If a camera is not specified, the camera in the active view will be used. After the camera is moved, its center of interest is set to the center of the bounding box of the objects.None
In query mode, return type is based on queried flag.
| Long name (short name) | argument types | Properties | ||
|---|---|---|---|---|
fitFactor(f)
|
float
|
|
||
|
||||
allObjects(all)
|
boolean
|
|
||
|
||||
namespace(ns)
|
string
|
|
||
|
||||
animate(an)
|
boolean
|
|
||
|
||||
import maya.cmds as cmds # Position the active camera to view the active objects cmds.viewFit() # Position cameraShape-1 to view all objects cmds.viewFit( 'cameraShape1', all=True ) # Fill 50 percent of the active view with active objects cmds.viewFit( f=0.5 ) cmds.viewFit( all=True )