Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Last active September 5, 2017 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEVEZ/103674f1c319f0ffc15c5ade30a7ac76 to your computer and use it in GitHub Desktop.
Save SEVEZ/103674f1c319f0ffc15c5ade30a7ac76 to your computer and use it in GitHub Desktop.
Fit near and far camera clipping planes by object's bounding box #misc
from pymel.core import *
sel = selected()[0]
cam = PyNode( 'persp1' )
parent( sel, cam, a=1 )
bbcoord = xform( sel, q=1, os=1, bb=1 )
near = -bbcoord[5]
far = -bbcoord[2]
cam.setClippingPlanes( 1 )
cam.setFarClipPlane( far )
cam.setNearClipPlane( near )
parent( sel, w=1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment