An update for the original script (2022. 02. 25.)
Now it works on multiple selected cameras.
The original post:
Finally. Here it is. The “true” Distance From Camera DOF locator. Yay.
It works as it should. It provides distance data from the camera plane (point to plane) not a simple point to point calculation (which is wrong).
Thank you, Inki for the great help.
What the script does:
- Creates an expression which calculates the distance between the camera plane and the Locator
- Creates an expression which converts the persp camera Focal Length and F Stop values to the Arnold specific Aperture size value
- DOF is on in Viewport 2.0 and for Arnold
- Scale up the Locator a bit
How to use:
- Copy the code to the Script Editor
- Select all
- Drag to the shelf (Middle Mouse Button)
// I removed the original script to avoid confusion