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.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
allObjects (all) | bool | ||
|
|||
animate (an) | bool | ||
Specifies that the transition between camera positions should be animated. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
fitFactor (f) | float | ||
|
|||
namespace (ns) | unicode | ||
|
Derived from mel command maya.cmds.viewFit
Example:
import pymel.core as pm
# Position the active camera to view the active objects
pm.viewFit()
# Position cameraShape-1 to view all objects
pm.viewFit( 'cameraShape1', all=True )
# Fill 50 percent of the active view with active objects
pm.viewFit( f=0.5 )
pm.viewFit( all=True )