This little script is used so an object can be used to set the camera’s focus
Use it as an object scriptlink on an empty, redraw event.
Then you can move it about to set what you focus on.
This is a simple scriptlink, maybe people would like to mess with it and do some more interesting stuff.
import Blender as B; Vector = B.Mathutils.Vector target = B.link # the object that started the scriptlink. if type(target) != B.Types.ObjectType: B.Draw.PupMenu('Can only assign this scriptlink to an object') else: # target is an Object scn = B.Scene.GetCurrent() cam = scn.getCurrentCamera() if cam and cam.type == 'Camera': # scene may have no camera or use a non camera object AS a camera. cam.data.dofDist =\ (Vector(cam.getLocation('worldspace')) - Vector(target.getLocation('worldspace'))).length