What students are saying about Joe Crawford
Founder of Teaching 3D
"His problem solving wizardry is second to none." - Colby Young, 3D Custom Foam
A script to quickly edit clipping planes:
## This script will quickly edit the clipping of the currently active view/panel
## it will give an error if not run from the viewport, so put it it a shelf,
## click in your view, and run the script.
import pymel.all as pm
## Get a number from the user in an incredibly simple dialog box
## This number will be the new clipping plane
userNearClip = float( raw_input() )
## Get the active camera transform, make a short nickname for it: cam
camName = pm.modelPanel( pm.getPanel(wf=True), query=True, cam=True )
cam = camXform = pm.PyNode( camName )
## Get the shape node attached to the camera's transform node
camShape = cam.getShape()
## Set the clip planes of the camera using standard pymel attribute access with get/set
## note the use of a multiply to set a mathematical relationship between near and far
camShape.nearClipPlane.set( userNearClip )
camShape.farClipPlane.set( camShape.nearClipPlane.get() * 500000 )
## This script could be improved.
## It could become much better by getting added to the "f" hotkey
## and calculating nearClip based on the camera's new distance
## from the selection. Hopefully MmmmTools can do this,
## as well as auto adjusting the ortho views