PDA

View Full Version : MEL Question regarding "bool"


mediumRare
12-02-2004, 01:52 AM
Hi,
If I select a couple objects and run the following:

string $myass[] = `ls -sl`;
int $attrib = `getAttr -type ($myass[0] + ".visibility")`;

i get this:

// Warning: line 2: Converting string "bool" to an int value of 0. //
// Result: 0 //

My question is....why dont I get an integer returned from my getAttr command. I wanna know if the object is visible or not!! For some reason it returns a "bool" and that "bool" gets converted to a zero so it thinks everything is not visible.
How can I re-write the command to get me a integer from the visibility of an object.

Thanks in advance for your help.
A

goleafsgo
12-02-2004, 03:23 AM
int $attrib = `getAttr -type ($myass[0] + ".visibility")`;
You are asking for the type of attribute that visibility is. It is of type bool so it is returning the text "bool" which you are trying to convert to an int. You want to just do:

int $attrib = `getAttr ($myass[0] + ".visibility")`;

mediumRare
12-02-2004, 06:10 AM
As usual, its something simple which I couldn't have figured out without your help.


Much appreciated.
A

CGTalk Moderation
01-20-2006, 02:00 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.