import Blender
# ----------------------------------
# we suppose that the only selected object is a spot
# ----------------------------------
SPOT=Blender.Object.GetSelected()[0]
# ----------------------------------
# We create an empty at the spotlight's target
# before transformations
# ----------------------------------
EMPTY=Blender.Object.New('Empty')
SCENE=Blender.Scene.getCurrent()
SCENE.link(EMPTY)
# ----------------------------------
# we move this empty at the place
# originaly spotted . In this case, the clipend point :
# ----------------------------------
EMPTY.setLocation(0.0,0.0,-SPOT.getData().clipEnd)
# ----------------------------------
# Then we move it to the correct
# place
# ----------------------------------
EMPTY.setMatrix(EMPTY.getMatrix()*SPOT.getMatrix())
|