PDA

View Full Version : how to find object through attribute


king21
05-17-2006, 12:38 PM
if i have name of the attribute , how can i find wich object has this attribute.

Thx in advance.

Jure

scottiedoo
05-17-2006, 08:57 PM
this should do it:


string $attributeName = "NAME_OF_ATTRIBUTE";
string $allObjects[] = `ls`;

for($obj in $allObjects){
if(`attributeQuery -n $obj -ex $attributeName`){
print ($obj +"\n");
}
}


just replace the NAME_OF_ATTRIBUTE with whatever the correct attribute you are searching for.. it will print out the name of the objects that match.. right now all objects in the scene are checked, but you narrow that down by modifying the "ls" command if you have a specific type of object or selection..

good luck
-Scott

CGTalk Moderation
05-17-2006, 08:57 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.