CGTalk > Software Specific Forums > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 04-27-2006, 10:53 AM   #1
Gibbz
Game Artist
 
Gibbz's Avatar
portfolio
Bronson Mathews
Game Artist
Australia
 
Join Date: Dec 2002
Posts: 1,090
Send a message via ICQ to Gibbz
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...
__________________

 
Old 04-27-2006, 12:02 PM   #2
mobeen
Veteran
portfolio
Muhammad Mobeen Movania
PHD Candidate
Nanyang Technological University
Jurong West, Singapore
 
Join Date: Jun 2005
Posts: 69
Re

Quote:
Originally Posted by Gibbz
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
Code:
for l in lights do ( print l.name --this prints light's name likewise do whatever with l )

Thanks
Mobeen
 
Old 04-27-2006, 12:15 PM   #3
Gibbz
Game Artist
 
Gibbz's Avatar
portfolio
Bronson Mathews
Game Artist
Australia
 
Join Date: Dec 2002
Posts: 1,090
Send a message via ICQ to Gibbz
hey where can i see more information on this?

For example can i do ..

for i in hidden do () ?
__________________

 
Old 04-27-2006, 12:22 PM   #4
mobeen
Veteran
portfolio
Muhammad Mobeen Movania
PHD Candidate
Nanyang Technological University
Jurong West, Singapore
 
Join Date: Jun 2005
Posts: 69
Re:

Quote:
Originally Posted by Gibbz
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?
 
Old 04-27-2006, 12:24 PM   #5
Gibbz
Game Artist
 
Gibbz's Avatar
portfolio
Bronson Mathews
Game Artist
Australia
 
Join Date: Dec 2002
Posts: 1,090
Send a message via ICQ to Gibbz
no it was just an example.

I want to find the lights currently...
__________________

 
Old 04-27-2006, 12:51 PM   #6
mobeen
Veteran
portfolio
Muhammad Mobeen Movania
PHD Candidate
Nanyang Technological University
Jurong West, Singapore
 
Join Date: Jun 2005
Posts: 69
Re:

Quote:
Originally Posted by Gibbz
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
 
Old 04-29-2006, 05:16 AM   #7
Bobo
Krakatoa Guy
 
Bobo's Avatar
Borislav Petrov
Product Specialist
Thinkbox Software
Vancouver, Canada
 
Join Date: Mar 2002
Posts: 5,320
Quote:
Originally Posted by Gibbz
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

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


You can also use

Code:
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
 
Old 04-29-2006, 05:19 AM   #8
Bobo
Krakatoa Guy
 
Bobo's Avatar
Borislav Petrov
Product Specialist
Thinkbox Software
Vancouver, Canada
 
Join Date: Mar 2002
Posts: 5,320
Quote:
Originally Posted by Gibbz
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.
__________________
Bobo
 
Old 04-30-2006, 03:14 AM   #9
Gibbz
Game Artist
 
Gibbz's Avatar
portfolio
Bronson Mathews
Game Artist
Australia
 
Join Date: Dec 2002
Posts: 1,090
Send a message via ICQ to Gibbz
Cheers

Thanks guys clears up some stuff
__________________

 
Old 04-30-2006, 03:14 AM   #10
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:03 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.