Return list of "visible" objects...how?

is there a quick, easy and fast way to return a list of every object which is currently visible..? And by "visible" I don't mean it's visibility attribute is on because that DOESN'T actually mean it is definitely being drawn does it?, as one of it's ancestors may be hidden..

I'm trying to write a function that operates on all the visible lights (in a similar way that Panel > Lighting > Use All lights doesn't use ALL lights, just the "visible" ones) and at the moment I'm looking at having to write some awful recursive trawl function that checks all of a light's ancestors for visibility, and when I've got potentially shed-loads of lights under loads of parents I can see that method being very slow and inefficient..

anyone know of an existing function or clever trick to achieve this?

:nathaN

Have you tried ls -visible?

--g

nope... I have now though! ta.