pymel.core.rendering.perCameraVisibility¶
- perCameraVisibility(*args, **kwargs)¶
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).
Flags:
Long Name / Short Name Argument Types Properties camera / c PyNode Specify the camera for the operation. exclusive / ex bool Set objects as being exclusive to the given camera. hide / hi bool Set objects as being hidden from the given camera. remove / rm bool Used with exclusive or hide, removes the objects instead of adding them. removeAll / ra bool Remove all exclusivity/hidden objects for all cameras. removeCamera / rc bool Remove all exclusivity/hidden objects for the given camera. Flag can have multiple arguments, passed either as a tuple or a list. 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 )