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

Synopsis

perCameraVisibility([camera=name], [exclusive=boolean], [hide=boolean], [remove=boolean], [removeAll=boolean], [removeCamera=boolean])

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

perCameraVisibility is NOT undoable, queryable, and NOT editable.

The perCameraVisibility command creates, queries and removes visibility relationships between DAG objects and cameras. These relationships are applied in any viewport that uses the cameras involved. (They are not used e.g. in rendering.) Objects can be set to be exclusive to a camera (meaning they will only be displayed in viewports using that camera; they will be hidden in other viewports) or hidden from a camera (meaning they will be not visible in any viewport using the camera).

Return value

string[]Command result

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

Keywords

viewport, visibility

Related

hide, showHidden

Flags

camera, exclusive, hide, remove, removeAll, removeCamera
Long name (short name) Argument types Properties
camera(c) name createquery
Specify the camera for the operation.
exclusive(ex) boolean createquery
Set objects as being exclusive to the given camera.
hide(hi) boolean createquery
Set objects as being hidden from the given camera.
remove(rm) boolean create
Used with exclusive or hide, removes the objects instead of adding them.
removeAll(ra) boolean create
Remove all exclusivity/hidden objects for all cameras.
removeCamera(rc) boolean create
Remove all exclusivity/hidden objects for the given camera.

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

# make 'pSphere1' exclusive to camera 'persp'
cmds.perCameraVisibility( 'pSphere1', ex=True, c='persp' )
# remove 'pSphere1' from camera 'persp''s exclusive objects
cmds.perCameraVisibility( 'pSphere1', ex=True, rm=True, c='persp' )
# query the objects that are exclusive to 'persp'
cmds.perCameraVisibility( q=True, ex=True, c='persp' )
# hide 'pSphere1' from camera 'persp'
cmds.perCameraVisibility( 'pSphere1', hi=True, c='persp' )
# remove 'pSphere1' from camera 'persp''s hidden objects
cmds.perCameraVisibility( 'pSphere1', hi=True, rm=True, c='persp' )
# query the objects that are hidden from 'persp'
cmds.perCameraVisibility( q=True, hi=True, c='persp' )
# remove all exclusive or hidden objects from 'persp'
cmds.perCameraVisibility( rc=True, c='persp' )
# remove all exclusive or hidden objects from all cameras
cmds.perCameraVisibility( ra=True )