PDA

View Full Version : selecting objects with specific names...


steverage
11-23-2006, 01:02 PM
Hi guys,

bit stuck and could do with a hand!

is there a way of looping through all the objects in the scen and adding matching objects to an array?
e.g.

LOOP
check name
if name = XXX
add to array
END LOOP

many thanks in advance!! :D

flaiver
11-23-2006, 01:38 PM
string $allObj[]=`ls`;
string $myArray[];
int $count=0;

for ($obj in $allObj) {
if($obj=="myName") {
$myArray[$count]=$obj;
$count++;
}

}

print $myArray;

steverage
11-23-2006, 01:50 PM
awesome thanks!!

CaptainSam
11-23-2006, 03:12 PM
or just

string $objects[]=`ls "*myName*"`

with or without wildcards on each side

CGTalk Moderation
11-23-2006, 03:12 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.