Notifications
Clear all

[Closed] Select all spotlights

Hi,

I want a button that will add all the spotlights in a scene into an array. But for the life of me I can’t work out how to do it.

Sorry for being a bit of a newbie

Thanks in advance
Garry

3 Replies

Hi Garry,
following code cycles through every light in the scene and collects in an array all TargetSpots and FreeSpots.

(
    aSpotlights = for item in lights where ( (classOf item == TargetSpot) or (classOf item == FreeSpot) ) collect item
    print aSpotlights
)
  • Enrico

Hi Enrico,

Thanks again for the help, I don’t think I’d have been able to work this out too quickly.

Cheers
Garry

You can also do…

(getClassInstances TargetSpot) + (getClassInstances FreeSpot)