PDA

View Full Version : nodeType "light" analogical to ls -type "light"


bolekcg
11-04-2012, 10:11 PM
Hi guys.

I'm new in this section so please be forgiving. :)

Anyway what I'm looking for is more straight forward method to check if created node was any type of light.

We can list all lights by ls (ls -type "light"), but what about getting nodeType?
All we can receive by { nodeType/objectType "lightShape" } is it's exact type, but I need more general info such " light ".

Do you know about analogical method to (ls -type "light") but with nodeType command.

Thanks in advance and best!

NaughtyNathan
11-05-2012, 12:17 AM
what exactly are you trying to do? and why do you need to use nodeType for it?

if `ls -type "light"`gives you the info you need then just use that.. (you can specify a node too there you know!)

bolekcg
11-05-2012, 09:00 AM
Thx for quick resopnd NaughtyNathan!

-what exactly are you trying to do?
The thing is I need it for a scriptJob that waits for light creation and It would be more elegant to use kind of nodeType/objectType isType "light"

-and why do you need to use nodeType for it?
There is no need to use nodeType. It is just curiosity of possible methods for learning purposes

Thanks again!

NaughtyNathan
11-05-2012, 11:25 AM
well "light" is an abstract parent class of all lights, so if you want to use the nodeType command, use the -inherited flag which gives you a list of all the base node types inherited by the given object. in the case of lights, "light" is the 5th element in the list. Personally I would still use ls:

string $selectedLights[] = `ls -sl -dag -type "light"`;
if (`size $selectedLights`) print "a light is selected!";

// or:

if (size(`ls -type "light" -dag $node`)) print "$node is a light";

bolekcg
11-05-2012, 01:23 PM
True.

"nodeType -inherited " gives to much useless(for that purpose) info so as you said ls would be better.

http://xyz2.net/mel/mel.023.htm namely "getClassification" or
string $type = `nodeType pCubeShape1`;
if (`gmatch $type "*Light"`) print "light";
could be used too.

Thanks for your support NaughtyNathan!!
Cheers!

CGTalk Moderation
11-05-2012, 01:23 PM
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.