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).
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
camera (c) | PyNode | ![]() ![]() |
|
|
|||
exclusive (ex) | bool | ![]() ![]() |
|
|
|||
hide (hi) | bool | ![]() ![]() |
|
|
|||
remove (rm) | bool | ![]() |
|
|
|||
removeAll (ra) | bool | ![]() |
|
|
|||
removeCamera (rc) | bool | ![]() |
|
|
Derived from mel command maya.cmds.perCameraVisibility
Example:
import pymel.core as pm
# make 'pSphere1' exclusive to camera 'persp'
pm.perCameraVisibility( 'pSphere1', ex=True, c='persp' )
# remove 'pSphere1' from camera 'persp''s exclusive objects
pm.perCameraVisibility( 'pSphere1', ex=True, rm=True, c='persp' )
# query the objects that are exclusive to 'persp'
pm.perCameraVisibility( q=True, ex=True, c='persp' )
# hide 'pSphere1' from camera 'persp'
pm.perCameraVisibility( 'pSphere1', hi=True, c='persp' )
# remove 'pSphere1' from camera 'persp''s hidden objects
pm.perCameraVisibility( 'pSphere1', hi=True, rm=True, c='persp' )
# query the objects that are hidden from 'persp'
pm.perCameraVisibility( q=True, hi=True, c='persp' )
# remove all exclusive or hidden objects from 'persp'
pm.perCameraVisibility( rc=True, c='persp' )
# remove all exclusive or hidden objects from all cameras
pm.perCameraVisibility( ra=True )