Page 1 of 1

MEL For Maya cam

Posted: Wed Aug 03, 2011 2:00 am
by voxelpictures
Hello guys,

I got a simple Mel Script that that i want to modify to link the Manual focus of the Maxwell camera to a included locator(included in the below script).
Please have a look...can someone update that for me? could be useful for those using animation with DOF directly in rendering.

I got a bunch of mel, expressions and GUI to write for production, is anyone interested for some jobs?

Thanks in advance

Roshan
VOXELPICTURES

--

global proc DOFcam ()
{
//curve -d 1 -p -1 -1 0
// -p -1 1 0
// -p 1 1 0
// -p 1 -1 0
// -p -1 -1 0
// -p 1 1 0

string $theCam[] = ` camera -dof 1` ;

float $fd = ` camera -query -fd $theCam[1] `;

string $theLoc[] = `spaceLocator` ;
move -a 0 0 (0-$fd);


select -tgl $theCam[0];

aimConstraint -aimVector 0 0 -1;

string $theGroup = ` group -em -name "DOFcam" `;

parent $theCam[0] $theGroup;
parent $theLoc[0] $theGroup;

string $exp = ( "float $diff[3] ;\n"+
"float $camPos[] = ` xform -q -t " + $theCam[0] + " ` ; \n"+
"float $locPos[] = ` xform -q -t " + $theLoc[0] + " `; \n " +
"\n"+
"for ($i=0; $i<3 ; $i++) \n"+
"{ \n"+
" $diff[$i] = $locPos[$i] - $camPos[$i] ; \n"+
"} \n\n"+
"float $dist = hypot($diff[0],$diff[1]); \n"+
"$dist = hypot($dist,$diff[2]); \n\n"+
$theCam[1]+".focusDistance = $dist ;") ;

expression -string $exp -name "DOFcamExp";


}

--

Re: MEL For Maya cam

Posted: Tue Oct 18, 2011 4:04 am
by r3dcube
Hi,

bit late in response but this might help you. Stripped this out of one of my scripts to setup up cameras... Might get you in the right direction.

//setup basic camera attributes
camera -n "shotCam"
-centerOfInterest 5
-focalLength 35
-lensSqueezeRatio 1
-cameraScale 1
-horizontalFilmAperture 1.41732
-horizontalFilmOffset 0
-verticalFilmAperture 0.94488
-verticalFilmOffset 0
-filmFit Fill
-overscan 1
-motionBlur 0
-shutterAngle 180
-nearClipPlane 0.1
-farClipPlane 10000
-orthographic 0
-orthographicWidth 30
-panZoomEnabled 0
-horizontalPan 0
-verticalPan 0
-zoom 1;
objectMoveCommand; cameraMakeNode 1 "";

//create distanceMeasure

distanceDimension -sp -0 0 0 -ep 0 0 -25 ;
rename "shotCam1" "shotCam";
rename "locator2" "distanceLocator";
rename "distanceDimension1" "distanceMeasure";
parent locator1 shotCam;
rename "locator1" "shotCamLocator";
//maxwell camera properties
select -r shotCam ;
maxwellCustomEnumChanged "shotCamShape.mxExpMode";
setAttr "shotCamShape.mxExpMode" 2;
maxwellCustomScalarChanged "bool" "shotCamShape.mxUseFocusDistance";
setAttr "shotCamShape.mxUseFocusDistance" 1;
maxwellCustomScalarChanged "double" "shotCamShape.mxFocusDistance";
setAttr "shotCamShape.mxFocusDistance" 60;
connectAttr -f distanceMeasureShape.distance shotCamShape.mxFocusDistance;

hope it helps,
B

Re: MEL For Maya cam

Posted: Tue Oct 18, 2011 11:42 am
by voxelpictures
Hello,

Nice, let me check and give you a feedback.
Best, Roshan