- Thu Oct 22, 2009 5:35 pm
#312641
This might exist already but I was tired of creating these by hand so I made a script to automate linking of a distance locator with the selected camera's Maxwell focus distance. Before you run the script, you have to enable use manual focus distance in the camera shape node and – VERY IMPORTANT – change the value to something before running the script. It seems that the mxFocusDistance attribute isn't actually created or enabled until you change the value – I tried adding "setAttr ($each + ".mxUseFocusDistance" ) 1" to the script but it fails so you have to do this manually. Anyway, with a distance tool created and locator2 (the default second locator in a distance tool) to be moved to your camera location, select your camera and run this script.
Code: Select all
You will now have your Maxwell focus point always on the first locator.string $mySelection[] = `ls -sl`;
string $shapes[] = `listRelatives -shapes -noIntermediate $mySelection`;
for($each in $shapes)
{
float $p[]= `xform -q -ws -t`; move -a $p[0] $p[1] $p[2] locator2;
connectAttr distanceDimensionShape1.distance ($each + ".mxFocusDistance" );
select -af locator2;
Parent;
}



- By Andreas Hopf