global proc dbr_bakeCamera(string $cam)
{
string $bakeCam[] = `camera -name ($cam + "_BAKE")`;
string $oCST[] = `orientConstraint $cam $bakeCam[0]`;
string $pCST[] = `pointConstraint $cam $bakeCam[0]`;
bakeResults -t "1:68" -at "tx" -at "ty" -at "tz" -at "rx" -at "ry" -at "rz" $bakeCam[0];
delete $oCST[0];
delete $pCST[0];
}
//usage: dbr_bakeCamera("camName") where camName is the name of the camera you'd like to bake.
** Python
import maya.cmds as cmds
** Python
import maya.cmds as cmds
def dbr_bakeCamera(cameraName, frameRange):
bakeCamera = cmds.camera(name = '%s_BAKE' % cameraName)
orientCNSTR = cmds.orientConstraint(cameraName, bakeCamera[0])
pointCNSTR = cmds.pointConstraint(cameraName, bakeCamera[0])
cmds.bakeResults(bakeCamera[0], t = frameRange, at = ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'focalLength'])
cmds.delete(orientCNSTR)
cmds.delete(pointCNSTR)
#Bake selected camera from frame 1 to 62
dbr_bakeCamera(cmds.ls(sl = True)[0], (1,62))
No comments:
Post a Comment