PDA

View Full Version : detecting object in a scene?


Gibbz
04-27-2006, 10:53 AM
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...

mobeen
04-27-2006, 12:02 PM
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...
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

Gibbz
04-27-2006, 12:15 PM
hey where can i see more information on this?

For example can i do ..

for i in hidden do () ?

mobeen
04-27-2006, 12:22 PM
hey where can i see more information on this?

For example can i do ..

for i in hidden do () ?
What do you want to do???
Do you want to access all hidden nodes in the current scene?

Gibbz
04-27-2006, 12:24 PM
no it was just an example.

I want to find the lights currently... :)

mobeen
04-27-2006, 12:51 PM
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

Bobo
04-29-2006, 05:16 AM
hey where can i see more information on this?

For example can i do ..

for i in hidden do () ?

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...

Bobo
04-29-2006, 05:19 AM
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...

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.

Gibbz
04-30-2006, 03:14 AM
Cheers :)

Thanks guys clears up some stuff

CGTalk Moderation
04-30-2006, 03:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.