Create a Target Spot from View Script
For some reason I thought I had seen something like this already, well couldn’t find anything soo… I found Neil Blevins old create camera from view script from his BlurScripts pack, changed it a bit and viola…done, simple maxscript is soo handy
Save as LightFromView.mcr and save in your local usermacros folder, create a shortcut, button, ect.
macroScript CreateLightFromView
category:"Lights and Cameras"
toolTip:"Create Target Spot from Pers. View"
ButtonText:"Light From View"
Icon:#("Lights",1)
(
focdistance = gw.GetFocalDist()
cp = mapscreentoworldray (getviewsize()/2)
ct = targetobject position:(cp.pos+(cp.dir*focdistance))
NewTargetSpotLight = targetspot pos:cp.pos target:ct
NewTargetSpotLight.target.name = NewTargetSpotLight.name + ".Target"
--viewport.setcamera NewTargetSpotLight --enable this if you want to use the camera controls to move the new light in the viewport
)


Thanks! Very useful!
No worries, I am glad I am not the only one who thinks creating a light is a pain in the butt.
Ruben Mayor (aka HolyCause) found a couple more
macroScript spotFromView
category:"Lights"
toolTip:"Create a spot light from the active view"
(
s = FreeSpot()
s.transform = Inverse(getViewTM())
)
macroScript directionnalFromView
category:"Lights"
toolTip:"Create a directionnal light from the active view"
(
s = directionalLight()
s.transform = Inverse(getViewTM())
)