Notifications
Clear all

[Closed] detecting object in a scene?

Im looking to do a quick check of all existing light in the scene when the script loads.

So when the script loads id like to check the rootnode for all objects and check over them for which of them is a light, or is there an easier way?

Cheers…

8 Replies
2 Replies
(@mobeen)
Joined: 11 months ago

Posts: 0

You can access all lights in the scene using lights object set to iterate over all lights in your scene do this

 for l in lights do 
(
   print l.name --this prints light's name likewise do whatever with l
)

Thanks
Mobeen

(@bobo)
Joined: 11 months ago

Posts: 0

Btw, the fastest way to get all lights (hidden or not) is

theLights = lights as array

This is equivalent to

theLights = for o in lights collect o

but should be faster.
Of course, in the second case you can apply WHERE statements to collect conditionally, while the first one just gives you an array with all lights in it.

hey where can i see more information on this?

For example can i do …

for i in hidden do () ?

2 Replies
(@mobeen)
Joined: 11 months ago

Posts: 0

What do you want to do???
Do you want to access all hidden nodes in the current scene?

(@bobo)
Joined: 11 months ago

Posts: 0

In the MAXScript Reference, of course
Topic is “ObjectSet Values”

There is no built-in Hidden object set, but you can say

HiddenLights = for o in Lights where not o.isHidden collect o

You can also use

ReallyHiddenLights = for o in Lights where not o.isHiddenInVpt collect o

This will take into account ANY reasons for the hidden state, including Hidden Frozen objects, Hidden Layer, Hidden Category and Hidden Node…

no it was just an example.

I want to find the lights currently…

Oh ok. 3dsmax has some standard object sets like lights, objects, geometry etc which you can use to find out the scenes items. Refer to maxscript reference topic object sets for details. Always have maxscript reference nearby when scripting and search for things that are globally available.
Thanks
Mobeen

Cheers

Thanks guys clears up some stuff