By voxelpictures
#345773
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";


}

--
User avatar
By inefecto
#353405
I use a "distanceBetween" node to have the distance between the focus_locator and the camera.
Use the connection editor to link the wordMatrix of the cameraShape to the inMatrix1 and worldMatrix of the locator to the inMatrix2 param of the distanceBetween node.

In second time use this mel line to link the distanceBetween and the manual focus distance (Be sure that Maxwell manual focus is enable before) :
connectAttr -f distanceBetween1.distance cameraShape.mxFocusDistance;

In fact I have done this once and I save ma camera rig in separate file to import each time I want.

...and 3 Days later, 82.528 Views !!! ...NL, every[…]

Hello dear customers, We have just released a new[…]

grass generator extension

Just downloaded MWR5 for Rhino 6 and want to use g[…]

Hello everyone, I have a new bug with the latest M[…]